@olegkoval/agent-skills 1.50.0 → 1.51.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.
Files changed (60) hide show
  1. package/.github/copilot-instructions.md +1 -0
  2. package/.github/prompts/coderabbitloop.prompt.md +90 -15
  3. package/.github/prompts/codexloop.prompt.md +33 -6
  4. package/.github/prompts/copilotloop.prompt.md +302 -0
  5. package/.github/prompts/geminiloop.prompt.md +34 -6
  6. package/.github/prompts/qodoloop.prompt.md +18 -0
  7. package/.kiro/steering/coderabbitloop.md +90 -15
  8. package/.kiro/steering/codexloop.md +33 -6
  9. package/.kiro/steering/copilotloop.md +301 -0
  10. package/.kiro/steering/geminiloop.md +34 -6
  11. package/.kiro/steering/qodoloop.md +18 -0
  12. package/.windsurf/rules/coderabbitloop.md +90 -15
  13. package/.windsurf/rules/codexloop.md +33 -6
  14. package/.windsurf/rules/copilotloop.md +300 -0
  15. package/.windsurf/rules/geminiloop.md +34 -6
  16. package/.windsurf/rules/qodoloop.md +18 -0
  17. package/README.md +1 -0
  18. package/adapters/claude/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  19. package/adapters/claude/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  20. package/adapters/claude/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  21. package/adapters/claude/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  22. package/adapters/claude/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  23. package/adapters/claude/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  24. package/adapters/claude/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  25. package/adapters/codex/olko-github-pr/README.md +1 -0
  26. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  27. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  28. package/adapters/cursor/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  29. package/adapters/cursor/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  30. package/adapters/cursor/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  31. package/adapters/cursor/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  32. package/adapters/cursor/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  33. package/adapters/grok/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  34. package/adapters/grok/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  35. package/adapters/grok/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  36. package/adapters/grok/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  37. package/adapters/grok/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  38. package/adapters/grok/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  39. package/adapters/grok/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  40. package/catalog/skills.json +23 -0
  41. package/package.json +1 -1
  42. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  43. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  44. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  45. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  46. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  47. package/plugins/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  48. package/plugins/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  49. package/plugins/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  50. package/plugins/olko-github-pr/skills/copilotloop/SKILL.md +308 -0
  51. package/plugins/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  52. package/plugins/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  53. package/plugins/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  54. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  55. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  56. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  57. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  58. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  59. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
  60. package/scripts/lib/catalog.mjs +1 -1
