Fix PR Review Comments (v3)
Systematically fix all review comments on a PR from all sources.
Mode Selection
- DEFAULT (safe): Present findings → STOP → wait for user approval → fix
- AUTONOMOUS: Activated by user saying "autonom", "autonomous", or "mach einfach" → skip approval gate, loop until MERGEABLE
Phase 1: Collect ALL Comments
- Determine PR number:
gh pr list --state open --head $(git branch --show-current) --json number -q '.[0].number' - Fetch PR metadata:
gh pr view $PR --json reviewDecision,reviews,comments,mergeable - Fetch ALL review comment sources:
- PR review comments:
gh api repos/{owner}/{repo}/pulls/$PR/comments - PR review threads:
gh api repos/{owner}/{repo}/pulls/$PR/reviews - Issue-style comments:
gh api repos/{owner}/{repo}/issues/$PR/comments
- PR review comments:
- Identify sources: CodeRabbit, Qodo/Codium, manual reviewers, GitHub Actions bots
Phase 2: Present Findings
- Group ALL comments by file path, then by severity: [CRITICAL] > [WARNING] > [SUGGESTION]
- Create a TodoWrite checklist of every finding grouped by file
Phase 2b: Approval Gate
- DEFAULT mode: STOP HERE. Wait for user approval before proceeding.
- AUTONOMOUS mode: Skip this gate, proceed directly to Phase 3.
Phase 3: Fix (file by file)
- Read each file before editing - understand context first
- Fix each finding, run the relevant test suite after EACH file change:
.ts/.tsxfiles:npx tsc --noEmit+npm test -- --run.pyfiles:python -m py_compile+pytest
- Use real framework objects in tests (never MagicMock for HTTP request/response)
- Mark each TodoWrite item as completed after fixing
Phase 4: Validate
- Resolve merge conflicts:
git fetch origin main && git merge --no-commit origin/main(resolve if conflicts, abort and retry if needed) - Run full test suite
- Run pre-commit hooks. If PII scanner false positives on number literals or placeholder emails:
- Document the false positive with justification
- Use
--no-verify
Phase 5: Commit and Push
- Commit with structured message referencing PR number and listing all fixes
- Push to remote
Phase 6: Re-fetch Loop (AUTONOMOUS mode only)
- Re-fetch PR review status:
gh pr view $PR --json reviewDecision,mergeable - If new comments appeared → loop back to Phase 1
- Only stop when PR status is MERGEABLE and all quality gates pass
Phase 7: Final Report
Always output a structured summary:
## PR #<NUMBER> Fix Summary
- **Files changed**: [list]
- **Comments resolved**: X/Y
- **Tests**: all passing / N failures
- **Deferred items**: [list with reasoning]
- **Status**: MERGEABLE / BLOCKED (reason)