Review and respond to GitHub Copilot review comments on a pull request. Loops until Copilot has no new comments.
$ARGUMENTS- PR number or branch name (optional, defaults to current branch)
-
Identify the PR
- If PR number provided, use directly
- Otherwise find PR for current branch via
gh pr view
-
Fetch all review comments
gh api repos/chenders/deadonfilm/pulls/{PR}/comments | jq '.[] | {id, body, path, line}' -
Check for new comments — If there are no new unaddressed comments since the last round, the loop is done. Report the final status and stop.
-
Analyze each new comment
- Validity: Is the suggestion technically correct?
- Value: Would it improve code quality?
- Scope: Is it within the scope of this PR?
-
Categorize: Will implement / Won't implement / Needs discussion
IMPORTANT: Never defer work or create issues without explicit user approval. If a suggestion is valid but out of scope, attempt to implement it if reasonably small. If too large, ask the user.
-
Implement accepted suggestions
- Make changes
- Run tests:
npm test && cd server && npm test - Run quality checks:
npm run lint && npm run type-check - Commit: "Address Copilot review feedback"
- Push changes
-
Reply to each comment
gh api -X POST repos/chenders/deadonfilm/pulls/{PR}/comments/{COMMENT_ID}/replies -f body="Fixed in $(git rev-parse --short HEAD). Explanation."- If implemented: Reference commit SHA and explain
- If not implemented: Explain why
- If needs discussion: Ask clarifying questions
-
Resolve implemented threads (use PRRT* thread IDs, not PRRC* comment IDs)
# Get thread IDs gh api graphql -f query='query { repository(owner: "chenders", name: "deadonfilm") { pullRequest(number: {PR}) { reviewThreads(first: 50) { nodes { id isResolved comments(first: 1) { nodes { body } } } } } } }' # Resolve gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "PRRT_..."}) { thread { isResolved } } }'
Rules:
- Resolve threads where you implemented the fix
- Do NOT resolve threads where you declined
-
Re-request Copilot review:
gh api repos/chenders/deadonfilm/pulls/{PR}/requested_reviewers -X POST -f 'reviewers[]=copilot-pull-request-reviewer[bot]' -
Wait for the new review — Capture baseline review count, then poll until it increases from a Copilot review:
# Baseline: count Copilot reviews before re-request gh api repos/chenders/deadonfilm/pulls/{PR}/reviews --jq '[.[] | select(.user.login == "copilot-pull-request-reviewer[bot]")] | length'
Poll every 15 seconds using the same filter. Timeout after 10 minutes.
-
Loop back to step 2 — Fetch comments again and check for new ones.
The loop ends when:
- Copilot's latest review has no new comments (clean review), OR
- The poll in step 10 times out (report this and stop)
When complete, report a summary: total rounds, comments addressed, comments declined.
- Never dismiss suggestions without explanation
- Never defer work without explicit user approval
- Thread IDs (PRRT*) are NOT the same as comment IDs (PRRC*)
- Track comment IDs across rounds to distinguish new comments from previously addressed ones
- Copilot comments come from user login
Copilot, but the reviewer bot iscopilot-pull-request-reviewer[bot]— filter by both when needed