@@ -37,13 +37,30 @@ CodeRabbit has slash commands (official, `docs.coderabbit.ai/reference/review-co
37
37
  gh pr view --json number,headRefName,headRefOid -q '{number, branch: .headRefName, sha: .headRefOid}'
38
38
  ```
39
39
 
40
- Check out the branch if not already on it.
40
+ Check out the branch if not already on it, **then require a clean working tree**
41
+ (`git status --porcelain` empty) before touching anything:
42
+
43
+ ```bash
44
+ [ -z "$(git status --porcelain)" ] || { echo "working tree not clean, refusing to start: would risk committing unrelated changes"; exit 1; }
45
+ ```
46
+
47
+ This is the precondition step E's scoped `git add <file>` depends on: staging only the files a fix
48
+ touched is safe *because* the tree started clean. Skip it and a file with pre-existing local edits
49
+ gets those edits swept into the fix commit right along with it.
41
50
 
42
51
  ### 2. Loop (max 5 iterations)
43
52
 
44
- #### A. Push and wait
53
+ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enforce, not a figure
54
+ of speech. Each pass through A–F is one iteration; on hitting the cap, go straight to the report.
55
+
56
+ #### A. Wait for a review of the current head
57
+
58
+ On **iteration 1**, if there is nothing to push yet (you haven't fixed anything in this loop), don't
59
+ wait for a brand-new review: use whatever CodeRabbit has already posted as your starting point and
60
+ go straight to step B. Otherwise:
45
61
 
46
62
  ```bash
63
+ SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
47
64
  git push
48
65
  ```
49
66
 
@@ -53,11 +70,27 @@ If this repo doesn't auto-review on push, nudge it:
53
70
  gh pr comment <PR_NUMBER> --body "@coderabbitai review"
54
71
  ```
55
72
 
56
- Poll (every ~10s, timeout ~5min) for CodeRabbit's next formal review to land: a new entry in `gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews` from `coderabbitai[bot]` created after this push. If you instead see a rate-limit comment ("review limit"), **stop the loop now** and go to Report with `blocked: rate-limited`.
73
+ Poll (every ~10s, timeout ~5min) for CodeRabbit's next formal review to land: a new entry in
74
+ `gh api --paginate repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews` from `coderabbitai[bot]`
75
+ (REST spelling carries the `[bot]` suffix) created after `$SINCE`. Follow pagination so a review
76
+ that lands on page two is not missed. If you instead see a rate-limit comment ("review limit"),
77
+ **stop the loop now** and go to Report with `blocked: rate-limited`. If no review arrives within
78
+ the timeout after one retry, stop and report the timeout honestly; do not claim success.
57
79
 
58
80
  #### B. Fetch unresolved findings
59
81
 
60
- Run the `unresolvedQodoThreads`-shaped query in `references/graphql-queries.md` (filter `author.login == "coderabbitai[bot]"` instead of Qodo's login). For each unresolved thread, parse the finding text and the **Prompt for AI Agents** block (heading text is `🤖 Prompt for AI Agents`, not `Agent Prompt`: match case/emoji-insensitively).
82
+ Run the `unresolvedQodoThreads`-shaped query in `references/graphql-queries.md` (filter `author.login`
83
+ on GraphQL's bare `coderabbitai`, **not** REST's `coderabbitai[bot]`: see the reference's login-spelling
84
+ note, and follow `pageInfo.hasNextPage`/`endCursor` until exhausted). For each unresolved thread,
85
+ parse the finding text, its `databaseId`, and the **Prompt for AI Agents** block (heading text is
86
+ `🤖 Prompt for AI Agents`, not `Agent Prompt`: match case/emoji-insensitively).
87
+
88
+ Mark each thread as seen with an 👀 reaction on its first comment (`databaseId` from the query), so
89
+ the bot and a watching human can tell it is being worked:
90
+
91
+ ```bash
92
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=eyes
93
+ ```
61
94
 
62
95
  #### C. Check exit conditions
63
96
 
@@ -65,26 +98,68 @@ Stop if there are zero unresolved CodeRabbit threads, or max iterations reached.
65
98
 
66
99
  #### D. Fix each finding
67
100
 
68
- For each thread, in order: read the Prompt for AI Agents block in full: it names the issue and the fix. Apply it, staying inside its stated scope. If the suggestion is wrong, unsafe, or needs a product decision, don't force it: note that in step E instead.
101
+ For each thread, in order: read the Prompt for AI Agents block in full: it names the issue and the fix. Apply it, staying inside its stated scope. If the suggestion is wrong, unsafe, or needs a product decision, don't force it: note that in step F instead. Track two lists as you go: **fixed** (thread id + the exact files you touched) and **skipped** (thread id + why). Do not resolve anything yet.
102
+
103
+ #### E. Commit and push FIRST, before resolving anything
69
104
 
70
- #### E. Answer and resolve
105
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to succeed
106
+ before the claim is made: otherwise a failed commit or push leaves the PR unfixed with the finding
107
+ marked resolved, and nobody looks at it again.
71
108
 
72
- **Reply to the thread first, then resolve it**, the "answer to the comments" half of the job:
109
+ If step D changed code:
73
110
 
74
111
  ```bash
75
- gh api graphql -f query='mutation { addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: "<THREAD_ID>", body: "<REPLY>"}) { comment { id } } }'
112
+ # Stage ONLY the files your fixes touched: never `git add -A`, which sweeps up
113
+ # unrelated work and untracked secrets sitting in the worktree.
114
+ git status --short # look before you stage
115
+ git add <path> [<path>...] # the files named in the findings you fixed
116
+ git commit -m "address CodeRabbit review feedback (coderabbitloop iteration N)"
117
+ git push
76
118
  ```
77
119
 
78
- Reply body: one or two sentences, what you changed and why, or exactly why you didn't fix it. Then resolve (`resolveReviewThread`). A finding you deliberately skip still gets a reply and gets resolved.
120
+ Confirm the push actually landed before continuing:
79
121
 
80
- #### F. Commit and push
122
+ ```bash
123
+ git rev-parse HEAD
124
+ gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid # must match
125
+ ```
126
+
127
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
128
+
129
+ #### F. Reply to each finding, react, then resolve
130
+
131
+ Only now, with the fixes pushed, reply and resolve. **Reply to the thread first, then react, then
132
+ resolve it**, the "answer to the comments" half of the job:
81
133
 
82
134
  ```bash
83
- git add -A
84
- git commit -m "address CodeRabbit review feedback (coderabbitloop iteration N)"
85
- git push
135
+ gh api graphql -f query='
136
+ mutation($threadId: ID!, $body: String!) {
137
+ addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: $threadId, body: $body}) {
138
+ comment { id }
139
+ }
140
+ }' -f threadId="$THREAD_ID" -f body="$REPLY_TEXT"
86
141
  ```
87
142
 
143
+ Pass the thread id and reply text as GraphQL **variables** (`-f threadId=... -f body=...`), never
144
+ interpolated into the query string: a reply containing a quote, backtick, or newline breaks (or
145
+ injects into) a hand-built query.
146
+
147
+ Reply body: one or two sentences, what you changed and why, or exactly why you didn't fix it. A
148
+ finding you deliberately skip still gets a reply and gets resolved.
149
+
150
+ Then record the disposition as a reaction on the thread's first comment: the learning signal, and a
151
+ visible marker for a human scanning the PR. 👍 (`+1`) for fixed, 👎 (`-1`) for skipped/rebutted.
152
+ CodeRabbit reads a 👎 as feedback that the finding was wrong.
153
+
154
+ ```bash
155
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=+1
156
+ # skipped/rebutted finding:
157
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=-1
158
+ ```
159
+
160
+ Then resolve (`resolveReviewThread`). Reply first, react, then resolve: a reaction never replaces
161
+ the reply, and a resolved thread with no reply loses the reasoning.
162
+
88
163
  Go back to step A.
89
164
 
90
165
  ### 3. Report
@@ -95,7 +170,7 @@ Go back to step A.
95
170
  | Findings resolved | N |
96
171
  | Findings skipped | N (with reasons) |
97
172
  | Remaining | N (if any) |
98
- | Blocked | rate-limited / max-iterations / none |
173
+ | Blocked | rate-limited / timeout / max-iterations / none |
99
174
 
100
175
  ```
