PR Review Resolver
Gathers unresolved PR review feedback and structures it for LLM-driven resolution.
Capabilities
- •Detect Open PR: Finds the PR associated with the current branch
- •Fetch Unresolved Code Comments: Gets review threads that haven't been resolved
- •Include Code Context: Provides diff hunks showing the exact code being discussed
- •Separate General Comments: Distinguishes conversation-tab comments from inline code reviews
- •Structured Output: Returns JSON ready for LLM processing
Usage
Basic Workflow
- •
Run from repository root on your PR branch
bash~/.config/opencode/skills/pr-review-resolver/scripts/pr-review-resolver.sh
- •
Script returns JSON with
- •PR metadata (number, title, URL, state, draft status)
- •Unresolved code comments with file paths, line numbers, and diff context
- •General conversation comments (may include bot feedback)
- •
LLM processes output to
- •Read and understand each comment thread
- •Make targeted code changes to address feedback
Output Format
json
{
"repository": "owner/repo",
"branch": "feature-branch",
"pull_request": {
"number": 42,
"title": "Add new feature",
"url": "https://github.com/owner/repo/pull/42",
"state": "OPEN",
"is_draft": false,
"base_ref": "main"
},
"unresolved_code_comments": {
"count": 2,
"threads": [
{
"thread_id": "PRRT_...",
"file": "src/utils.ts",
"line": 45,
"start_line": 42,
"is_outdated": false,
"diff_side": "RIGHT",
"diff_hunk": "@@ -40,6 +40,10 @@ function helper() {\n const x = 1;\n+ const y = 2;\n+ return x + y;",
"comments": [
{
"author": "reviewer",
"body": "Consider adding error handling here",
"created_at": "2024-01-15T10:30:00Z",
"outdated": false
}
]
}
]
},
"general_comments": {
"count": 1,
"comments": [
{
"id": 123456,
"author": "maintainer",
"body": "Please add tests for the new functionality",
"created_at": "2024-01-15T09:00:00Z",
"html_url": "https://github.com/owner/repo/pull/42#issuecomment-123456",
"is_bot": false
}
]
}
}
Prerequisites
- •Run in a cloned git repository
- •
ghCLI installed and authenticated - •Current branch must have an open pull request
- •Read access to the repository
Addressing Review Feedback
Process
- •
Gather feedback
bashFEEDBACK=$(~/.config/opencode/skill/pr-review-resolver/scripts/pr-review-resolver.sh)
- •
For each unresolved code comment thread:
- •Read the
fileandlineto locate the code - •Review the
diff_hunkfor context - •Read all
commentsin the thread to understand the full discussion - •Make targeted changes to address the feedback
- •Read the
- •
For general comments:
- •These often require broader changes or clarification
- •May include bot feedback (Codecov, linters, etc.)
- •Filter by
is_botif focusing on human feedback
- •
Validate before committing:
- •Re-read the comment to ensure your change addresses it
- •Run tests/linting to verify no regressions
- •Check if the feedback is still valid (may be outdated)
Skip Invalid Feedback
Not all feedback requires action:
- •Outdated comments: Code may have changed since the comment was made
- •Already addressed: Check if a later commit resolved the issue
- •Incorrect feedback: Reviewers can be wrong; validate before changing
- •Style preferences: Discuss rather than blindly implement
Error Handling
No PR found: Script exits cleanly with error message and branch info
json
{
"error": "No open pull request found for current branch",
"branch": "feature-branch",
"repository": "owner/repo"
}
Common issues:
- •
gh auth status- Verify authentication - •
git remote -v- Confirm origin points to GitHub - •
gh pr list- Check if PR exists but is closed/merged
Tips
- •Focus on unresolved threads first (
unresolved_code_comments) - •Use
diff_hunkto understand the exact code context without reading the file - •Thread comments are ordered chronologically - read all to understand the discussion
- •Bot comments in
general_commentsmay contain actionable CI feedback