Improve address-review command: fix bot filtering, add thread resolution#2555
Improve address-review command: fix bot filtering, add thread resolution#2555
Conversation
…ion, preserve comment IDs - Remove blanket bot comment skip; deduplicate bot feedback instead - Add GraphQL thread resolution with proper conditions - Preserve review comment/thread IDs through triage for reply/resolve - Resolve internal inconsistency between Step 3 and Bot Reviewer Awareness section - Add explicit closure path for DISCUSS and SKIPPED items via user request - Fixes reply-and-resolve feedback loop for addressed review threads
WalkthroughThe changes restructure the AI-assisted review command workflow to introduce a triage phase that classifies comments into MUST-FIX, DISCUSS, and SKIPPED categories, followed by selective todo creation from MUST-FIX items only, user presentation of triage results, and post-reply thread resolution via GraphQL. Comment filtering is enhanced with bot comment deduplication and granular classification rules. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AIAssistant as AI Assistant
participant GraphQLAPI as GraphQL API
User->>AIAssistant: Submit review for triage
AIAssistant->>AIAssistant: Classify comments into<br/>MUST-FIX, DISCUSS, SKIPPED
AIAssistant->>AIAssistant: Deduplicate bot comments
AIAssistant->>AIAssistant: Create todos from MUST-FIX only
AIAssistant->>User: Present triage results<br/>(categorized items & counts)
User->>AIAssistant: Approve triage & provide direction
AIAssistant->>AIAssistant: Address selected items,<br/>generate replies
AIAssistant->>GraphQLAPI: Resolve review threads<br/>(when addressed & thread ID available)
GraphQLAPI-->>AIAssistant: Thread resolution confirmed
AIAssistant->>User: Summary of addressed items
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review: Improve address-review commandOverall this is a solid improvement. The triage system (MUST-FIX / DISCUSS / SKIPPED) is well-designed and will meaningfully reduce noise, and the thread-resolution flow closes an important feedback loop that was previously missing. A few issues worth addressing: Critical gap: thread IDs are not available from the REST APIThe PR instructs Step 4 to "preserve the original review comment ID and thread ID when available," and Step 7 then uses that thread ID in the Without a mechanism to fetch thread IDs, the "preserve thread ID" instruction in Step 4 is a no-op, and the gh api graphql -f query='query($owner:String!,$name:String!,$number:Int!){
repository(owner:$owner,name:$name){
pullRequest(number:$number){
reviewThreads(first:100){
nodes{
id isResolved
comments(first:1){ nodes{ databaseId } }
}
}
}
}
}' -f owner="$OWNER" -f name="$NAME" -F number="$PR_NUMBER"This maps each comment's Pagination limitation silently removedThe previous "Known Limitations" section included:
This bullet was deleted in this PR without adding pagination support. Since both the REST API and the GraphQL Minor: triage criteria for
|
| - Deduplicate overlapping comments before classifying them. Keep one representative item for the underlying issue. | ||
| - Verify factual claims locally before classifying a comment as `MUST-FIX`. | ||
| - If a claim appears wrong, classify it as `SKIPPED` and note briefly why. | ||
| - Preserve the original review comment ID and thread ID when available so the command can reply to the correct place and resolve the correct thread later. |
There was a problem hiding this comment.
The REST API (GET /pulls/{PR}/comments) returns each comment's numeric id but not its GraphQL thread ID. The resolveReviewThread mutation in Step 7 requires a GraphQL node ID (e.g. PRT_kwDO...), not the REST integer.
Without an additional GraphQL query to map comment IDs → thread IDs, this instruction is silently a no-op. Suggest adding a companion GraphQL fetch here (or in Step 3) like:
gh api graphql -f query='query($owner:String!,$name:String!,$number:Int!){
repository(owner:$owner,name:$name){
pullRequest(number:$number){
reviewThreads(first:100){
nodes{
id isResolved
comments(first:1){ nodes{ databaseId } }
}
}
}
}
}' -f owner="$OWNER" -f name="$NAME" -F number="$PR_NUMBER"Then cross-reference databaseId (= REST id) to the thread id node and store both when building the triage list.
| # Known Limitations | ||
|
|
||
| - Rate limiting: GitHub API has rate limits; if you hit them, wait a few minutes | ||
| - Private repos: Requires appropriate `gh` authentication scope |
There was a problem hiding this comment.
The pagination limitation bullet that existed in the previous version was removed here without adding pagination support. Both the REST GET /pulls/{PR}/comments endpoint and the GraphQL reviewThreads(first:100) query are subject to page-size limits on larger PRs. Suggest restoring this note:
| - Private repos: Requires appropriate `gh` authentication scope | |
| - Large PRs: PRs with many comments may require pagination (not currently handled). The GraphQL `reviewThreads` query above uses `first:100`; increase or add cursor-based pagination for PRs with more threads. |
Greptile SummaryThis PR improves the Key changes:
Issues found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant A as Agent
participant GH as GitHub REST API
participant GQL as GitHub GraphQL API
U->>A: /address-review <PR_NUMBER>
A->>GH: GET /repos/{repo}/pulls/{PR}/comments
GH-->>A: comments (id, path, body, line, user, in_reply_to_id)
Note over A: ⚠️ node_id / thread_id NOT fetched
A->>A: Filter replies (in_reply_to_id set)
A->>A: Deduplicate bot comments
A->>A: Triage → MUST-FIX / DISCUSS / SKIPPED
A->>A: TodoWrite (MUST-FIX items only)
A-->>U: Present triage summary
U->>A: "address item 1"
A->>A: Apply code / doc fix
A->>GH: POST /pulls/{PR}/comments/{id}/replies
GH-->>A: reply created
A->>GQL: resolveReviewThread(threadId: ???)
Note over A,GQL: ⚠️ threadId unavailable — mutation will fail
GQL-->>A: thread resolved (if threadId known)
A-->>U: Item addressed & thread resolved
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdb43819c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Use GitHub GraphQL to resolve the thread: | ||
|
|
||
| ```bash | ||
| gh api graphql -f query='mutation($threadId:ID!) { resolveReviewThread(input:{threadId:$threadId}) { thread { id isResolved } } }' -f threadId="<THREAD_ID>" |
There was a problem hiding this comment.
Retrieve thread IDs before resolving review threads
Step 7 requires passing <THREAD_ID> to resolveReviewThread, but the fetch commands in Step 3 still only project comment fields like id, path, body, and line and never collect a thread identifier (or a value that is then mapped to one). In the common /address-review <PR_NUMBER> flow this leaves no thread ID to supply, so addressed comments cannot actually be resolved even though the command now instructs doing so. Add an explicit thread-ID retrieval/mapping step before this mutation.
Useful? React with 👍 / 👎.
| Use GitHub GraphQL to resolve the thread: | ||
|
|
||
| ```bash | ||
| gh api graphql -f query='mutation($threadId:ID!) { resolveReviewThread(input:{threadId:$threadId}) { thread { id isResolved } } }' -f threadId="<THREAD_ID>" |
There was a problem hiding this comment.
Thread IDs never fetched but required for resolution
High Severity
The new thread resolution feature in Step 7 requires a <THREAD_ID> for the resolveReviewThread GraphQL mutation, but Step 3's REST API calls and jq filters never fetch thread IDs. The GitHub REST API for PR review comments doesn't expose review thread IDs at all — they're only available via GraphQL (e.g., querying pullRequest.reviewThreads). Step 4's instruction to "preserve the thread ID when available" is a no-op since the data is never obtained. A GraphQL query to fetch thread IDs (and map them to comment IDs) needs to be added to Step 3.
Additional Locations (2)
## Summary - Add changelog entries for 6 user-visible PRs merged since v16.4.0.rc.6 that were missing from `[Unreleased]` - Update existing #2561 entry to include #2568 contributor credit ### New entries added | Section | PR | Description | |---|---|---| | Added | #2539 | Environment-variable-driven ports in Procfile templates | | Fixed | #2417 | Rspack generator config path fix | | Fixed | #2419 | Precompile hook load-based execution fix | | Fixed | #2577 | `create-react-on-rails-app` validation improvements | | Pro Fixed | #2416 | StreamResponse status fallback fix | | Pro Fixed | #2566 | Empty-string license plan mismatch fix | ### Skipped PRs (not user-visible) Docs (#2406, #2414, #2479, #2494, #2518, #2537, #2544), CI/internal (#2533, #2547, #2555, #2557, #2558, #2564), dependabot (#2387, #2541), dev dependencies (#2559, #2569, #2573). ## Test plan - [ ] Verify changelog formatting matches existing entries - [ ] Verify all user-visible PRs since v16.4.0.rc.6 are covered 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only changelog updates with no runtime or build behavior changes. > > **Overview** > Updates `CHANGELOG.md`’s **[Unreleased]** section to include previously missing user-facing entries: Procfile templates now support env-driven ports, several generator/`bin/dev` precompile-hook and rspack-path fixes are documented, and `create-react-on-rails-app` validation improvements are noted. > > Also adds two Pro fix entries (StreamResponse status fallback and license plan empty-string validation) and updates the existing `bin/dev` precompile-hook entry to credit an additional PR/contributor. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e75d2b5. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 4.6 <[email protected]>


Summary
Fixed five critical issues in the
address-reviewcommand that were preventing proper feedback resolution:Pull Request checklist
Note
Low Risk
Documentation-only changes that adjust internal review workflow guidance; no runtime code paths or data handling are modified.
Overview
Updates the
.claude/commands/address-review.mdworkflow to triage review comments intoMUST-FIX,DISCUSS, andSKIPPED, deduplicate overlaps (including bot feedback), and create todos only forMUST-FIXitems.Adds guidance to preserve comment/thread IDs, reply only after completing user-selected items, and resolve addressed review threads via a GitHub GraphQL
resolveReviewThreadmutation; example output and instructions are updated accordingly.Written by Cursor Bugbot for commit bdb4381. Configure here.
Summary by CodeRabbit