101
176
  Coderabbitloop complete.
@@ -106,4 +181,4 @@ Coderabbitloop complete.
106
181
 
107
182
  ## References
108
183
 
109
- - `references/graphql-queries.md`: shared with `qodoloop`: the exact `reviewThreads` query and the `resolveReviewThread` / `addPullRequestReviewThreadReply` mutations. Swap the author-login filter to `coderabbitai[bot]` and the prompt-heading match to `Prompt for AI Agents`.
184
+ - `references/graphql-queries.md`: shared with `qodoloop`: the exact `reviewThreads` query (including the `databaseId` the reaction step needs) and the `resolveReviewThread` / `addPullRequestReviewThreadReply` mutations. Filter `author.login` on GraphQL's bare `coderabbitai` (never `coderabbitai[bot]`) and match the prompt heading `Prompt for AI Agents`.
@@ -29,7 +29,7 @@ suggestion applied is worse than the comment itself.
29
29
  ## Not for
30
30
 
31
31
  - GitLab / Perforce (Codex code review is a GitHub app). For other review bots this catalog ships
32
- `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
32
+ `copilotloop`, `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
33
33
  `ci-fix-loop`.
34
34
 
35
35
  ## 0. Resolve the Codex bot login (do this first, do not hardcode)
@@ -76,9 +76,13 @@ report and list what is still unresolved rather than starting a sixth.
76
76
 
