Skip to content

Sync address-review command with upstream PR #14#1019

Merged
justin808 merged 1 commit intomainfrom
jg/address-review-triage
Mar 19, 2026
Merged

Sync address-review command with upstream PR #14#1019
justin808 merged 1 commit intomainfrom
jg/address-review-triage

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Mar 19, 2026

Syncs the address-review command with improvements from shakacode/claude-code-commands-skills-agents#14.

Key changes:

  • Add node_id fields to all comment fetches for thread resolution
  • Add jq -s (slurp) to paginated gh api calls for proper multi-page aggregation
  • Add GraphQL query to fetch review thread metadata and thread_id
  • Add filtering for already-resolved threads
  • Document review summary body reply path via general PR comments
  • Document GraphQL pagination limitation for review threads with >100 comments

Note

Low Risk
Low risk documentation-only changes, but they alter the prescribed GitHub API/GraphQL workflows for fetching/replying/resolving review threads and could affect anyone automating this process if followed incorrectly.

Overview
Updates the address-review command instructions to fetch richer PR feedback data and better support thread resolution. It adds node_id and proper --paginate aggregation (jq -s) to comment fetches, introduces a GraphQL lookup to map comments to thread_id/isResolved, and documents skipping already-resolved threads.

Clarifies reply behavior by distinguishing inline review comments (reply via /replies) from review summary bodies (reply via general PR issue comments), tightens triage/task formatting guidance, and notes the GraphQL inner-pagination limitation for threads with >100 comments.

Written by Cursor Bugbot for commit 614a78e. This will update automatically on new commits. Configure here.

…#14

Updates the address-review command with improvements from upstream:
- Add $ARGUMENTS placement to Step 2
- Add node_id fields to comment fetches for thread resolution
- Add jq -s (slurp) to paginated gh api calls for proper aggregation
- Add GraphQL query to fetch review thread metadata and thread_id
- Add filtering for already-resolved threads
- Document review summary body reply path via general PR comments
- Document GraphQL pagination limitation for review threads

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 19, 2026

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 53 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97dd77b8-f6fc-4c45-9eb7-c99248d9f9d2

📥 Commits

Reviewing files that changed from the base of the PR and between e83a044 and 614a78e.

📒 Files selected for processing (1)
  • .claude/commands/address-review.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/address-review-triage
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 19, 2026

Greptile Summary

This PR syncs the address-review slash command with upstream improvements, adding multi-page API pagination support (jq -s), node_id fields for thread resolution, a GraphQL query to fetch and filter already-resolved review threads, and several UX clarifications (single sequential numbering across triage categories, explicit DISCUSS item handling, correct reply path for review summary bodies).

Key changes:

  • --paginate + jq -s '[.[].[] | ...]' pattern correctly aggregates multi-page REST responses
  • GraphQL query with --paginate correctly uses a nullable $endCursor:String variable and pageInfo { hasNextPage endCursor } for outer thread pagination
  • -F pr={PR_NUMBER} (capital -F) correctly passes the PR number as an integer matching the $pr:Int! GraphQL type
  • Removal of the incorrect "standalone review comment" POST /pulls/{PR_NUMBER}/comments path in favor of the /replies endpoint (which works for all existing comments) is a correctness improvement
  • The activeForm field was removed from Step 5 task-creation instructions; since TodoWrite requires this field, restoring explicit guidance would reduce the risk of a malformed tool call
  • The known comments(first:100) inner-pagination limitation is now documented in Known Limitations

Confidence Score: 4/5

  • Safe to merge — all shell commands and jq filters are correct; one minor documentation gap around activeForm in Step 5.
  • The pagination fix (jq -s), GraphQL thread-resolution query, and resolved-thread filtering are all technically sound. The only concern is the removal of activeForm guidance from the TodoWrite instructions, which could lead to malformed tool calls in edge cases but is unlikely to cause failures in practice given Claude's tool-schema awareness.
  • No files require special attention beyond the activeForm note in .claude/commands/address-review.md.

