Skip to content

Commit b978f5b

Browse files
committed
chore(cursor-bugbot): include resolution-flow update from canonical (e66de05)
1 parent 3ef970d commit b978f5b

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

.claude/skills/cursor-bugbot/SKILL.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Drive the Cursor Bugbot fix-and-respond loop end-to-end. This is the canonical f
1313

1414
- `/cursor-bugbot <PR#>` — full audit-and-fix on one PR (default).
1515
- `/cursor-bugbot check <PR#>` — list Bugbot findings, classify them, but don't fix or reply.
16-
- `/cursor-bugbot reply <comment-id> <state>` — single-comment reply where `<state>` is `fixed`, `false-positive`, or `wont-fix`.
16+
- `/cursor-bugbot reply <comment-id> <state>` — single-comment reply where `<state>` is `fixed`, `false-positive`, or `wont-fix`. Auto-resolves the thread for `fixed` / `false-positive`; leaves open for `wont-fix`.
17+
- `/cursor-bugbot resolve <PR#>` — sweep all Bugbot threads on the PR that have author replies but are still open; resolve them. Useful for closing out a PR before merge.
1718
- `/cursor-bugbot scope <PR#>` — re-evaluate the PR title and body against the actual commits and rewrite them when out of step.
1819

1920
## Why a skill
@@ -76,7 +77,7 @@ For each `real` finding:
7677
4. Stage + commit the fix with a message that names the finding (e.g., `fix(hooks): address Cursor Bugbot finding on scanSocketApiKeys lineNumber`).
7778
5. Note the new commit SHA — the reply needs it.
7879

79-
### Phase 4 — Reply on each thread
80+
### Phase 4 — Reply + resolve on each thread
8081

8182
**Critical**: replies go on the inline review-comment thread, not as a detached PR comment. The CLI form:
8283

@@ -85,6 +86,41 @@ gh api "repos/{owner}/{repo}/pulls/<PR#>/comments/<comment-id>/replies" \
8586
-X POST -f body=""
8687
```
8788

89+
After replying, **resolve the thread** so it's marked done in the PR review UI (the reply alone doesn't auto-resolve). Resolution is a GraphQL mutation; first resolve the thread node ID from the comment's databaseId, then resolve:
90+
91+
```bash
92+
# Step 1: get the thread node ID (PRRT_…) for a given comment databaseId.
93+
THREAD_ID=$(gh api graphql -f query='
94+
query($pr: Int!, $owner: String!, $repo: String!) {
95+
repository(owner: $owner, name: $repo) {
96+
pullRequest(number: $pr) {
97+
reviewThreads(first: 50) {
98+
nodes {
99+
id
100+
comments(first: 1) { nodes { databaseId } }
101+
}
102+
}
103+
}
104+
}
105+
}' -f owner=<owner> -f repo=<repo> -F pr=<PR#> \
106+
--jq ".data.repository.pullRequest.reviewThreads.nodes[] | select(.comments.nodes[0].databaseId == <comment-id>) | .id")
107+
108+
# Step 2: resolve.
109+
gh api graphql -f query='
110+
mutation($threadId: ID!) {
111+
resolveReviewThread(input: { threadId: $threadId }) {
112+
thread { id, isResolved }
113+
}
114+
}' -f threadId="$THREAD_ID"
115+
```
116+
117+
When to resolve:
118+
119+
- **`real`, fixed**: resolve after the fix commit lands and the reply is posted.
120+
- **`already-fixed`**: resolve immediately after the reply (the fix already exists).
121+
- **`false-positive`**: resolve immediately after the reply *unless* the verdict is contested by the reviewer.
122+
- **`wont-fix`**: do NOT resolve. The reviewer decides; leave it open as an open question.
123+
88124
Reply templates:
89125

90126
- **Real, fixed**: `Fixed in <commit-sha>. <one-sentence what changed>. <propagation note if any>.`
@@ -145,13 +181,15 @@ Bugbot will re-review the new HEAD automatically. New findings → loop back to
145181

146182
- Every Bugbot finding on the PR has a reply on its inline thread.
147183
- Every `real` finding has a corresponding fix commit on the PR branch.
184+
- Every reply that closes the matter (fixed / already-fixed / false-positive) is followed by `resolveReviewThread`. `wont-fix` threads stay open for reviewer judgment.
148185
- The PR title and body match the actual commits.
149186
- The PR branch is pushed.
150187

151188
## Anti-patterns
152189

153190
- ❌ Replying via `gh pr comment` (detached). Doesn't thread, doesn't notify the reviewer.
154191
- ❌ Force-rewriting a Bugbot's finding by editing the comment via `--method PATCH`. The bot may re-post.
192+
- ❌ Resolving a thread without a written reply. Future you (or the reviewer) won't know what happened. Reply first, resolve second.
155193
- ❌ Closing Bugbot threads via the GitHub UI without a written reply. Future you (or the reviewer) won't know what happened.
156194
- ❌ Fixing a Bugbot finding by deleting the offending code without understanding *why* the code was there. Bugbot doesn't know about your domain; the human reviewer does.
157195
- ❌ Treating "Bugbot Autofix determined this is a false positive" as a definitive verdict without checking. The autofix bot is right ~95% of the time but verifying takes 10 seconds.

0 commit comments

Comments
 (0)