gh-pr-review Extension for Review Thread Management

lesson tools active tools/gh-pr-review-extension.md View on GitHub

gh-pr-review Extension for Review Thread Management

Rule

Use the gh-pr-review extension to manage PR review threads: comment + resolve when the issue is resolved (pushed fix OR explained why it's not an issue), comment only when seeking clarification or deferring.

Context

When working on PRs with review comments that need responses or fixes.

Installation

gh extension install agynio/gh-pr-review

Detection

Observable signals you need this tool:

Pattern

Complete workflow for addressing review feedback efficiently:

Step 1: List unresolved threads (compact output)

# Using PR URL (auto-detects repo)
gh pr-review threads list https://github.com/owner/repo/pull/123 --unresolved

# Or using PR number (requires --repo)
gh pr-review threads list --repo owner/repo 123 --unresolved
# Output: [{"threadId":"PRRT_xyz...","isResolved":false,"path":"file.py","line":50}]

Note: When using numeric PR selectors, --repo owner/repo is required. PR URLs work without it.

Step 2: Fix issues and commit

# Make code changes, then commit
git commit -m "fix: address review feedback"
git push

Step 3: Reply to threads + resolve (single toolcall!)

# Reply to threads using the extension (cleaner than gh api)
# Resolve the threads with pushed fixes
# Use --repo owner/repo with numeric PRs, or use PR URLs directly
gh pr-review comments reply --repo owner/repo 123 --thread-id "PRRT_thread1" --body "✅ Fixed in commit abc123"
gh pr-review threads resolve --repo owner/repo 123 --thread-id "PRRT_thread1"
gh pr-review comments reply --repo owner/repo 123 --thread-id "PRRT_thread2" --body "This is intentional - the API expects nullable here for backwards compat"
gh pr-review threads resolve --repo owner/repo 123 --thread-id "PRRT_thread2"
# Thread2 resolved: no code change, but explained why current behavior is correct

# If you need clarification, comment only (no resolve):
gh pr-review comments reply --repo owner/repo 123 --thread-id "PRRT_thread3" --body "Could you share an example of where this would cause issues?"
# Thread3 stays open - waiting for reviewer response

# Verify
gh pr-review threads list --repo owner/repo 123 --unresolved
# Should return only thread3 (pending clarification)

Why use gh pr-review comments reply? Cleaner than raw gh api - the extension handles GraphQL thread IDs natively and produces minimal output.

Key commands:

Anti-Patterns

Don't resolve without a fix:

# ❌ WRONG: Resolve without pushing a fix
gh pr-review comments reply <pr> --thread-id "PRRT_xyz" --body "Good point, will consider"
gh pr-review threads resolve <pr> --thread-id "PRRT_xyz"  # NO! Didn't fix anything

# ❌ WRONG: Resolve without any reply
gh pr-review threads resolve <pr> --thread-id "PRRT_xyz"

Correct patterns:

# ✅ CORRECT: Pushed fix → comment + resolve
git commit -m "fix: address review feedback"
git push
gh pr-review comments reply <pr> --thread-id "PRRT_xyz" --body "✅ Fixed in abc123"
gh pr-review threads resolve <pr> --thread-id "PRRT_xyz"

# ✅ CORRECT: Explained as non-issue → comment + resolve
gh pr-review comments reply <pr> --thread-id "PRRT_abc" --body "This is intentional for backwards compat, see design doc"
gh pr-review threads resolve <pr> --thread-id "PRRT_abc"

# ✅ CORRECT: Need clarification → comment only, NO resolve
gh pr-review comments reply <pr> --thread-id "PRRT_def" --body "Could you elaborate on the expected behavior here?"
# Thread stays open - waiting for response

Outcome

Following this pattern results in:

Related

Origin

2026-01-10 ErikBjare/bob#242: Erik introduced the gh-pr-review extension for resolving review comments/threads programmatically.

Match Keywords

resolve review thread resolve review comment review threads gh-pr-review close conversation thread mark thread resolved