77
77
  ```bash
78
78
  HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
79
- # Only trigger if no Codex review already exists for this exact SHA:
80
- HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
81
- --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | length")
79
+ # Only trigger if no Codex review already exists for this exact SHA.
80
+ # gh cannot combine --slurp with --jq, so pipe to `jq -s`: it folds every page
81
+ # into one array. Without it the filter runs once per page and HAVE becomes a
82
+ # multi-line count that never equals "0", silently skipping the trigger.
83
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
84
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
85
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | length')
82
86
  if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "@codex review"; fi
83
87
  ```
84
88
 
@@ -92,8 +96,9 @@ an honest timeout, not hang it.
92
96
  wait_for_review() { # $1 = attempt label
93
97
  local deadline=$(( SECONDS + 600 ))
94
98
  while [ "$SECONDS" -lt "$deadline" ]; do
95
- R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
96
- --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | last")
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')
97
102
  if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
98
103
  echo "waiting for Codex review of $HEAD_SHA ($1)..."; sleep 15
99
104
  done
@@ -127,6 +132,13 @@ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
127
132
  Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
128
133
  unresolved ones.
129
134
 
135
+ Mark each unresolved comment as seen, so the bot and a watching human can tell it is being handled.
136
+ GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
137
+
138
+ ```bash
139
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
140
+ ```
141
+
130
142
  ### C. Critically evaluate EACH comment (the core of this skill)
131
143
 
132
144
  For every comment, **verify the claim against the actual code and repo conventions before touching
@@ -228,6 +240,21 @@ then resolve:
228
240
  gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
229
241
  ```
230
242
 
243
+ Then record the disposition as a reaction on the bot's own comment: the learning signal, and a
244
+ visible marker for a human scanning the PR:
245
+
246
+ - 👍 (`+1`): the finding was accepted and fixed.
247
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
248
+
249
+ ```bash
250
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
251
+ # rebutted finding:
252
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
253
+ ```
254
+
255
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
256
+ resolved thread with no reply loses the reasoning.
257
+
231
258
  Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted: never
232
259
  blanket-resolve, and never resolve a human reviewer's thread. For each fixed comment, verify the
233
260
  push first, reply with the change made, then resolve the thread and verify `isResolved: true`.
@@ -0,0 +1,301 @@
1
+ <!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
2
+
3
+ ---
4
+ inclusion: manual
5
+ description: "Iteratively drives a GitHub PR to zero unresolved GitHub Copilot review comments, verifying every finding against the real code first, fixes only the correct ones, and rebuts false positives without changing correct code."
6
+ ---
7
+
8
+ # Copilotloop
9
+
10
+ Drive a GitHub PR until Copilot has no unresolved review comments, **but do not cargo-cult its
11
+ suggestions.** Every comment is a *claim to verify*, not an instruction to obey. A wrong
12
+ suggestion applied is worse than the comment itself.
13
+
14
+ ## How Copilot differs from other review bots
15
+
16
+ - **No check-run, no score.** Copilot posts an overview comment and a PR review with inline review
17
+ comments. Detection is by polling the reviews endpoint and paginated review threads. "Satisfied"
18
+ means zero unresolved Copilot threads and zero unaddressed body findings after each finding is
19
+ fixed or rebutted with a recorded reply.
20
+ - **Request through the reviewers API.** Copilot does not use a reliable slash-command trigger.
21
+ Request `copilot-pull-request-reviewer[bot]` through the pull request reviewers endpoint. A
22
+ repository may also be configured to review new pushes automatically.
23
+ - **Copilot may repeat comments.** A re-review can repeat comments that were resolved or downvoted,
24
+ so match findings to the current head and prior replies before reopening work, including body
25
+ findings that have no inline thread.
26
+ - **Copilot is concise and can reason from the diff alone.** Its characteristic failure is
27
+ confidently asserting a bug based only on the changed hunk, without the surrounding file or the
28
+ call sites. That makes "read the whole file before believing it" the single highest-value check.
29
+
30
+ ## Not for
31
+
32
+ - GitLab / Perforce. For other review bots this catalog ships `codexloop`, `geminiloop`,
33
+ `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
34
+ `ci-fix-loop`.
35
+
36
+ ## 0. Resolve the Copilot bot login (do this first)
37
+
38
+ The bot login is normally stable, but confirm it from the PR rather than assuming it:
39
+
40
+ ```bash
41
+ gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate --jq '.[].user.login' | sort -u
42
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate --jq '.[].user.login' | sort -u
43
+ ```
44
+
45
+ Use `copilot-pull-request-reviewer[bot]` as `BOT`. Confirm it appears after the first requested
46
+ review; if GitHub uses a different login for the installation, use the exact Copilot-looking login
47
+ returned by the probe rather than guessing.
48
+
49
+ **Finding nothing here is NOT a stop condition.** On a PR Copilot has never reviewed there is no bot
50
+ login to find yet. Fall through to step 2A, request the reviewer, and re-run this probe once a
51
+ review lands. Only conclude Copilot is unavailable after the bounded wait expires with no review.
52
+
53
+ ## 1. Identify the PR
54
+
55
+ ```bash
56
+ gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
57
+ ```
58
+
59
+ Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
60
+
61
+ ## 2. The loop (max 5 iterations)
62
+
63
+ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enforce, not a
64
+ figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
65
+ report and list what is still unresolved rather than starting a sixth.
66
+
67
+ ### A. Ensure a fresh Copilot review on the current head
68
+
69
+ ```bash
70
+ HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
71
+ # Only trigger if no Copilot review exists for this exact SHA:
72
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
73
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
74
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | length')
75
+ if [ "$HAVE" = "0" ]; then
76
+ gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
77
+ -f 'reviewers[]=copilot-pull-request-reviewer[bot]'
78
+ fi
79
+ ```
80
+
81
+ Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint, and
82
+ poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
83
+ an honest timeout, not hang it.
84
+
85
+ ```bash
86
+ # 10-minute deadline, one retry, then give up. DEADLINE/RETRIES are the
87
+ # enforcement of the bounds this skill claims: do not drop them.
88
+ wait_for_review() { # $1 = attempt label
89
+ local deadline=$(( SECONDS + 600 ))
90
+ while [ "$SECONDS" -lt "$deadline" ]; do
91
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
92
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
93
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
94
+ if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
95
+ echo "waiting for Copilot review of $HEAD_SHA ($1)..."; sleep 15
96
+ done
97
+ return 1
98
+ }
99
+
100
+ if ! wait_for_review "first wait"; then
101
+ echo "no Copilot review after 10m, retrying once" # say the retry out loud
102
+ gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
103
+ -f 'reviewers[]=copilot-pull-request-reviewer[bot]'
104
+ if ! wait_for_review "after retry"; then
105
+ echo "Copilot did not review $HEAD_SHA after a retry; stopping and reporting."
106
+ exit 1 # honest timeout, never a success claim
107
+ fi
108
+ fi
109
+ ```
110
+
111
+ Copilot usually reviews quickly, but large diffs can take longer; the deadline is bounded. Report the
112
+ retry in the final summary; two silent timeouts are the failure mode this guard exists to prevent.
113
+
114
+ ### B. Fetch the findings
115
+
116
+ - **Summary**: read the Copilot overview comment and review `.body`, including all matching reviews
117
+ for the current head. Extract and classify actionable claims even when they have no inline thread;
118
+ an approval assessment or lack of inline comments does not make those findings complete.
119
+ Track each body finding across iterations by source review/comment ID and item, with its
120
+ classification, fix commit or evidence-based rebuttal, PR-level reply URL, and completion status.
121
+ Link duplicates to the same finding so they are counted once; retain pending findings after a push.
122
+ - **Unresolved inline comments** on the current head:
123
+
124
+ ```bash
125
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
126
+ --jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
127
+ ```
128
+
129
+ Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
130
+ unresolved ones.
131
+
132
+ Mark each unresolved inline comment as seen, so the bot and a watching human can tell it is being
133
+ handled. GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
134
+
135
+ ```bash
136
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
137
+ ```
138
+
139
+ Body findings (no inline thread) have no comment to react to; track them in step B's register and
140
+ give each a PR-level reply in step F instead.
141
+
142
+ ### C. Critically evaluate EACH finding (the core of this skill)
143
+
144
+ For every inline or body finding, **verify the claim against the actual code and repo conventions
145
+ before touching anything.** Read the whole file, not just the diff hunk Copilot saw, plus the types
146
+ and the call sites. Then classify:
147
+
148
+ 1. **CORRECT + actionable**: the finding is real and the fix improves the code. → fix it (step D).
149
+ 2. **FALSE POSITIVE / technically wrong**: the claim doesn't hold. → do **NOT** change code; write a
150
+ specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve
151
+ its thread or record completion for a body finding (step F).
152
+ 3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
153
+ → briefly decline with evidence of that convention or scope, then resolve its thread or record
154
+ completion for a body finding (step F). Do not expand the PR's scope to satisfy a nit.
155
+
156
+ **Hard rules:**
157
+ - **Never modify correct code just to silence Copilot.** Prefer a reasoned rebuttal.
158
+ - When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
159
+ rather than assume Copilot is right. Default to skepticism.
160
+ - If a suggested change would break other call sites, alter public behavior, or contradict a verified
161
+ repo convention, it is a category-2 rebuttal, not a fix.
162
+ - Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Copilot asks for a
163
+ ticket reference and none exists, say so; do not invent one.
164
+
165
+ **Copilot's common failure modes to watch for (default these to category 2):**
166
+ - Diff-local reasoning: asserts a bug that the unchanged surrounding code already handles.
167
+ - "This can be null/undefined here" where the type or an earlier guard already rules it out.
168
+ - Invented race conditions or error paths with no actual trigger.
169
+ - Suggestions that compile-break or break other callers.
170
+ - Security/perf warnings with no exploit path or measurable cost.
171
+ - Restating library/framework semantics incorrectly.
172
+ - Style demands that contradict the repo's existing, consistent pattern.
173
+
174
+ ### D. Apply fixes: category 1 only
175
+
176
+ Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
177
+ moving on.
178
+
179
+ ### E. Commit and push FIRST, before resolving anything
180
+
181
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
182
+ succeed before the claim is made: otherwise a failed commit or push leaves the PR unfixed with the
183
+ finding marked resolved, and nobody looks at it again.
184
+
185
+ If step D changed code:
186
+
187
+ ```bash
188
+ # Stage ONLY the files your fixes touched: never `git add -A`, which sweeps up
189
+ # unrelated work and untracked secrets sitting in the worktree.
190
+ git status --short # look before you stage
191
+ git add <path> [<path>...] # the files named in the findings you fixed
192
+ git commit -m "address Copilot review feedback (copilotloop iteration N)"
193
+ git push
194
+ ```
195
+
196
+ Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
197
+ convention). Confirm the push actually landed before continuing:
198
+
199
+ ```bash
200
+ git rev-parse HEAD
201
+ gh pr view <PR> --json headRefOid -q .headRefOid # must match
202
+ ```
203
+
204
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
205
+
206
+ ### F. Reply to every addressed finding and resolve its inline threads
207
+
208
+ Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
209
+ pagination**: a PR with more than 100 threads will otherwise look clean while unresolved findings
210
+ sit on page two:
211
+
212
+ ```bash
213
+ # Loop until hasNextPage is false, passing endCursor back in as $cursor.
214
+ CURSOR=null
215
+ while : ; do
216
+ PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
217
+ query($cursor: String) {
218
+ repository(owner: "OWNER", name: "REPO") {
219
+ pullRequest(number: PR_NUMBER) {
220
+ reviewThreads(first: 100, after: $cursor) {
221
+ pageInfo { hasNextPage endCursor }
222
+ nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
223
+ }
224
+ }
225
+ }
226
+ }')
227
+ echo "$PAGE" # collect nodes from every page before deciding the PR is clean
228
+ PI='.data.repository.pullRequest.reviewThreads.pageInfo'
229
+ [ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
230
+ CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
231
+ done
232
+ ```
233
+
234
+ Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
235
+ then resolve:
236
+
237
+ ```bash
238
+ gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
239
+ ```
240
+
241
+ Then record the disposition of each inline finding as a reaction on Copilot's own comment: the
242
+ learning signal, and a visible marker for a human scanning the PR:
243
+
244
+ - 👍 (`+1`): the finding was accepted and fixed.
245
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
246
+
247
+ ```bash
248
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
249
+ # rebutted finding:
250
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
251
+ ```
252
+
253
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
254
+ resolved thread with no reply loses the reasoning.
255
+
256
+ Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted: never
257
+ blanket-resolve, and never resolve a human reviewer's thread.
258
+
259
+ Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
260
+ whether step D changed code.
261
+
262
+ For each body finding, post a PR-level reply (for example, using
263
+ `gh pr comment <PR> --body-file <reply-file>`) identifying the source review/comment and item.
264
+ Record the pushed fix commit and validation, or an evidence-based rebuttal, including the reason
265
+ for declining an out-of-scope finding. Record the reply URL in the tracking entry before marking
266
+ it complete. One reply may cover multiple explicitly identified findings. Fixed body findings
267
+ require the same successful push check as fixed threads; rebuttals need no push. If a finding also
268
+ has an inline thread, that thread still requires a reply and resolution.
269
+
270
+ ### G. Re-review
271
+
272
+ Pushing re-triggers Copilot when automatic review of new pushes is on; otherwise request Copilot again
273
+ through the reviewers endpoint. Go back to **A**
274
+ with the new head SHA. If step D changed nothing (all comments were rebutted), skip the push,
275
+ ensure all Copilot threads are resolved and all tracked body findings have recorded PR-level
276
+ replies and are complete, then exit.
277
+
278
+ ## 3. Exit conditions
279
+
280
+ Stop when **any** is true:
281
+ - Zero unresolved `$BOT` threads and zero pending body findings remain across iterations. Every
282
+ finding was fixed or rebutted with evidence, every inline thread was replied to and resolved,
283
+ and every body finding has a recorded PR-level reply. (There is no score to hit:
284
+ this is "done".)
285
+ - Max iterations (5) reached: report what remains.
286
+ - Copilot never responded after one retry: report the timeout honestly; do not claim success.
287
+
288
+ ## 4. Report
289
+
290
+ ```text
291
+ Copilotloop complete.
292
+ PR: #<n>
293
+ Bot login: <resolved $BOT>
294
+ Iterations: N
295
+ Findings fixed: N (inline + body findings, deduplicated)
296
+ Findings rebutted: N (inline + body findings, with recorded evidence-based replies)
297
+ Remaining: 0 (unresolved inline + pending body findings, deduplicated)
298
+ ```
299
+
300
+ If it stopped at max iterations, list the remaining threads and body findings with your current
301
+ assessment (fix-pending vs disputed) so a human can arbitrate.
@@ -29,7 +29,7 @@ instruction to obey. A wrong suggestion applied is worse than the comment itself
29
29
  ## Not for
