feat(pr-review): add conversation resolution to PR workflow#233
Conversation
Add capability to resolve PR review threads via GraphQL API, enabling PRs to be merged when branch protection requires all conversations resolved. Changes: - Add Resolve-PRReviewThread.ps1 script with single/bulk resolution modes - Add 43 Pester tests covering syntax, parameters, GraphQL, error handling - Update pr-comment-responder.md with Step 6.4 (resolve thread) and Step 8.2 - Update pr-review.md error recovery for safer parallel worktree handling The complete workflow is now: Code fix → Reply → Resolve (all three required) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Spec-to-Implementation ValidationWarning No spec references found This PR does not reference any specifications (REQ-, DESIGN-, TASK-*, or linked issues). How to add spec referencesAdd spec references to your PR description to enable traceability:
Spec Requirement by PR Type:
See PR template for full guidance. Powered by AI Spec Validator - Validation skipped - no specs found |
AI Quality Gate ReviewWarning WalkthroughThis PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:
Review Summary
Analyst Review DetailsNow let me check the modified Let me examine existing scripts in this directory for pattern comparison: Let me also check one of the existing scripts to compare patterns: I have enough context. Let me compile the analysis. Analysis: PR feat(pr-review): add conversation resolution to PR workflowCode Quality Score
Overall: 4/5 Impact Assessment
Findings
Recommendations
VerdictArchitect Review DetailsDesign Quality Assessment
Overall Design Score: 4.4/5 Architectural Concerns
Breaking Change Assessment
Technical Debt Analysis
ADR Assessment
Recommendations
VerdictQA Review DetailsBased on my code review, I'll now provide the QA assessment. Test Report: PR Review Thread Resolution FeatureSummary
StatusQA: WARN Test Coverage Assessment
Quality Concerns
Regression Risk Assessment
Code Quality Checks
Test Quality AnalysisStrengths:
Gaps:
VERDICT: WARNMESSAGE: Static tests adequate for syntax validation; missing mocked integration tests for runtime behavior. EVIDENCE:
Recommendations
Roadmap Review DetailsStrategic Alignment Assessment
Feature Completeness
Impact Analysis
Concerns
Recommendations
VerdictSecurity Review DetailsSecurity Review: PR Review Thread Resolution FeatureFindings
AnalysisGraphQL Injection Risk (Medium): The
Input Validation (Low): Adding a regex check for Error Disclosure (Low): Raw API responses in warnings could expose internal state. In a CI/CD context, logs may be publicly visible. No Secrets Detected: No hardcoded credentials, API keys, or tokens found. Dependency Security: Uses only Authentication: Relies on existing Recommendations
if ($ThreadId -notmatch '^PRRT_[A-Za-z0-9_-]+$') {
throw "Invalid ThreadId format. Expected PRRT_xxx"
}
Write-Warning "Failed to resolve thread ${Id}: API error"
VerdictDevOps Review DetailsPipeline Impact Assessment
CI/CD Quality Checks
Findings
Template Assessment
Automation Opportunities
Recommendations
VerdictRun Details
Powered by AI Quality Gate - View Workflow |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature for resolving PR review threads, which is crucial for workflows with branch protection rules. The new PowerShell script is well-structured and accompanied by a comprehensive set of Pester tests and updated documentation. My review focuses on improving the script's robustness and adherence to the repository's PowerShell style guide. I've suggested using try/catch blocks for safer JSON parsing, adding defensive checks for handling potential edge cases during bulk operations, and refining function names to better align with PowerShell conventions.
There was a problem hiding this comment.
Pull request overview
This PR adds PR review thread resolution capability to enable merging PRs when branch protection requires all conversations to be resolved. The implementation uses GitHub's GraphQL API to resolve threads individually or in bulk, integrating into the existing PR comment workflow.
Key changes:
- New PowerShell script with single/bulk thread resolution modes and comprehensive error handling
- 43 Pester tests covering syntax validation, GraphQL operations, and error scenarios
- Updated PR comment responder workflow with mandatory thread resolution steps
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.claude/skills/github/scripts/pr/Resolve-PRReviewThread.ps1 |
Implements GraphQL-based thread resolution with single thread and bulk mode support |
.claude/skills/github/tests/Resolve-PRReviewThread.Tests.ps1 |
Comprehensive test suite with 43 tests covering syntax, parameters, GraphQL ops, and error handling |
src/claude/pr-comment-responder.md |
Adds Step 6.4 (resolve thread after reply) and Step 8.2 (verify all threads resolved before completion) |
.claude/commands/pr-review.md |
Enhanced error recovery for push rejections to handle parallel worktree scenarios more safely |
|
Warning Rate limit exceeded@rjmurillo-bot has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 22 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (7)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds a PowerShell tool to resolve GitHub PR review threads via GraphQL, a comprehensive Pester test suite for that tool, updates PR responder docs to require resolving conversation threads, and refines push-rejection recovery guidance to detect concurrent updates before force-pushing. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Script as Resolve-PRReviewThread.ps1
participant gh as gh CLI
participant API as GitHub GraphQL
User->>Script: Run script (-All + PR) or (-ThreadId)
Script->>gh: gh repo view (get owner/name)
gh-->>Script: repo metadata
Script->>gh: gh api graphql (query PR reviewThreads where isResolved=false)
gh->>API: GraphQL query
API-->>gh: unresolved threads JSON
gh-->>Script: JSON list
loop per unresolved thread
Script->>gh: gh api graphql (resolveReviewThread mutation with thread ID)
gh->>API: GraphQL mutation
alt mutation success
API-->>gh: success result
gh-->>Script: success
Script->>Script: increment Resolved
else mutation failure
API-->>gh: error
gh-->>Script: failure
Script->>Script: increment Failed
end
end
Script->>User: Output JSON summary (TotalUnresolved, Resolved, Failed, Success)
Script->>User: Exit code 0 if all resolved, 1 if any failed
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related issues
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Comment |
Address all 10 review comments from gemini-code-assist and copilot: - Rename Resolve-SingleThread to Resolve-ReviewThread (verb-noun pattern) - Rename Get-UnresolvedThreads to Get-UnresolvedReviewThreads - Add try/catch for JSON parsing in Resolve-ReviewThread function - Add try/catch for GraphQL response parsing in Get-UnresolvedReviewThreads - Add null checks for thread comment data to prevent index errors - Remove unused isOutdated and totalCount fields from GraphQL query - Use idiomatic empty collection check (-not $collection) - Add documentation note about 100 thread pagination limit All 43 Pester tests pass with the renamed functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merged Phase 8 verification steps from both branches: - Phase 8.1: Comment Status Verification - Phase 8.2: Verify Conversation Resolution (new - thread resolution) - Phase 8.3: Re-check for New Comments (from main) - Phase 8.4: QA Gate Verification (from main) - Phase 8.5: Completion Criteria Checklist (from main) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…r exceptions Addresses PR review comments from @rjmurillo: - Ported Step 6.4 (Resolve Conversation Thread) to templates - Added Exception clause: do NOT auto-resolve for human reviewers - Added Phase 8.2 (Verify Conversation Resolution) to templates - Added full Phase 8 sub-phases (8.1-8.5) to templates - Ran Generate-Agents.ps1 to regenerate platform agents Changes also include the WONTFIX status in comment counting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract learnings from PR #235 (Get-PRReviewComments dual endpoint fix) and create 5 atomic skillbook entries with 95-97% atomicity scores: Skills Created: - Skill-GH-API-002 (97%, 9/10) - GitHub dual comment endpoints - Skill-Diagnosis-001 (95%, 8/10) - Evidence-based diagnosis - Skill-PowerShell-006 (96%, 9/10) - Backward-compatible switch params - Skill-API-Design-001 (97%, 8/10) - Type discriminator fields - Skill-Test-Pester-006 (96%, 9/10) - Static analysis tests Key Patterns: 1. MUST query both /pulls/{n}/comments AND /issues/{n}/comments 2. Compare API counts against real PR data to prove gaps 3. Use switch parameters with default false for backward compatibility 4. Add discriminator field when merging multiple API sources 5. Use regex-based tests to validate scripts without API calls Evidence: PR #235, PR #233 (26 review + 3 issue = 29 total comments) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ts (#235) * feat(github-skills): add issue comments support to Get-PRReviewComments Add -IncludeIssueComments switch to fetch top-level PR comments (issue comments) in addition to code-level review comments. Problem: The /pr-review workflow was missing issue comments like AI Quality Gate reviews, spec validation, and CodeRabbit summaries. These are posted via /issues/{n}/comments API, not /pulls/{n}/comments. Solution: - Add -IncludeIssueComments switch parameter - Fetch from /issues/{n}/comments when switch is set - Add CommentType field ("Review" or "Issue") to distinguish types - Add ReviewCommentCount and IssueCommentCount to output - Combine and sort all comments by CreatedAt Test: 49 new tests covering syntax, parameters, API endpoints, comment type handling, and output structure. Example: Get-PRReviewComments.ps1 -PullRequest 233 -IncludeIssueComments # Returns 26 review + 3 issue = 29 total comments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update documentation for -IncludeIssueComments feature Updates documentation to reflect new functionality in Get-PRReviewComments.ps1: - SKILL.md: Updated structure and quick reference for issue comments - pr-comment-responder.md: Updated scripts table, Phase 0, Steps 1.3/1.4, Phase 8.2 - pr-comment-responder.shared.md: Updated GitHub skill table The -IncludeIssueComments switch enables fetching of issue comments (AI Quality Gate, CodeRabbit summaries) that were previously missed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(pr-235): address PR review comments - Fix null handling for empty issue comments (wrap foreach in @()) - Add pluralization logic for comment counts in output message - Remove redundant @() operator on line 114 Addresses review comments from Copilot and gemini-code-assist[bot] Comment-IDs: 2639441218, 2639441176, 2639434849 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: regenerate pr-comment-responder agent files Update generated agent files for copilot-cli and vscode platforms after reviewing PR #235 comments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: wrap review comments foreach in @() for consistent array behavior Addresses Copilot review comment: The foreach loop for processing review comments now uses @() wrapper like issue comments processing, ensuring consistent array behavior when is null or empty. Comment-ID: 2639613878 * feat(skills): extract 5 learnings from PR #235 into skillbook Extract learnings from PR #235 (Get-PRReviewComments dual endpoint fix) and create 5 atomic skillbook entries with 95-97% atomicity scores: Skills Created: - Skill-GH-API-002 (97%, 9/10) - GitHub dual comment endpoints - Skill-Diagnosis-001 (95%, 8/10) - Evidence-based diagnosis - Skill-PowerShell-006 (96%, 9/10) - Backward-compatible switch params - Skill-API-Design-001 (97%, 8/10) - Type discriminator fields - Skill-Test-Pester-006 (96%, 9/10) - Static analysis tests Key Patterns: 1. MUST query both /pulls/{n}/comments AND /issues/{n}/comments 2. Compare API counts against real PR data to prove gaps 3. Use switch parameters with default false for backward compatibility 4. Add discriminator field when merging multiple API sources 5. Use regex-based tests to validate scripts without API calls Evidence: PR #235, PR #233 (26 review + 3 issue = 29 total comments) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): record commit SHA 29fd93b in session log 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): update session log to match canonical checklist format Update Session End checklist to match SESSION-PROTOCOL.md template with Req|Step|Status|Evidence columns required by Validate-SessionEnd.ps1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): exact match canonical checklist template Fix Step column text to exactly match SESSION-PROTOCOL.md line 309: 'Commit all changes (including .serena/memories)' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): mark QA as complete (N/A for skillbook updates) Skillbook updates only modify .serena/memories/ documentation files and do not require QA validation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(qa): add QA report for skillbook update Create QA report explaining that skillbook updates (documentation only) do not require functional QA validation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): update commit SHA to 2a73216 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: commit remaining PR #235 agent artifacts and memory updates Add PR #235 agent artifacts (critique, devops, qa) and finalize skill memory updates for session 01. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): final commit SHA ddeba58 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs(session): record validator PASS with commit 64b31ae Session End validation passed successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: Port pr-comment-responder changes and add PowerShell schema ADR Addresses PR review comments from @rjmurillo: 1. Port changes from src/claude/pr-comment-responder.md to templates/agents/pr-comment-responder.shared.md to maintain tri-template system until consolidation 2. Document PowerShell cmdlet output schema consistency design decision in ADR-017 Changes: - Sync pr-comment-responder.shared.md with src version (preserving tools_vscode/tools_copilot frontmatter) - Add ADR-017 documenting why IssueCommentCount is always included (even when -IncludeIssueComments not used) Comment-IDs: 2643934251, 2643938888 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(session): mark HANDOFF.md update as N/A per ADR-014 The session log was created before ADR-014 (distributed handoff architecture) which made HANDOFF.md read-only on feature branches. Update the Session End checklist to reflect this protocol change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: Correct template system description in PR-235 devops review Address review comment from @rjmurillo clarifying the dual-maintenance template system during tri-template migration period. Changes: - Update devops review to document dual-flow pattern - Clarify src/claude/**/*.md is maintained independently (not generated) - Document bidirectional porting requirement between src/claude and templates/agents Comment-ID: 2643934251 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(adr): remove duplicate ADR-017-powershell-cmdlet-schema-consistency.md Main branch already contains ADR-017-powershell-output-schema-consistency.md from PR #302, covering the same PowerShell schema consistency decision. The duplicate file was created before the main branch merge and conflicted with the existing ADR-017 naming. This commit removes the duplicate and relies on the canonical ADR-017 from main. * fix(pr-235): port IncludeIssueComments changes to template Apply changes from src/claude/pr-comment-responder.md to templates/agents/pr-comment-responder.shared.md: - Update table row to show -IncludeIssueComments parameter - Simplify Phase 0 to Session State Check - Remove Memory Initialization steps (now handled by Serena) - Update Step 1.3 to use -IncludeIssueComments - Update Step 1.4 to document CommentType field - Update session state check comment fetching Addresses comment #2649336096 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * build: regenerate pr-comment-responder agents from template Run build/Generate-Agents.ps1 to sync platform-specific agents with template changes. Fixes validation check failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: rjmurillo-bot <rjmurillo-bot@users.noreply.github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Addresses review comments from gemini-code-assist[bot] and @rjmurillo: **RFC 2119 Compliance (gemini comments 2639624178, 2639624181, 2639624184, 2639624193, 2639624194, 2639624197)**: - Replace all instances of MANDATORY with MUST per RFC 2119 keywords - Updated in all three pr-comment-responder files (template + copilot-cli + vs-code-agents) - Re-applies fix from fc4db8d that was overwritten by merge from main (PR #199 reintroduced MANDATORY) **PR References (rjmurillo comment 2644360944)**: - Add explicit PR list to analysis methodology section (line 28) - Lists all 8 PRs analyzed: #233, #232, #199, #206, #194, #143, #141, #202 Note: gemini comments about code example improvements (2639624180, 2639624189, 2639624196) are not applicable - the referenced code sections were removed when main merged. The current table correctly uses "Copilot" as the reviewer login (verified via GitHub API). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Add capability to resolve PR review threads via GraphQL API, enabling PRs to be merged when branch protection requires all conversations to be resolved.
Resolve-PRReviewThread.ps1script with single/bulk resolution modespr-comment-responder.mdwith Step 6.4 (resolve thread) and Step 8.2 (verify resolution)pr-review.mderror recovery for safer parallel worktree handlingContext
Previously, the
/pr-reviewworkflow would reply to comments but leave review threads unresolved. This blocked PR merges when branch protection rules require all conversations to be resolved.The complete workflow is now: Code fix → Reply → Resolve (all three steps required)
Test Plan
Resolve-PRReviewThread.ps1${PullRequest}not#$PullRequest)Changes
New Files
.claude/skills/github/scripts/pr/Resolve-PRReviewThread.ps1- GraphQL-based thread resolution.claude/skills/github/tests/Resolve-PRReviewThread.Tests.ps1- 43 Pester testsModified Files
src/claude/pr-comment-responder.md- Added Step 6.4 and Step 8.2.claude/commands/pr-review.md- Safer error recovery for parallel scenarios🤖 Generated with Claude Code