Important Files Changed

Filename Overview
.claude/commands/address-review.md Improved Claude slash command with pagination fixes (jq -s), node_id fields, GraphQL thread-resolution query, resolved-thread filtering, and better UX (single sequential numbering, DISCUSS item handling). One minor concern: activeForm guidance removed from Step 5, risking malformed TodoWrite calls.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A(["/address-review input"]) --> B["Step 1: Detect repo\ngh repo view"]
    B --> C["Step 2: Parse input\nPR number / URL / review ID"]
    C --> D{"Input type?"}
    D -->|issuecomment-ID| E["GET /issues/comments/ID"]
    D -->|pullrequestreview-ID| F["GET /pulls/PR/reviews/ID\nGET /pulls/PR/reviews/ID/comments\n--paginate + jq -s"]
    D -->|PR number only| G["GET /pulls/PR/comments\n--paginate + jq -s\nGET /issues/PR/comments\n--paginate + jq -s"]
    F --> H
    G --> H["GraphQL: fetch reviewThreads\nwith node_id + isResolved\n--paginate + jq -s"]
    H --> I["Filter:\n- Skip resolved threads (NEW)\n- Skip in_reply_to_id replies\n- Deduplicate bots"]
    I --> J["Step 4: Triage\nMUST-FIX / DISCUSS / SKIPPED"]
    J --> K["Step 5: TodoWrite\nMUST-FIX items only"]
    K --> L["Step 6: Present triage\nSingle sequential numbering (NEW)\nWait for user selection"]
    L --> M{"User selects items"}
    M -->|"MUST-FIX or DISCUSS"| N["Address in code/tests/docs"]
    M -->|"SKIPPED rationale"| O["Post rationale reply only"]
    N --> P{"Comment type?"}
    P -->|"Issue comment"| Q["POST /issues/PR/comments"]
    P -->|"Review comment"| R["POST /pulls/PR/comments/ID/replies"]
    P -->|"Review summary body (NEW)"| S["POST /issues/PR/comments\nas general PR comment"]
    Q --> T{"Thread resolvable?"}
    R --> T
    S --> T
    T -->|"Yes + thread_id available"| U["GraphQL: resolveReviewThread"]
    T -->|No| V([Done])
    U --> V
Loading

Last reviewed commit: "Sync address-review ..."

Comment on lines +107 to +113
Create a task list with TodoWrite containing **only the `MUST-FIX` items**:

