| name | address-review |
| description | Address all code review comments on a PR. Assesses each comment, replies, reacts, and resolves threads. |
| argument-hint | ["pr-number"] |
| allowed-tools | Bash(gh *), Bash(git add *), Bash(git commit *), Bash(git push *), Bash(dotnet build *), Read, Grep, Glob, Edit, Write, WebFetch |
Address Code Review Comments
You are addressing code review comments on PR #$ARGUMENTS.
Step 0: Wait for reviews to arrive
Bot reviewers (Copilot, Sentry, Codex, etc.) take time to post their comments after a commit is pushed. Before processing, wait until reviews have landed:
- Check the timestamp of the latest commit on the PR:
gh pr view $ARGUMENTS --json commits --jq '.commits[-1].committedDate'
- If less than 5 minutes have passed since that commit, wait and re-check for new comments periodically (every 30–60 seconds).
- Once 5 minutes have passed since the last commit with no new comments arriving, proceed to Step 1.
This ensures you don't start processing before all reviewers have had a chance to comment.
Step 1: Gather context
Fetch the PR details and all review comments:
gh pr view $ARGUMENTS --json title,body,headRefName,baseRefName
gh api repos/{owner}/{repo}/pulls/$ARGUMENTS/comments --paginate
gh api repos/{owner}/{repo}/pulls/$ARGUMENTS/reviews --paginate
Also fetch the current diff so you understand the changes being reviewed:
gh pr diff $ARGUMENTS
Step 2: Assess each comment
For every review comment (from bots or humans), evaluate it:
- Read the comment carefully, including any suggested code changes.
- Read the relevant source file(s) at the lines being discussed to understand the full context.
- Determine validity:
- Is the feedback correct and actionable?
- Is it a false positive from a bot?
- Is it a style preference vs a real issue?
- Is it already addressed or outdated?
Step 3: Act on each comment
For each comment, do ALL of the following:
A. If the comment is valid and actionable:
- Make the code change in the local working tree.
- React with thumbs-up (+1) to acknowledge:
gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions -f content='+1'
- Reply explaining what you changed:
gh api repos/{owner}/{repo}/pulls/$ARGUMENTS/comments -f body="..." -F in_reply_to={comment_id}
- Resolve the thread:
gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_NODE_ID"}) { thread { isResolved } } }'
B. If the comment is not valid or not actionable:
- React with thumbs-down (-1):
gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions -f content='-1'
- Reply explaining why the feedback was rejected with a clear, respectful rationale:
gh api repos/{owner}/{repo}/pulls/$ARGUMENTS/comments -f body="..." -F in_reply_to={comment_id}
- Resolve the thread:
gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_NODE_ID"}) { thread { isResolved } } }'
C. If you're unsure whether the comment is valid:
- Reply with your analysis and conclusion, explaining what you found and why you're uncertain.
- Do NOT resolve the thread — leave it open for the reviewer to follow up.
Step 4: Commit and push (if changes were made)
If any code changes were made:
- Stage only the files you changed.
- Commit with a message like:
address review: <brief summary of changes>
- Push to the PR branch.
Step 5: Summary
After processing all comments, post a summary as a PR comment and also display it to the user:
gh pr comment $ARGUMENTS --body "$(cat <<'EOF'
## Review comments addressed
| # | Comment | Author | Verdict | Action |
|---|---------|--------|---------|--------|
| 1 | ... | ... | ... | ... |
EOF
)"
Important rules