30
30
 
31
31
  - GitLab / Perforce (Gemini Code Assist is GitHub-only). For other review bots this catalog ships
32
- `codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
32
+ `copilotloop`, `codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
33
33
  `ci-fix-loop`.
34
34
 
35
35
  ## 1. Identify the PR
@@ -52,9 +52,13 @@ Gemini auto-reviews new commits, but force a deterministic pass and record the h
52
52
 
53
53
  ```bash
54
54
  HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
55
- # Only trigger if no gemini review already exists for this exact SHA:
56
- HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
57
- --jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | length")
55
+ # Only trigger if no gemini review already exists for this exact SHA.
56
+ # gh cannot combine --slurp with --jq, so pipe to `jq -s`: it folds every page
57
+ # into one array. Without it the filter runs once per page and HAVE becomes a
58
+ # multi-line count that never equals "0", silently skipping the trigger.
59
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
60
+ jq -s --arg head "$HEAD_SHA" \
61
+ '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | length')
58
62
  if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "/gemini review"; fi
59
63
  ```
60
64
 
@@ -67,8 +71,9 @@ an honest timeout, not hang it.
67
71
  wait_for_review() { # $1 = attempt label
68
72
  local deadline=$(( SECONDS + 600 ))
69
73
  while [ "$SECONDS" -lt "$deadline" ]; do
70
- R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
71
- --jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | last")
74
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
75
+ jq -s --arg head "$HEAD_SHA" \
76
+ '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
72
77
  if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
73
78
  echo "waiting for Gemini review of $HEAD_SHA ($1)..."; sleep 15
74
79
  done
@@ -102,6 +107,13 @@ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
102
107
  Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
103
108
  unresolved ones.
104
109
 
110
+ Mark each unresolved comment as seen, so the bot and a watching human can tell it is being handled.
111
+ GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
112
+
113
+ ```bash
114
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
115
+ ```
116
+
105
117
  ### C. Critically evaluate EACH comment (the core of this skill)
106
118
 
107
119
  For every comment, **verify the claim against the actual code and repo conventions before touching
@@ -197,6 +209,21 @@ then resolve:
197
209
  gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
198
210
  ```
199
211
 
212
+ Then record the disposition as a reaction on the bot's own comment: the learning signal, and a
213
+ visible marker for a human scanning the PR:
214
+
215
+ - 👍 (`+1`): the finding was accepted and fixed.
216
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
217
+
218
+ ```bash
219
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
220
+ # rebutted finding:
221
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
222
+ ```
223
+
224
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
225
+ resolved thread with no reply loses the reasoning.
226
+
200
227
  Resolve a thread only for comments authored by `gemini-code-assist[bot]` that you have fixed or
201
228
  rebutted: never blanket-resolve, and never resolve a human reviewer's thread.
202
229
 
@@ -214,6 +241,7 @@ Stop when **any** is true:
214
241
  - Zero unresolved `gemini-code-assist[bot]` comments remain, and every comment this round was fixed
215
242
  or rebutted+resolved. (There is no score to hit: this is "done".)
216
243
  - Max iterations (5) reached: report what remains.
244
+ - Gemini never responded after one retry: report the timeout honestly; do not claim success.
217
245
 
218
246
  ## 4. Report
219
247
 
@@ -78,6 +78,14 @@ Run the paginated GraphQL query in `references/graphql-queries.md` (`unresolvedQ
78
78
 
79
79
  Build the working set: all `recommended` threads, plus `optional` ones too if `--include-optional`.
80
80
 
81
+ Mark each thread as seen with an 👀 reaction on its first comment (`databaseId` from the query), so
82
+ the bot and a watching human can tell it is being worked. GitHub's reaction set is fixed; `eyes` is
83
+ the only "looking at it" value:
84
+
85
+ ```bash
86
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=eyes
87
+ ```
88
+
81
89
  #### C. Check exit conditions
82
90
 
83
91
  Stop if the working set is empty, or max iterations reached.
@@ -114,6 +122,16 @@ This is the "answer to the comments" half of the job, not optional cleanup, and
114
122
  Pass the thread id and reply text as GraphQL **variables** (`-f threadId=... -f body=...`), never interpolated into the query string itself: a reply containing a quote, backtick, or newline breaks (or worse, injects into) a hand-built query. Then resolve with `resolveReviewThread` (see references file).
115
123
  - **Blocked** findings: reply explaining exactly why (false positive / needs a human call), but **do not resolve**: leave the thread open. A blocked finding that gets silently resolved is a false "done".
116
124
 
125
+ Then record each disposition as a reaction on the thread's first comment: the learning signal, and
126
+ a visible marker for a human scanning the PR. 👍 (`+1`) for a fixed finding, 👎 (`-1`) for a
127
+ blocked/rebutted one. Reply first, react, then resolve: a reaction never replaces the reply.
128
+
129
+ ```bash
130
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=+1
131
+ # blocked/rebutted finding:
132
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=-1
133
+ ```
134
+
117
135
  Go back to step A.
118
136
 
119
137
  ### 3. Report