@olegkoval/agent-skills 1.51.0 → 1.51.2
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/.github/prompts/coderabbitloop.prompt.md +72 -23
- package/.github/prompts/codexloop.prompt.md +87 -85
- package/.github/prompts/copilotloop.prompt.md +84 -88
- package/.github/prompts/geminiloop.prompt.md +85 -85
- package/.github/prompts/qodoloop.prompt.md +78 -20
- package/.kiro/steering/coderabbitloop.md +72 -23
- package/.kiro/steering/codexloop.md +87 -85
- package/.kiro/steering/copilotloop.md +84 -88
- package/.kiro/steering/geminiloop.md +85 -85
- package/.kiro/steering/qodoloop.md +78 -20
- package/.windsurf/rules/coderabbitloop.md +72 -23
- package/.windsurf/rules/codexloop.md +87 -85
- package/.windsurf/rules/copilotloop.md +84 -88
- package/.windsurf/rules/geminiloop.md +85 -85
- package/.windsurf/rules/qodoloop.md +78 -20
- package/adapters/claude/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
- package/adapters/claude/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
- package/adapters/claude/olko-github-pr/skills/codexloop/SKILL.md +90 -88
- package/adapters/claude/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
- package/adapters/claude/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
- package/adapters/claude/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
- package/adapters/claude/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
- package/adapters/claude/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/github-post.md +4 -3
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/output-format.md +5 -1
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/pricing.json +5 -1
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-deep-codex.md +2 -2
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-medium-codex.md +2 -2
- package/adapters/claude/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
- package/adapters/claude/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
- package/adapters/cursor/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
- package/adapters/cursor/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
- package/adapters/cursor/olko-github-pr/skills/codexloop/SKILL.md +90 -88
- package/adapters/cursor/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
- package/adapters/cursor/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
- package/adapters/cursor/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
- package/adapters/cursor/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
- package/adapters/cursor/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
- package/adapters/cursor/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
- package/adapters/cursor/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
- package/adapters/grok/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
- package/adapters/grok/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
- package/adapters/grok/olko-github-pr/skills/codexloop/SKILL.md +90 -88
- package/adapters/grok/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
- package/adapters/grok/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
- package/adapters/grok/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
- package/adapters/grok/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
- package/adapters/grok/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
- package/adapters/grok/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
- package/adapters/grok/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
- package/package.json +1 -1
- package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
- package/plugins/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
- package/plugins/olko-github-pr/skills/codexloop/SKILL.md +90 -88
- package/plugins/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
- package/plugins/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
- package/plugins/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
- package/plugins/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
- package/plugins/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
- package/plugins/olko-github-pr/skills/lekker-review/references/github-post.md +4 -3
- package/plugins/olko-github-pr/skills/lekker-review/references/output-format.md +5 -1
- package/plugins/olko-github-pr/skills/lekker-review/references/pricing.json +5 -1
- package/plugins/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-deep-codex.md +2 -2
- package/plugins/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-medium-codex.md +2 -2
- package/plugins/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
- package/plugins/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
- package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
review", "fix Copilot comments", "Copilot loop", or wants to iterate on Copilot PR feedback.
|
|
9
9
|
compatibility: GitHub only (Copilot code review is a GitHub feature). Requires git + jq + gh (GitHub CLI) authenticated, Copilot code review enabled, and permission to request reviewers on the repository.
|
|
10
10
|
metadata:
|
|
11
|
-
version: "1.
|
|
11
|
+
version: "1.2"
|
|
12
12
|
allowed-tools: Bash(gh:*) Bash(git:*)
|
|
13
13
|
---
|
|
14
14
|
<!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
|
|
@@ -23,7 +23,7 @@ suggestion applied is worse than the comment itself.
|
|
|
23
23
|
|
|
24
24
|
- **No check-run, no score.** Copilot posts an overview comment and a PR review with inline review
|
|
25
25
|
comments. Detection is by polling the reviews endpoint and paginated review threads. "Satisfied"
|
|
26
|
-
means
|
|
26
|
+
means Copilot has reviewed the latest push, no bot thread is unresolved, and no body finding is unaddressed after each finding is
|
|
27
27
|
fixed or rebutted with a recorded reply.
|
|
28
28
|
- **Request through the reviewers API.** Copilot does not use a reliable slash-command trigger.
|
|
29
29
|
Request `copilot-pull-request-reviewer[bot]` through the pull request reviewers endpoint. A
|
|
@@ -55,9 +55,30 @@ review; if GitHub uses a different login for the installation, use the exact Cop
|
|
|
55
55
|
returned by the probe rather than guessing.
|
|
56
56
|
|
|
57
57
|
**Finding nothing here is NOT a stop condition.** On a PR Copilot has never reviewed there is no bot
|
|
58
|
-
login to find yet. Fall through to step
|
|
58
|
+
login to find yet. Fall through to step A, request the reviewer, and re-run this probe once a
|
|
59
59
|
review lands. Only conclude Copilot is unavailable after the bounded wait expires with no review.
|
|
60
60
|
|
|
61
|
+
## Review state comes from the PR, not from memory
|
|
62
|
+
|
|
63
|
+
`scripts/pr-review-state.sh` reads the PR and prints one JSON object: the current head, whether
|
|
64
|
+
Copilot has acted on that head (a review of it, or any comment after it was pushed), and every
|
|
65
|
+
unresolved review thread with its author. Every "is there work / are we done" decision in this
|
|
66
|
+
loop comes from its exit code, never from what you remember resolving. The script lives in this
|
|
67
|
+
skill's directory, `SKILL_ROOT`: the directory holding this `SKILL.md` (Claude Code prints it as the
|
|
68
|
+
skill's base directory when the skill loads; in Codex, derive it from the selected `SKILL.md` path).
|
|
69
|
+
|
|
70
|
+
| Exit | `verdict` | Meaning | Do |
|
|
71
|
+
|------|------------|---------------------------------------------------------------------|--------------------------------------|
|
|
72
|
+
| 0 | `clean` | Copilot acted on the current head and no bot thread is unresolved | exit check: done |
|
|
73
|
+
| 10 | `findings` | unresolved threads from Copilot **or any other review bot** | run an iteration |
|
|
74
|
+
| 20 | `pending` | Copilot has not acted on the current head yet | trigger if needed, then wait |
|
|
75
|
+
| 30 | `limited` | a rate-limit or paused notice from Copilot after the current head | stop, report `blocked: rate-limited` |
|
|
76
|
+
|
|
77
|
+
Resolving the last thread does not make a PR clean: Copilot has not reviewed your push yet. Earlier
|
|
78
|
+
versions of this loop exited at exactly that moment, while the next round of comments was still on
|
|
79
|
+
its way. Human threads are listed in `.unresolved` (`is_bot: false`) and counted in `.counts.humans`;
|
|
80
|
+
they never block `clean`, and this loop never resolves them.
|
|
81
|
+
|
|
61
82
|
## 1. Identify the PR
|
|
62
83
|
|
|
63
84
|
```bash
|
|
@@ -72,71 +93,54 @@ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enf
|
|
|
72
93
|
figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
|
|
73
94
|
report and list what is still unresolved rather than starting a sixth.
|
|
74
95
|
|
|
75
|
-
### A.
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
|
|
79
|
-
# Only trigger if no Copilot review exists for this exact SHA:
|
|
80
|
-
HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
|
|
81
|
-
jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
|
|
82
|
-
'[.[][] | select(.user.login==$bot and .commit_id==$head)] | length')
|
|
83
|
-
if [ "$HAVE" = "0" ]; then
|
|
84
|
-
gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
|
|
85
|
-
-f 'reviewers[]=copilot-pull-request-reviewer[bot]'
|
|
86
|
-
fi
|
|
87
|
-
```
|
|
96
|
+
### A. Read the PR state; wait for Copilot's review of the current head
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
One read answers both "is there work?" and "has Copilot seen my last push?". `SINCE` is the
|
|
99
|
+
timestamp you took right before your last push (step E); leave it empty on iteration 1. Right
|
|
100
|
+
after a push, add `--wait 600` straight away: the wait ends only once the bot has acted on the new
|
|
101
|
+
head, so threads left open on purpose cannot make the push look reviewed.
|
|
92
102
|
|
|
93
103
|
```bash
|
|
94
|
-
|
|
95
|
-
# enforcement of the bounds this skill claims: do not drop them.
|
|
96
|
-
wait_for_review() { # $1 = attempt label
|
|
97
|
-
local deadline=$(( SECONDS + 600 ))
|
|
98
|
-
while [ "$SECONDS" -lt "$deadline" ]; do
|
|
99
|
-
R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
|
|
100
|
-
jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
|
|
101
|
-
'[.[][] | select(.user.login==$bot and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
|
|
102
|
-
if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
|
|
103
|
-
echo "waiting for Copilot review of $HEAD_SHA ($1)..."; sleep 15
|
|
104
|
-
done
|
|
105
|
-
return 1
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if ! wait_for_review "first wait"; then
|
|
109
|
-
echo "no Copilot review after 10m, retrying once" # say the retry out loud
|
|
110
|
-
gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
|
|
111
|
-
-f 'reviewers[]=copilot-pull-request-reviewer[bot]'
|
|
112
|
-
if ! wait_for_review "after retry"; then
|
|
113
|
-
echo "Copilot did not review $HEAD_SHA after a retry; stopping and reporting."
|
|
114
|
-
exit 1 # honest timeout, never a success claim
|
|
115
|
-
fi
|
|
116
|
-
fi
|
|
104
|
+
"$SKILL_ROOT/scripts/pr-review-state.sh" --repo OWNER/REPO --pr <PR> --bot copilot-pull-request-reviewer --since "$SINCE"
|
|
117
105
|
```
|
|
118
106
|
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
- Exit `10` (`findings`): go to B. On iteration 1 this is whatever Copilot (or another bot)
|
|
108
|
+
already posted.
|
|
109
|
+
- Exit `20` (`pending`): request it through the reviewers endpoint (`gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers -f 'reviewers[]=copilot-pull-request-reviewer[bot]'`). Then wait with the same command plus `--wait 600`. Run the
|
|
110
|
+
wait in the background where the host allows it (Claude Code: Bash `run_in_background`; you are
|
|
111
|
+
re-invoked when it exits) so ten minutes of polling never sits in the conversation. Still `20`
|
|
112
|
+
after the wait: say so out loud, request the reviewer once more, and wait once more. Still `20` after that: stop and
|
|
113
|
+
report the timeout honestly; never claim success.
|
|
114
|
+
- Exit `0` (`clean`): go to the exit check. A `--wait` call returns `clean` only after a settle
|
|
115
|
+
re-read 60 seconds later, so a comment landing right behind the review is still caught. A bare
|
|
116
|
+
read (no `--wait`) that says `clean` is good enough only when you have not pushed since Copilot's
|
|
117
|
+
last review.
|
|
118
|
+
- Exit `30` (`limited`): stop now and report `blocked: rate-limited`; nothing more is coming.
|
|
119
|
+
- Exit `1`: the read itself failed (often a transient GitHub 502). Retry once; if it fails again,
|
|
120
|
+
stop and report it. An unknown state is not a clean one.
|
|
121
121
|
|
|
122
122
|
### B. Fetch the findings
|
|
123
123
|
|
|
124
|
+
The working set is every unresolved thread in the state JSON with `is_bot: true`: Copilot's
|
|
125
|
+
own (`is_target: true`) **and any other review bot's** (Greptile, for example). A
|
|
126
|
+
fix for one bot often draws a comment from another, and leaving those open is how a "finished" loop
|
|
127
|
+
leaves a PR that is not clean. Treat another bot's thread with exactly the same verify-first rules
|
|
128
|
+
below. Never act on a human's thread (`is_bot: false`); list it in the report.
|
|
129
|
+
|
|
124
130
|
- **Summary**: read the Copilot overview comment and review `.body`, including all matching reviews
|
|
125
131
|
for the current head. Extract and classify actionable claims even when they have no inline thread;
|
|
126
132
|
an approval assessment or lack of inline comments does not make those findings complete.
|
|
127
133
|
Track each body finding across iterations by source review/comment ID and item, with its
|
|
128
134
|
classification, fix commit or evidence-based rebuttal, PR-level reply URL, and completion status.
|
|
129
135
|
Link duplicates to the same finding so they are counted once; retain pending findings after a push.
|
|
130
|
-
- **Unresolved inline comments
|
|
136
|
+
- **Unresolved inline comments**: `.unresolved[] | select(.is_bot)` in step A's state JSON lists
|
|
137
|
+
each thread's `thread_id`, `comment_id`, `path`, `line` and a short excerpt, across every page of
|
|
138
|
+
threads. Read the full comment before judging it:
|
|
131
139
|
|
|
132
140
|
```bash
|
|
133
|
-
gh api repos/{owner}/{repo}/pulls/<
|
|
134
|
-
--jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
|
|
141
|
+
gh api repos/{owner}/{repo}/pulls/comments/<COMMENT_ID> --jq '{user: .user.login, path, line, body}'
|
|
135
142
|
```
|
|
136
143
|
|
|
137
|
-
Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
|
|
138
|
-
unresolved ones.
|
|
139
|
-
|
|
140
144
|
Mark each unresolved inline comment as seen, so the bot and a watching human can tell it is being
|
|
141
145
|
handled. GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
|
|
142
146
|
|
|
@@ -198,6 +202,7 @@ If step D changed code:
|
|
|
198
202
|
git status --short # look before you stage
|
|
199
203
|
git add <path> [<path>...] # the files named in the findings you fixed
|
|
200
204
|
git commit -m "address Copilot review feedback (copilotloop iteration N)"
|
|
205
|
+
SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ) # step A reads bot activity after this
|
|
201
206
|
git push
|
|
202
207
|
```
|
|
203
208
|
|
|
@@ -213,31 +218,8 @@ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
|
|
|
213
218
|
|
|
214
219
|
### F. Reply to every addressed finding and resolve its inline threads
|
|
215
220
|
|
|
216
|
-
Only now, with the fixes pushed, reply and resolve.
|
|
217
|
-
|
|
218
|
-
sit on page two:
|
|
219
|
-
|
|
220
|
-
```bash
|
|
221
|
-
# Loop until hasNextPage is false, passing endCursor back in as $cursor.
|
|
222
|
-
CURSOR=null
|
|
223
|
-
while : ; do
|
|
224
|
-
PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
|
|
225
|
-
query($cursor: String) {
|
|
226
|
-
repository(owner: "OWNER", name: "REPO") {
|
|
227
|
-
pullRequest(number: PR_NUMBER) {
|
|
228
|
-
reviewThreads(first: 100, after: $cursor) {
|
|
229
|
-
pageInfo { hasNextPage endCursor }
|
|
230
|
-
nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}')
|
|
235
|
-
echo "$PAGE" # collect nodes from every page before deciding the PR is clean
|
|
236
|
-
PI='.data.repository.pullRequest.reviewThreads.pageInfo'
|
|
237
|
-
[ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
|
|
238
|
-
CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
|
|
239
|
-
done
|
|
240
|
-
```
|
|
221
|
+
Only now, with the fixes pushed, reply and resolve. Take thread and comment ids from step A's state
|
|
222
|
+
JSON (`.unresolved[]`): the script already follows pagination, so do not hand-roll a threads query.
|
|
241
223
|
|
|
242
224
|
Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
|
|
243
225
|
then resolve:
|
|
@@ -261,7 +243,8 @@ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions
|
|
|
261
243
|
Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
|
|
262
244
|
resolved thread with no reply loses the reasoning.
|
|
263
245
|
|
|
264
|
-
Resolve a thread only for
|
|
246
|
+
Resolve a thread only for a bot comment in your working set (this bot's or another
|
|
247
|
+
review bot's) that you have fixed or rebutted: never
|
|
265
248
|
blanket-resolve, and never resolve a human reviewer's thread.
|
|
266
249
|
|
|
267
250
|
Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
|
|
@@ -275,23 +258,34 @@ it complete. One reply may cover multiple explicitly identified findings. Fixed
|
|
|
275
258
|
require the same successful push check as fixed threads; rebuttals need no push. If a finding also
|
|
276
259
|
has an inline thread, that thread still requires a reply and resolution.
|
|
277
260
|
|
|
278
|
-
### G.
|
|
261
|
+
### G. Back to A
|
|
279
262
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
ensure all Copilot threads are resolved and all tracked body findings have recorded PR-level
|
|
284
|
-
replies and are complete, then exit.
|
|
263
|
+
Go back to **A**. After a push, A waits for Copilot's review of the new head (pushing re-triggers
|
|
264
|
+
it when auto-review is on; otherwise A triggers it). If this iteration changed no code (every finding
|
|
265
|
+
rebutted), there is no new head to wait for: A's fresh read says `clean` or shows what is still open.
|
|
285
266
|
|
|
286
267
|
## 3. Exit conditions
|
|
287
268
|
|
|
269
|
+
Decide from a fresh state read, never from what you remember resolving.
|
|
270
|
+
|
|
288
271
|
Stop when **any** is true:
|
|
289
|
-
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
-
|
|
294
|
-
|
|
272
|
+
- **Done**: the latest `pr-review-state.sh --wait 600` call, made after your last push, exited `0`
|
|
273
|
+
(`clean`); with no push since the bot's last review, a bare read that exits `0` is enough, and the body-finding register from step B has no pending entries. Open human threads do not block this; list them in the report.
|
|
274
|
+
- **Max iterations (5)** reached: report what remains.
|
|
275
|
+
- **Timeout**: still `pending` after the retry in step A. Report it honestly; do not claim success.
|
|
276
|
+
- **Rate limited**: exit `30`. Report `blocked: rate-limited`.
|
|
277
|
+
|
|
278
|
+
## Keep the context small; resume instead of restarting
|
|
279
|
+
|
|
280
|
+
- Carry only three things between iterations: the iteration counter, the latest state JSON, and a
|
|
281
|
+
ledger of each thread you handled (fixed with its commit, rebutted, or blocked). Re-read files
|
|
282
|
+
fresh each iteration; do not re-paste earlier rounds' comment bodies.
|
|
283
|
+
- All loop state lives on the PR, so the loop is resumable. If the session has grown long or slow,
|
|
284
|
+
or a bot commented after the loop ended, run this skill again in a fresh session: step A picks up
|
|
285
|
+
from the PR as it is now. Starting fresh is cheaper than dragging a long session through more
|
|
286
|
+
rounds.
|
|
287
|
+
- After reporting done, if the host can schedule a follow-up (Claude Code: `/loop` or a scheduled
|
|
288
|
+
wakeup), offer one re-check about 20 minutes later for bots that comment late.
|
|
295
289
|
|
|
296
290
|
## 4. Report
|
|
297
291
|
|
|
@@ -302,7 +296,9 @@ Copilotloop complete.
|
|
|
302
296
|
Iterations: N
|
|
303
297
|
Findings fixed: N (inline + body findings, deduplicated)
|
|
304
298
|
Findings rebutted: N (inline + body findings, with recorded evidence-based replies)
|
|
305
|
-
Remaining:
|
|
299
|
+
Remaining: N (unresolved inline + pending body findings, deduplicated)
|
|
300
|
+
Human threads: N (open, listed below; this loop never resolves them)
|
|
301
|
+
Final state: clean | timeout | rate-limited | iteration cap
|
|
306
302
|
```
|
|
307
303
|
|
|
308
304
|
If it stopped at max iterations, list the remaining threads and body findings with your current
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# pr-review-state.sh: read a PR's review-bot state once (or until it settles) and print it as JSON.
|
|
3
|
+
#
|
|
4
|
+
# Shared by every review loop in olko-github-pr (codexloop, geminiloop, copilotloop,
|
|
5
|
+
# coderabbitloop, qodoloop). Each skill ships its own copy so it works on every adapter;
|
|
6
|
+
# tests/test-pr-review-state.sh fails if the copies drift apart.
|
|
7
|
+
#
|
|
8
|
+
# The loops decide "done" from this output, never from their own memory of what they resolved:
|
|
9
|
+
# clean every --bot has acted on the current head AND no bot thread is unresolved
|
|
10
|
+
# findings at least one unresolved thread from any bot (target or not): work to do
|
|
11
|
+
# pending some --bot has not acted on the current head yet
|
|
12
|
+
#
|
|
13
|
+
# "Acted on the head" = a review of the head commit, or after the head was pushed: a
|
|
14
|
+
# comment that is not a progress notice, or a PR reaction other than 👀 (Codex signals a clean
|
|
15
|
+
# review with only a 👍 on the PR, and edits a "**Running**" summary comment while it works).
|
|
16
|
+
# limited a --bot posted a rate-limit / paused notice after the current head
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
usage() {
|
|
20
|
+
cat >&2 <<'EOF'
|
|
21
|
+
usage: pr-review-state.sh --repo OWNER/REPO --pr N --bot REGEX [--bot REGEX ...]
|
|
22
|
+
[--since ISO8601] [--wait SECONDS] [--settle SECONDS] [--interval SECONDS]
|
|
23
|
+
|
|
24
|
+
--bot case-insensitive regex matched against the bare bot login (GraphQL drops "[bot]"),
|
|
25
|
+
e.g. codex, gemini-code-assist, copilot, coderabbitai, qodo-code-review. Repeatable:
|
|
26
|
+
every --bot must have acted on the current head before the verdict can be "clean".
|
|
27
|
+
--since when the current head was pushed (date -u +%Y-%m-%dT%H:%M:%SZ, taken before the push).
|
|
28
|
+
Bot activity counts for the head only if it happened after max(head commit date, since).
|
|
29
|
+
--wait poll until every --bot has acted on the current head (or posted a limit notice), or
|
|
30
|
+
SECONDS pass (default 0: read once). Open threads do not end the wait early, so threads
|
|
31
|
+
left open on purpose cannot make a fresh push look reviewed.
|
|
32
|
+
--settle once "clean", wait SECONDS and read again, so a late comment is not missed
|
|
33
|
+
(default 60 when --wait is set, else 0).
|
|
34
|
+
--interval seconds between polls (default 20).
|
|
35
|
+
|
|
36
|
+
exit: 0 clean, 10 findings, 20 pending, 30 limited, 2 usage, 1 error
|
|
37
|
+
EOF
|
|
38
|
+
exit 2
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
REPO="" PR="" SINCE="" WAIT=0 SETTLE="" INTERVAL=20
|
|
42
|
+
BOTS=()
|
|
43
|
+
while [ $# -gt 0 ]; do
|
|
44
|
+
case "$1" in
|
|
45
|
+
--repo) REPO="${2:-}"; shift 2 ;;
|
|
46
|
+
--pr) PR="${2:-}"; shift 2 ;;
|
|
47
|
+
--bot) BOTS+=("${2:-}"); shift 2 ;;
|
|
48
|
+
--since) SINCE="${2:-}"; shift 2 ;;
|
|
49
|
+
--wait) WAIT="${2:-}"; shift 2 ;;
|
|
50
|
+
--settle) SETTLE="${2:-}"; shift 2 ;;
|
|
51
|
+
--interval) INTERVAL="${2:-}"; shift 2 ;;
|
|
52
|
+
-h|--help) usage ;;
|
|
53
|
+
*) echo "unknown argument: $1" >&2; usage ;;
|
|
54
|
+
esac
|
|
55
|
+
done
|
|
56
|
+
[ -n "$REPO" ] && [ -n "$PR" ] && [ "${#BOTS[@]}" -gt 0 ] || usage
|
|
57
|
+
case "$REPO" in */*) ;; *) usage ;; esac
|
|
58
|
+
[ -n "$SETTLE" ] || { [ "$WAIT" -gt 0 ] && SETTLE=60 || SETTLE=0; }
|
|
59
|
+
OWNER="${REPO%%/*}" NAME="${REPO#*/}"
|
|
60
|
+
BOTS_JSON=$(printf '%s\n' "${BOTS[@]}" | jq -R . | jq -s .)
|
|
61
|
+
|
|
62
|
+
QUERY='query($owner:String!,$name:String!,$pr:Int!,$cursor:String){
|
|
63
|
+
repository(owner:$owner,name:$name){ pullRequest(number:$pr){
|
|
64
|
+
headRefOid
|
|
65
|
+
commits(last:1){ nodes{ commit{ oid committedDate } } }
|
|
66
|
+
reviews(last:100){ nodes{ author{ login __typename } commit{ oid } submittedAt body } }
|
|
67
|
+
comments(last:100){ nodes{ author{ login __typename } createdAt updatedAt body } }
|
|
68
|
+
reactions(last:50){ nodes{ content createdAt user{ login } } }
|
|
69
|
+
reviewThreads(first:100, after:$cursor){
|
|
70
|
+
pageInfo{ hasNextPage endCursor }
|
|
71
|
+
nodes{ id isResolved isOutdated path line
|
|
72
|
+
comments(first:1){ nodes{ databaseId url author{ login __typename } body } } }
|
|
73
|
+
}
|
|
74
|
+
} }
|
|
75
|
+
}'
|
|
76
|
+
|
|
77
|
+
# One full read: first page carries head/reviews/comments; every page carries threads.
|
|
78
|
+
read_state() {
|
|
79
|
+
local cursor=null page first="" threads="[]"
|
|
80
|
+
while :; do
|
|
81
|
+
page=$(gh api graphql -f query="$QUERY" -f owner="$OWNER" -f name="$NAME" \
|
|
82
|
+
-F pr="$PR" -F cursor="$cursor")
|
|
83
|
+
[ -n "$first" ] || first="$page"
|
|
84
|
+
threads=$(jq -c --argjson acc "$threads" \
|
|
85
|
+
'$acc + .data.repository.pullRequest.reviewThreads.nodes' <<<"$page")
|
|
86
|
+
[ "$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage' <<<"$page")" = "true" ] || break
|
|
87
|
+
cursor=$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor' <<<"$page")
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
jq -c --argjson bots "$BOTS_JSON" --argjson threads "$threads" --arg since "$SINCE" '
|
|
91
|
+
.data.repository.pullRequest as $p
|
|
92
|
+
| $p.headRefOid as $head
|
|
93
|
+
| ([$p.commits.nodes[0].commit.committedDate // "", $since] | max) as $after
|
|
94
|
+
| def matches($login): any($bots[]; . as $re | ($login // "") | test($re; "i"));
|
|
95
|
+
def isbot($a): ($a.__typename // "User") != "User";
|
|
96
|
+
def progress: test("busy working|in progress|currently processing|currently reviewing|\\*\\*(running|queued)\\*\\*"; "i");
|
|
97
|
+
def limited: test("review limit reached|reached your (pr )?review limit|reviews are paused|rate limit (exceeded|reached)|been rate[- ]limited"; "i");
|
|
98
|
+
[ $bots[] as $re
|
|
99
|
+
| ($p.reviews.nodes | map(select((.author.login // "") | test($re; "i")))) as $revs
|
|
100
|
+
| ($p.comments.nodes | map(select((.author.login // "") | test($re; "i")))) as $coms
|
|
101
|
+
| ($coms | map(select(.updatedAt >= $after))) as $fresh
|
|
102
|
+
| ($p.reactions.nodes | map(select(((.user.login // "") | test($re; "i"))
|
|
103
|
+
and .content != "EYES" and .createdAt >= $after))) as $reacts
|
|
104
|
+
| {
|
|
105
|
+
bot: $re,
|
|
106
|
+
reviewed_head: any($revs[]; .commit.oid == $head),
|
|
107
|
+
activity_after_head: (any($fresh[]; (.body | progress) | not)
|
|
108
|
+
or ($reacts | length) > 0),
|
|
109
|
+
limited: any($fresh[]; .body | limited)
|
|
110
|
+
}
|
|
111
|
+
| .acted_on_head = (.reviewed_head or .activity_after_head)
|
|
112
|
+
] as $per_bot
|
|
113
|
+
| [ $threads[] | select(.isResolved | not)
|
|
114
|
+
| .comments.nodes[0] as $c
|
|
115
|
+
| {
|
|
116
|
+
thread_id: .id, comment_id: $c.databaseId, url: $c.url,
|
|
117
|
+
author: $c.author.login, is_bot: isbot($c.author), is_target: matches($c.author.login),
|
|
118
|
+
path, line, outdated: .isOutdated,
|
|
119
|
+
excerpt: (($c.body // "") | gsub("\\s+"; " ") | .[0:160])
|
|
120
|
+
} ] as $open
|
|
121
|
+
| ($open | map(select(.is_bot))) as $open_bot
|
|
122
|
+
| {
|
|
123
|
+
head: $head,
|
|
124
|
+
head_after: $after,
|
|
125
|
+
bots: $per_bot,
|
|
126
|
+
unresolved: $open,
|
|
127
|
+
counts: {
|
|
128
|
+
target: ($open_bot | map(select(.is_target)) | length),
|
|
129
|
+
other_bots: ($open_bot | map(select(.is_target | not)) | length),
|
|
130
|
+
humans: ($open | map(select(.is_bot | not)) | length)
|
|
131
|
+
},
|
|
132
|
+
verdict: (
|
|
133
|
+
if any($per_bot[]; .limited) then "limited"
|
|
134
|
+
elif ($open_bot | length) > 0 then "findings"
|
|
135
|
+
elif any($per_bot[]; .acted_on_head | not) then "pending"
|
|
136
|
+
else "clean" end)
|
|
137
|
+
}' <<<"$first"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
exit_for() {
|
|
141
|
+
case "$1" in clean) echo 0 ;; findings) echo 10 ;; pending) echo 20 ;; limited) echo 30 ;; *) echo 1 ;; esac
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
deadline=$(( SECONDS + WAIT ))
|
|
145
|
+
state=$(read_state)
|
|
146
|
+
verdict=$(jq -r .verdict <<<"$state")
|
|
147
|
+
waiting() { jq -e '.verdict != "limited" and any(.bots[]; .acted_on_head | not)' >/dev/null <<<"$state"; }
|
|
148
|
+
while :; do
|
|
149
|
+
if waiting && [ "$SECONDS" -lt "$deadline" ]; then
|
|
150
|
+
sleep "$INTERVAL"
|
|
151
|
+
elif [ "$verdict" = "clean" ] && [ "$SETTLE" -gt 0 ]; then
|
|
152
|
+
# Clean once is not clean: bots post a review, then a second bot or a follow-up lands.
|
|
153
|
+
sleep "$SETTLE"
|
|
154
|
+
SETTLE=0
|
|
155
|
+
else
|
|
156
|
+
break
|
|
157
|
+
fi
|
|
158
|
+
state=$(read_state)
|
|
159
|
+
verdict=$(jq -r .verdict <<<"$state")
|
|
160
|
+
done
|
|
161
|
+
|
|
162
|
+
printf '%s\n' "$state"
|
|
163
|
+
exit "$(exit_for "$verdict")"
|