- One todo per must-fix comment or deduplicated issue
- For file-specific comments: `"{file}:{line} - {comment_summary} (@{username})"` (content)
- For general comments: Parse the comment body and extract the must-fix action
- Format activeForm: `"Addressing {brief description}"`
- All todos should start with status: `"pending"`
- One task per must-fix comment or deduplicated issue
- Subject: `"{file}:{line} - {comment_summary} (@{username})"`
- For general comments: Parse the comment body and extract the must-fix action as the subject
- Description: Include the full review comment text and any relevant context
- All tasks should start with status: `"pending"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 activeForm field missing from task instructions

The previous version of Step 5 explicitly instructed the LLM to provide activeForm: "Addressing {brief description}" when calling TodoWrite. The TodoWrite tool schema requires three fields: content, activeForm, and status. The new instructions introduce "Subject" and "Description" terminology (neither of which maps directly to the tool's schema) and drop the activeForm guidance entirely.

While Claude may infer activeForm from its knowledge of the tool, omitting explicit guidance increases the chance of a malformed TodoWrite call if the executing model is less familiar with the schema. Consider restoring the activeForm guidance:

Suggested change
Create a task list with TodoWrite containing **only the `MUST-FIX` items**:
- One todo per must-fix comment or deduplicated issue
- For file-specific comments: `"{file}:{line} - {comment_summary} (@{username})"` (content)
- For general comments: Parse the comment body and extract the must-fix action
- Format activeForm: `"Addressing {brief description}"`
- All todos should start with status: `"pending"`
- One task per must-fix comment or deduplicated issue
- Subject: `"{file}:{line} - {comment_summary} (@{username})"`
- For general comments: Parse the comment body and extract the must-fix action as the subject
- Description: Include the full review comment text and any relevant context
- All tasks should start with status: `"pending"`
Create a task list with TodoWrite containing **only the `MUST-FIX` items**:
- One task per must-fix comment or deduplicated issue
- Subject (`content`): `"{file}:{line} - {comment_summary} (@{username})"`
- For general comments: Parse the comment body and extract the must-fix action as the subject
- Active form (`activeForm`): `"Addressing {brief description}"`
- Description: Include the full review comment text and any relevant context
- All tasks should start with status: `"pending"`

```bash
OWNER=${REPO%/*}
NAME=${REPO#*/}
gh api graphql --paginate -f owner="${OWNER}" -f name="${NAME}" -F pr={PR_NUMBER} -f query='query($owner:String!, $name:String!, $pr:Int!, $endCursor:String) { repository(owner:$owner, name:$name) { pullRequest(number:$pr) { reviewThreads(first:100, after:$endCursor) { nodes { id isResolved comments(first:100) { nodes { id databaseId } } } pageInfo { hasNextPage endCursor } } } } }' | jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[] | {thread_id: .id, is_resolved: .isResolved, comments: [.comments.nodes[] | {node_id: .id, id: .databaseId}]}]'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GraphQL query is a very long single line that's hard to read and maintain. Consider splitting it across lines for clarity (the shell still treats it as one command):

Suggested change
gh api graphql --paginate -f owner="${OWNER}" -f name="${NAME}" -F pr={PR_NUMBER} -f query='query($owner:String!, $name:String!, $pr:Int!, $endCursor:String) { repository(owner:$owner, name:$name) { pullRequest(number:$pr) { reviewThreads(first:100, after:$endCursor) { nodes { id isResolved comments(first:100) { nodes { id databaseId } } } pageInfo { hasNextPage endCursor } } } } }' | jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[] | {thread_id: .id, is_resolved: .isResolved, comments: [.comments.nodes[] | {node_id: .id, id: .databaseId}]}]'
gh api graphql --paginate \
-f owner="${OWNER}" -f name="${NAME}" -F pr={PR_NUMBER} \
-f query='query($owner:String!, $name:String!, $pr:Int!, $endCursor:String) {
repository(owner:$owner, name:$name) {
pullRequest(number:$pr) {
reviewThreads(first:100, after:$endCursor) {
nodes { id isResolved comments(first:100) { nodes { id databaseId } } }
pageInfo { hasNextPage endCursor }
}
}
}
}' | jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[] |
{thread_id: .id, is_resolved: .isResolved,
comments: [.comments.nodes[] | {node_id: .id, id: .databaseId}]}]'

Also worth noting: gh api graphql --paginate looks for pageInfo.endCursor at the top level of the data response. The current query nests pageInfo inside reviewThreads, which is the correct location for gh's auto-pagination — just flagging it in case someone refactors the query structure later.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 19, 2026

Overall this is a solid improvement. See follow-up comments for specifics.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 19, 2026

Issue 1: node_id missing from single-comment fetch (Step 3, issuecomment path)

The issuecomment fetch path omits node_id, while every other comment-fetching path in Step 3 now includes it. Issue comments do not belong to review threads so this will not break thread resolution in practice, but the inconsistency is confusing. Suggest adding node_id: .node_id here for uniformity.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 19, 2026

Issue 2: Removal of standalone review comment creation path

The old section for standalone review comments documented how to create a new anchored comment on a line (using commit_id, path, line, side). This is removed in favour of using the /replies endpoint for all existing review comments. Using /replies for existing threads is correct, but if a thread ID is unavailable or a comment has been deleted there is no longer a documented fallback. Worth a short note in Known Limitations suggesting the general PR comment endpoint as a fallback.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 614a78e0af

