@openhands/extensions 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/automations/catalog/github-pr-reviewer.json +2 -2
- package/automations/catalog/slack-channel-monitor.json +2 -2
- package/integrations/catalog/github.json +8 -24
- package/integrations/index.d.ts +2 -0
- package/package.json +1 -1
- package/plugins/qa-changes/action.yml +1 -1
- package/pyproject.toml +1 -1
- package/skills/github-pr-reviewer/.plugin/plugin.json +1 -1
- package/skills/github-pr-reviewer/README.md +21 -15
- package/skills/github-pr-reviewer/SKILL.md +85 -66
- package/skills/github-pr-reviewer/commands/pr-reviewer-setup.md +1 -1
- package/skills/github-pr-reviewer/references/state-schema.md +74 -46
- package/skills/github-pr-reviewer/scripts/main.py +210 -227
- package/skills/index.js +3 -3
- package/skills/slack-channel-monitor/README.md +8 -4
- package/skills/slack-channel-monitor/SKILL.md +15 -6
- package/skills/slack-channel-monitor/references/slack-api.md +5 -3
- package/skills/slack-channel-monitor/references/state-schema.md +59 -32
- package/skills/slack-channel-monitor/scripts/main.py +242 -40
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"id": "github-pr-reviewer",
|
|
3
3
|
"name": "GitHub Code Review Agent",
|
|
4
4
|
"category": "Code review",
|
|
5
|
-
"description": "Watch pull requests, inspect
|
|
5
|
+
"description": "Watch for a configurable label on GitHub pull requests, inspect full PR and repository context, and post an AI review comment once per label event.",
|
|
6
6
|
"requiredIntegrationIds": [
|
|
7
7
|
"github"
|
|
8
8
|
],
|
|
9
9
|
"popularityRank": 100,
|
|
10
10
|
"estimatedSetupMinutes": 4,
|
|
11
11
|
"prompt": "/pr-reviewer:setup",
|
|
12
|
-
"exampleImplementation": "Trigger:
|
|
12
|
+
"exampleImplementation": "Trigger: cron polling for open GitHub PRs with a configured label such as openhands-review\nRequired secret: GITHUB_PERSONAL_ACCESS_TOKEN\n\n1. Read repository, trigger label, review tone, and polling schedule from setup.\n2. List open PRs and find the latest matching GitHub labeled issue event for each labeled PR.\n3. Deduplicate on the label event ID so every label application queues exactly one review.\n4. Start an OpenHands conversation that clones the repo, checks out the exact PR head SHA, and inspects PR discussion, review comments, changed files, diff, and surrounding code.\n5. Post an acknowledgement with the conversation link, then post the final AI review comment only if the PR is still open and the head SHA has not changed."
|
|
13
13
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"id": "slack-channel-monitor",
|
|
3
3
|
"name": "Slack channel monitor",
|
|
4
4
|
"category": "Team communication",
|
|
5
|
-
"description": "Watch Slack channels for @openhands mentions, open a conversation with the message context,
|
|
5
|
+
"description": "Watch Slack channels for @openhands mentions, open a conversation with the message context, reply when the agent finishes, and continue the same conversation from triggered Slack thread follow-ups.",
|
|
6
6
|
"requiredIntegrationIds": ["slack"],
|
|
7
7
|
"popularityRank": 92,
|
|
8
8
|
"estimatedSetupMinutes": 7,
|
|
9
9
|
"prompt": "/slack-monitor:poll",
|
|
10
|
-
"exampleImplementation": "Trigger: cron, every minute\nRequired secret: SLACK_BOT_TOKEN or SLACK_USER_TOKEN\n\n1. Poll up to 10 configured Slack channels for new messages since the last run.\n2. Match messages containing the trigger phrase (default: @openhands).\n3. React with 👀 and start an OpenHands conversation with the message and recent channel context.\n4. Post a thread reply with a link to the conversation.\n5.
|
|
10
|
+
"exampleImplementation": "Trigger: cron, every minute\nRequired secret: SLACK_BOT_TOKEN or SLACK_USER_TOKEN\n\n1. Poll up to 10 configured Slack channels for new messages since the last run.\n2. Match messages containing the trigger phrase (default: @openhands).\n3. React with 👀 and start an OpenHands conversation with the message and recent channel context.\n4. Post a thread reply with a link to the conversation, then post the agent response when done.\n5. Keep the thread in a short follow-up watch window and forward only replies that repeat the trigger phrase to the same conversation, with per-thread backoff for quiet threads."
|
|
11
11
|
}
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"code"
|
|
13
13
|
],
|
|
14
14
|
"popularityRank": 100,
|
|
15
|
-
"installHint": "Requires Docker because the legacy npm package was deprecated upstream.",
|
|
16
15
|
"kind": "mcp",
|
|
17
16
|
"defaultConnectionOptionId": "api",
|
|
18
17
|
"connectionOptions": [
|
|
@@ -20,31 +19,16 @@
|
|
|
20
19
|
"id": "api",
|
|
21
20
|
"provider": "mcp",
|
|
22
21
|
"transport": {
|
|
23
|
-
"kind": "
|
|
24
|
-
"
|
|
25
|
-
"command": "docker",
|
|
26
|
-
"args": [
|
|
27
|
-
"run",
|
|
28
|
-
"-i",
|
|
29
|
-
"--rm",
|
|
30
|
-
"-e",
|
|
31
|
-
"GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
32
|
-
"ghcr.io/github/github-mcp-server"
|
|
33
|
-
],
|
|
34
|
-
"envFields": [
|
|
35
|
-
{
|
|
36
|
-
"key": "GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
37
|
-
"label": "Personal access token",
|
|
38
|
-
"type": "password",
|
|
39
|
-
"placeholder": "github_pat_...",
|
|
40
|
-
"required": true,
|
|
41
|
-
"helperText": "Classic or fine-grained personal access token from GitHub settings.",
|
|
42
|
-
"helperLink": "https://github.com/settings/tokens"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
22
|
+
"kind": "shttp",
|
|
23
|
+
"url": "https://api.githubcopilot.com/mcp/"
|
|
45
24
|
},
|
|
46
25
|
"auth": {
|
|
47
|
-
"strategy": "api_key"
|
|
26
|
+
"strategy": "api_key",
|
|
27
|
+
"credentialLabel": "Personal access token",
|
|
28
|
+
"credentialPlaceholder": "github_pat_...",
|
|
29
|
+
"credentialHelp": "Classic or fine-grained personal access token from GitHub settings.",
|
|
30
|
+
"credentialSecretName": "GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
31
|
+
"saveCredentialAsSecretByDefault": true
|
|
48
32
|
}
|
|
49
33
|
}
|
|
50
34
|
]
|
package/integrations/index.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ export interface IntegrationAuthConfig {
|
|
|
59
59
|
credentialLabel?: string;
|
|
60
60
|
credentialPlaceholder?: string;
|
|
61
61
|
credentialHelp?: string;
|
|
62
|
+
credentialSecretName?: string;
|
|
63
|
+
saveCredentialAsSecretByDefault?: boolean;
|
|
62
64
|
apiKeyHeaderName?: string;
|
|
63
65
|
apiKeyOptional?: boolean;
|
|
64
66
|
oauth?: IntegrationOAuthConfig;
|
package/package.json
CHANGED
|
@@ -160,7 +160,7 @@ runs:
|
|
|
160
160
|
# so we enforce the time limit via the coreutils timeout command.
|
|
161
161
|
TIMEOUT_SECONDS=$((TIMEOUT_MINUTES * 60))
|
|
162
162
|
timeout "${TIMEOUT_SECONDS}" \
|
|
163
|
-
uv run --no-project --with openhands-sdk --with openhands-tools --with lmnr \
|
|
163
|
+
uv run --no-project --with openhands-sdk --with openhands-tools --with 'lmnr<0.7.53' \
|
|
164
164
|
python ../extensions/plugins/qa-changes/scripts/agent_script.py
|
|
165
165
|
|
|
166
166
|
- name: Upload logs as artifact
|
package/pyproject.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-pr-reviewer",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"description": "Create an automation that reviews GitHub pull requests when
|
|
4
|
+
"description": "Create an automation that reviews GitHub pull requests when a configurable trigger label is applied. It starts one OpenHands review conversation per label event, inspects full PR and repository context, and posts the final review comment back to GitHub.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "OpenHands",
|
|
7
7
|
"email": "contact@all-hands.dev"
|
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
# GitHub PR Reviewer
|
|
2
2
|
|
|
3
|
-
Create an automation that reviews GitHub pull requests
|
|
3
|
+
Create an automation that reviews GitHub pull requests when a configurable
|
|
4
|
+
trigger label is applied.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Trigger
|
|
6
7
|
|
|
7
|
-
This skill is activated by
|
|
8
|
+
This skill is activated by:
|
|
8
9
|
|
|
9
|
-
- `
|
|
10
|
-
- `PR review automation`
|
|
11
|
-
- `auto-review PRs`
|
|
10
|
+
- `/pr-reviewer:setup`
|
|
12
11
|
|
|
13
12
|
## Features
|
|
14
13
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
14
|
+
- Reviews PRs on demand by watching for a GitHub label event
|
|
15
|
+
- Processes each label application exactly once, with persistent state
|
|
16
|
+
- Re-review support by removing and re-applying the label
|
|
17
|
+
- Suppresses stale reviews when the PR head commit changes mid-review
|
|
18
|
+
- Uses a real cloned checkout and full PR context instead of only a truncated diff
|
|
19
|
+
- Posts acknowledgement and final review comments with AI disclosure
|
|
20
|
+
- Configurable review tone and polling schedule
|
|
20
21
|
|
|
21
22
|
## Prerequisites
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
Set `GITHUB_PERSONAL_ACCESS_TOKEN` in OpenHands Settings -> Secrets. The token
|
|
25
|
+
must be able to read the repository, read pull requests, read issue events, and
|
|
26
|
+
write issue comments.
|
|
24
27
|
|
|
25
28
|
## Quick Start
|
|
26
29
|
|
|
27
30
|
Ask OpenHands:
|
|
28
31
|
|
|
29
|
-
> "Set up a PR review automation for my myorg/backend repo
|
|
30
|
-
>
|
|
32
|
+
> "Set up a PR review automation for my `myorg/backend` repo using the
|
|
33
|
+
> `openhands-review` label and concise reviews."
|
|
34
|
+
|
|
35
|
+
After setup, apply the configured label to a pull request to queue a review. To
|
|
36
|
+
request another review later, remove and re-apply the label.
|
|
31
37
|
|
|
32
38
|
## See Also
|
|
33
39
|
|
|
34
|
-
- [SKILL.md](SKILL.md)
|
|
40
|
+
- [SKILL.md](SKILL.md) - Full setup workflow reference
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: github-pr-reviewer
|
|
3
3
|
description: >
|
|
4
|
-
Create an automation that reviews GitHub pull requests when
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
Create an automation that reviews GitHub pull requests when a configurable
|
|
5
|
+
trigger label is applied. Polls GitHub deterministically, starts one
|
|
6
|
+
OpenHands review conversation per label event, inspects full repository and
|
|
7
|
+
PR context, and posts the final review comment back to GitHub.
|
|
8
8
|
triggers:
|
|
9
9
|
- /pr-reviewer:setup
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# GitHub PR Reviewer Automation
|
|
13
13
|
|
|
14
|
-
Create a cron automation that
|
|
15
|
-
|
|
14
|
+
Create a cron automation that watches a GitHub repository for pull requests
|
|
15
|
+
with a review trigger label, starts an OpenHands review conversation once per
|
|
16
|
+
label event, and posts the AI review as a GitHub comment.
|
|
16
17
|
|
|
17
|
-
The automation script is
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
The automation script is deterministic: PR discovery, label-event tracking,
|
|
19
|
+
state persistence, stale-result suppression, and GitHub comment posting are
|
|
20
|
+
handled in Python. The LLM is invoked only for the review itself.
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -24,12 +25,12 @@ the review text for PRs not yet seen, never for orchestration.
|
|
|
24
25
|
|
|
25
26
|
### Required secret
|
|
26
27
|
|
|
27
|
-
Verify that the following secret is set in **OpenHands Settings
|
|
28
|
+
Verify that the following secret is set in **OpenHands Settings -> Secrets**:
|
|
28
29
|
|
|
29
30
|
| Secret name | Token type | Minimum permissions |
|
|
30
31
|
|---|---|---|
|
|
31
|
-
| `GITHUB_PERSONAL_ACCESS_TOKEN` | Classic PAT | `repo`
|
|
32
|
-
| `GITHUB_PERSONAL_ACCESS_TOKEN` | Fine-grained PAT | Pull requests: Read and Write |
|
|
32
|
+
| `GITHUB_PERSONAL_ACCESS_TOKEN` | Classic PAT | `repo` for private repos or `public_repo` for public repos |
|
|
33
|
+
| `GITHUB_PERSONAL_ACCESS_TOKEN` | Fine-grained PAT | Contents: Read, Metadata: Read, Pull requests: Read, Issues: Read and Write |
|
|
33
34
|
|
|
34
35
|
Check with:
|
|
35
36
|
```bash
|
|
@@ -46,16 +47,16 @@ If the token is missing or invalid, inform the user and stop.
|
|
|
46
47
|
|
|
47
48
|
Follow these steps in order.
|
|
48
49
|
|
|
49
|
-
### Step 1
|
|
50
|
+
### Step 1 - Verify `GITHUB_PERSONAL_ACCESS_TOKEN`
|
|
50
51
|
|
|
51
52
|
Run the `curl` check above.
|
|
52
53
|
|
|
53
54
|
- If absent: *"GITHUB_PERSONAL_ACCESS_TOKEN is not set. Please add it in
|
|
54
|
-
OpenHands Settings
|
|
55
|
+
OpenHands Settings -> Secrets."* Stop.
|
|
55
56
|
- If the API returns `{"message": "Bad credentials"}`: tell the user the
|
|
56
57
|
token is invalid and ask them to update it. Stop.
|
|
57
58
|
|
|
58
|
-
### Step 2
|
|
59
|
+
### Step 2 - Collect repository
|
|
59
60
|
|
|
60
61
|
Ask: *"Which GitHub repository should be monitored?
|
|
61
62
|
(Format: `owner/repo`, e.g. `myorg/backend`)"*
|
|
@@ -76,26 +77,38 @@ else:
|
|
|
76
77
|
|
|
77
78
|
Record `REPO = "{owner}/{repo}"`.
|
|
78
79
|
|
|
79
|
-
### Step 3
|
|
80
|
+
### Step 3 - Collect trigger label
|
|
81
|
+
|
|
82
|
+
Ask: *"Which PR label should trigger a review?
|
|
83
|
+
(Press Enter for the default: `openhands-review`.)"*
|
|
84
|
+
|
|
85
|
+
Record the answer as `TRIGGER_LABEL`. If the label does not exist yet, tell the
|
|
86
|
+
user that GitHub will still record the event once the label is created and
|
|
87
|
+
applied to a PR.
|
|
88
|
+
|
|
89
|
+
The automation reviews a PR when it sees the latest matching `labeled` event for
|
|
90
|
+
that label. To request another review later, remove and re-apply the label.
|
|
91
|
+
|
|
92
|
+
### Step 4 - Collect review tone
|
|
80
93
|
|
|
81
94
|
Ask: *"What review tone should the reviewer use?
|
|
82
|
-
1. Thorough (default)
|
|
83
|
-
2. Concise
|
|
84
|
-
3. Friendly
|
|
95
|
+
1. Thorough (default) - comprehensive coverage of correctness, security, tests, style
|
|
96
|
+
2. Concise - high-signal only, skips minor style feedback
|
|
97
|
+
3. Friendly - constructive and encouraging
|
|
85
98
|
(Press Enter for Thorough, or type your choice or any custom style description)"*
|
|
86
99
|
|
|
87
100
|
Map the choice to `REVIEW_TONE`:
|
|
88
101
|
|
|
89
102
|
| Answer | `REVIEW_TONE` | `REVIEW_STYLE_INSTRUCTIONS` |
|
|
90
|
-
|
|
103
|
+
|---|---|---|
|
|
91
104
|
| 1 / Enter | `"thorough"` | `""` |
|
|
92
105
|
| 2 | `"concise"` | `""` |
|
|
93
106
|
| 3 | `"friendly"` | `""` |
|
|
94
|
-
| Custom text
|
|
107
|
+
| Custom text, e.g. `strict but kind` | `"thorough"` | the custom text verbatim |
|
|
95
108
|
|
|
96
|
-
### Step
|
|
109
|
+
### Step 5 - Collect cron schedule
|
|
97
110
|
|
|
98
|
-
Ask: *"How often should the automation poll for
|
|
111
|
+
Ask: *"How often should the automation poll for labeled PRs?
|
|
99
112
|
(Press Enter for the default: every 5 minutes.
|
|
100
113
|
Use a cron expression for a different interval, e.g. `0 * * * *` = hourly)"*
|
|
101
114
|
|
|
@@ -103,22 +116,26 @@ Default: `*/5 * * * *`.
|
|
|
103
116
|
|
|
104
117
|
Record as `CRON_SCHEDULE`.
|
|
105
118
|
|
|
106
|
-
### Step
|
|
119
|
+
### Step 6 - Generate the automation script
|
|
107
120
|
|
|
108
|
-
Read `scripts/main.py` from this skill's directory. Apply exactly
|
|
109
|
-
|
|
121
|
+
Read `scripts/main.py` from this skill's directory. Apply exactly five constant
|
|
122
|
+
substitutions near the top of the file:
|
|
110
123
|
|
|
111
124
|
| Placeholder | Replace with |
|
|
112
125
|
|---|---|
|
|
113
126
|
| `REPO = "owner/repo"` | `REPO = "{owner_repo}"` |
|
|
127
|
+
| `TRIGGER_LABEL = "openhands-review"` | `TRIGGER_LABEL = "{trigger_label}"` |
|
|
114
128
|
| `REVIEW_TONE = "thorough"` | `REVIEW_TONE = "{review_tone}"` |
|
|
115
129
|
| `REVIEW_STYLE_INSTRUCTIONS = ""` | `REVIEW_STYLE_INSTRUCTIONS = "{style_instructions}"` |
|
|
116
130
|
| `DEFAULT_OPENHANDS_URL = "http://localhost:8000"` | leave unchanged unless the user has a preference |
|
|
117
131
|
|
|
118
|
-
|
|
132
|
+
Use a safe string writer such as `json.dumps(value)` when inserting user-provided
|
|
133
|
+
repository names, labels, or style instructions into Python string literals.
|
|
134
|
+
|
|
135
|
+
Write the customized script to a temporary build directory:
|
|
119
136
|
```bash
|
|
120
137
|
mkdir -p /tmp/pr-reviewer-build
|
|
121
|
-
# write the
|
|
138
|
+
# write the customized main.py to /tmp/pr-reviewer-build/main.py
|
|
122
139
|
```
|
|
123
140
|
|
|
124
141
|
Validate syntax before packaging:
|
|
@@ -128,7 +145,7 @@ python3 -m py_compile /tmp/pr-reviewer-build/main.py && echo "Syntax OK"
|
|
|
128
145
|
|
|
129
146
|
Fix any syntax errors before proceeding.
|
|
130
147
|
|
|
131
|
-
### Step
|
|
148
|
+
### Step 7 - Package and upload
|
|
132
149
|
|
|
133
150
|
Determine the Automation backend URL and auth from the `<RUNTIME_SERVICES>`
|
|
134
151
|
block in your system context:
|
|
@@ -148,14 +165,14 @@ TARBALL_PATH=$(curl -s -X POST \
|
|
|
148
165
|
echo "Uploaded: $TARBALL_PATH"
|
|
149
166
|
```
|
|
150
167
|
|
|
151
|
-
### Step
|
|
168
|
+
### Step 8 - Register the automation
|
|
152
169
|
|
|
153
170
|
```bash
|
|
154
171
|
curl -s -X POST "${OPENHANDS_HOST}/api/automation/v1" \
|
|
155
172
|
-H "X-Session-API-Key: $OPENHANDS_AUTOMATION_API_KEY" \
|
|
156
173
|
-H "Content-Type: application/json" \
|
|
157
174
|
-d "{
|
|
158
|
-
\"name\": \"GitHub PR Reviewer: {owner}/{repo}\",
|
|
175
|
+
\"name\": \"GitHub PR Reviewer: {owner}/{repo} label {trigger_label}\",
|
|
159
176
|
\"trigger\": {\"type\": \"cron\", \"schedule\": \"{cron_schedule}\"},
|
|
160
177
|
\"tarball_path\": \"$TARBALL_PATH\",
|
|
161
178
|
\"entrypoint\": \"python3 main.py\",
|
|
@@ -165,7 +182,7 @@ curl -s -X POST "${OPENHANDS_HOST}/api/automation/v1" \
|
|
|
165
182
|
|
|
166
183
|
Record the returned `id`.
|
|
167
184
|
|
|
168
|
-
### Step
|
|
185
|
+
### Step 9 - Confirm
|
|
169
186
|
|
|
170
187
|
Tell the user:
|
|
171
188
|
|
|
@@ -173,13 +190,14 @@ Tell the user:
|
|
|
173
190
|
>
|
|
174
191
|
> - Automation ID: `{id}`
|
|
175
192
|
> - Repository: `{owner}/{repo}`
|
|
193
|
+
> - Trigger label: `{trigger_label}`
|
|
176
194
|
> - Review tone: `{tone}`
|
|
177
195
|
> - Polling schedule: `{cron_schedule}`
|
|
178
|
-
> - State file: `~/.openhands/workspaces/automation-state/
|
|
196
|
+
> - State file: `~/.openhands/workspaces/automation-state/github_pr_reviewer_label_event_{id}.json`
|
|
179
197
|
>
|
|
180
|
-
>
|
|
181
|
-
>
|
|
182
|
-
>
|
|
198
|
+
> Apply the `{trigger_label}` label to a pull request to queue a review. Each
|
|
199
|
+
> label event is processed once. To request another review, remove and re-apply
|
|
200
|
+
> the label.
|
|
183
201
|
|
|
184
202
|
---
|
|
185
203
|
|
|
@@ -187,36 +205,37 @@ Tell the user:
|
|
|
187
205
|
|
|
188
206
|
Each cron run executes `main.py`, which:
|
|
189
207
|
|
|
190
|
-
1.
|
|
191
|
-
2.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
-
|
|
196
|
-
- Skips
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
- Records the
|
|
204
|
-
5.
|
|
205
|
-
-
|
|
206
|
-
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
1. Loads state from the JSON file (see `references/state-schema.md`).
|
|
209
|
+
2. Resolves and validates `GITHUB_PERSONAL_ACCESS_TOKEN` and repository access.
|
|
210
|
+
3. Lists open PRs, newest-updated first.
|
|
211
|
+
4. For each open PR carrying `TRIGGER_LABEL`:
|
|
212
|
+
- Refetches current PR metadata to avoid acting on stale list data.
|
|
213
|
+
- Finds the latest matching GitHub `labeled` issue event.
|
|
214
|
+
- Skips the event if it has already been tracked.
|
|
215
|
+
- Starts an OpenHands conversation with a review prompt that includes PR
|
|
216
|
+
metadata, the exact head SHA, label event details, and instructions to
|
|
217
|
+
clone the repo, inspect PR discussion, review comments, changed files,
|
|
218
|
+
diff, and surrounding code.
|
|
219
|
+
- Posts an acknowledgement comment with the label event, head SHA, and
|
|
220
|
+
conversation link.
|
|
221
|
+
- Records the label-event review in state with `status: "active"`.
|
|
222
|
+
5. For each active review conversation:
|
|
223
|
+
- Marks it closed without posting if the PR has closed or merged.
|
|
224
|
+
- Suppresses stale results if the PR head SHA changed after the review was
|
|
225
|
+
queued.
|
|
226
|
+
- When the conversation reaches `idle`, `finished`, `error`, or `stuck`,
|
|
227
|
+
posts the agent's final response as a GitHub comment and marks the review
|
|
228
|
+
closed.
|
|
229
|
+
6. Saves state atomically and fires the completion callback.
|
|
211
230
|
|
|
212
231
|
---
|
|
213
232
|
|
|
214
233
|
## Additional Resources
|
|
215
234
|
|
|
216
|
-
- **`references/state-schema.md`**
|
|
217
|
-
|
|
218
|
-
- **`scripts/main.py`**
|
|
219
|
-
|
|
235
|
+
- **`references/state-schema.md`** - State JSON schema, field definitions, and
|
|
236
|
+
review lifecycle diagram.
|
|
237
|
+
- **`scripts/main.py`** - The complete automation script. Customize the five
|
|
238
|
+
constants at the top before packaging.
|
|
220
239
|
|
|
221
240
|
---
|
|
222
241
|
|
|
@@ -224,9 +243,9 @@ Each cron run executes `main.py`, which:
|
|
|
224
243
|
|
|
225
244
|
| Symptom | Likely cause | Fix |
|
|
226
245
|
|---|---|---|
|
|
227
|
-
| Bot never
|
|
228
|
-
| "Bad credentials" in run logs | Token expired | Rotate and update
|
|
246
|
+
| Bot never queues reviews | Trigger label not present or no matching `labeled` event | Apply the configured label to the PR |
|
|
247
|
+
| "Bad credentials" in run logs | Token expired | Rotate and update `GITHUB_PERSONAL_ACCESS_TOKEN` |
|
|
229
248
|
| 404 on repo access | Repo name wrong or no access | Re-check `owner/repo` and token permissions |
|
|
230
|
-
| Same PR reviewed
|
|
231
|
-
| Review never
|
|
232
|
-
|
|
|
249
|
+
| Same PR not reviewed after new commits | Label event was already processed | Remove and re-apply the trigger label |
|
|
250
|
+
| Review result never posts | Conversation still running or stuck | Open the conversation link from the acknowledgement comment |
|
|
251
|
+
| Stale review suppressed | PR head SHA changed while the agent was reviewing | Re-apply the trigger label after the latest commit |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
# auto-generated by sync_extensions.py
|
|
3
|
-
description: Create an automation that reviews GitHub pull requests when
|
|
3
|
+
description: Create an automation that reviews GitHub pull requests when a configurable trigger label is applied. Polls GitHub deterministically, starts one OpenHands review conversation per label event, inspects full repository and PR context, and posts the final review comment back to GitHub.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Read and follow the complete instructions in the SKILL.md file located in this skill's directory.
|