ℹ️ 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".

Comment on lines +56 to +64
**If only PR number is provided (fetch all PR comments):**

```bash
gh api repos/${REPO}/pulls/{PR_NUMBER}/comments | jq '[.[] | {id: .id, path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'
# Inline code review comments
gh api --paginate repos/${REPO}/pulls/{PR_NUMBER}/comments | jq -s '[.[].[] | {id: .id, node_id: .node_id, type: "review", path: .path, body: .body, line: .line, start_line: .start_line, user: .user.login, in_reply_to_id: .in_reply_to_id}]'

# General PR discussion comments (not tied to specific lines)
gh api --paginate repos/${REPO}/issues/{PR_NUMBER}/comments | jq -s '[.[].[] | {id: .id, node_id: .node_id, type: "issue", body: .body, user: .user.login, html_url: .html_url}]'
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fetch review bodies in the plain-PR path

When the user invokes /address-review 12345 or passes a plain PR URL, this branch only fetches inline review comments and issue comments. Review summary bodies live on /pulls/{PR_NUMBER}/reviews, so any actionable summary-only feedback never makes it into triage or the todo list unless the user supplies a #pullrequestreview-... URL. That makes the new Step 7 handling for review summaries unreachable in the default flow.

Useful? React with 👍 / 👎.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Mar 19, 2026

Issue 3: GraphQL inner pagination note is slightly incomplete. The Known Limitations note says comments(first:100) is hardcoded and may truncate threads with more than 100 comments. The reviewThreads(first:100) per page is also hardcoded. Very rare in practice, but both limits are worth mentioning. Minor nit: the jq -s slurp pattern for aggregating paginated REST results is a correct fix. A short inline comment explaining why jq -s is needed would help future readers (--paginate emits one JSON array per page; -s slurps them so .[].[] can flatten across pages). Overall: the core logic (GraphQL thread metadata, is_resolved filtering, ARGUMENTS variable wiring) is correct and well thought out. The databaseId/node_id mapping between GraphQL and REST is handled properly. See the separate inline comment for a readability suggestion on the long GraphQL query.

@justin808 justin808 merged commit fc0f9a2 into main Mar 19, 2026
10 checks passed
@justin808 justin808 deleted the jg/address-review-triage branch March 19, 2026 00:48
justin808 added a commit that referenced this pull request Apr 23, 2026
## Summary

Brings over [PR
#16](shakacode/claude-code-commands-skills-agents#16)
from the shared commands repo so non-Claude assistants (Codex, GPT,
etc.) can run the same `/address-review` workflow.

- Add `prompts/address-review.md` — shared prompt template that mirrors
the Claude `/address-review` triage/reply/resolve flow and falls back
cleanly when terminal `gh` access is unavailable.
- Add root `AGENTS.md` (adapted for Shakapacker's layout) that points
non-Claude tools at `prompts/address-review.md` when asked to address PR
review comments.

The Claude command at `.claude/commands/address-review.md` already
matches upstream HEAD (synced previously in #1019) and is unchanged
here.

## Test plan

- [ ] Verify `prompts/address-review.md` is byte-identical to the
upstream template
- [ ] Verify `AGENTS.md` is discoverable by Codex CLI and points at the
shared prompt
- [ ] Confirm no changes to existing
`.claude/commands/address-review.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: adds a standalone prompt markdown file only, with no runtime
code changes.
> 
> **Overview**
> Adds `prompts/address-review.md`, a reusable prompt template that
instructs coding assistants how to fetch PR review/issue comments via
`gh`, filter unresolved top-level feedback, triage into
`MUST-FIX`/`DISCUSS`/`SKIPPED`, then (after user selection) reply and
optionally resolve threads.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6758682. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant