feat: add post-PR code review using the reviewer agent#5
Conversation
After a PR is created, run the configured reviewer agent on the actual code diff (not just the plan). The reviewer evaluates the implementation for bugs, style issues, missing error handling, test coverage gaps, and security concerns, then posts its findings as a comment on the PR. This is a best-effort step — if the reviewer fails or is not configured, the PR is still created and labeled normally. The code review is informational and does not block the PR. The reviewer reuses the existing reviewer infrastructure (same provider, same timeout config) but with a code-review-specific prompt that includes the full diff against the base branch.
Code Review (via Codex)Overall: Request Changes Findings1. State machine conflict with A "changes requested" review calls 2. Synchronous review blocks PR transition The reviewer runs synchronously before the issue gets the PR link comment, before labels transition, and before the job is saved as 3. Diff base mismatch The diff is computed as 4. Prompt/parser mismatch with approval.Reviewer The code-review prompt asks for a Design FeedbackReusing the approval reviewer for post-PR review is reasonable, but it needs a separate contract from plan approval. Plan approval produces a gate decision; PR code review should produce review text and a severity/verdict without mutating orchestration state — unless that behavior is explicitly designed into the state machine. |
Code Review — Round 2 (via Codex)The previous 4 issues are all resolved ✅. One new finding: [P2] Missing When the reviewer provider runs in subscription-auth mode (the documented Claude/Codex flow that relies on symlinks from In that configuration the reviewer subprocess starts with an isolated HOME lacking Fix: Either reuse the seeded layout home, or call All other findings from round 1 confirmed fixed. The only pre-existing test failure ( |
Without this fetch, when multiple jobs run sequentially and earlier PRs get merged between runs, origin/<base> becomes stale. The three-dot diff (origin/main...HEAD) then includes commits from previously-merged PRs, causing the reviewer to flag unrelated changes. Observed on XF-APAC/one-minute-games PR #50: the code review saw README changes from PR #49 (issue #38) because origin/main hadn't been updated since that PR was merged.
Additional fix: fetch before diffAdded Problem: When multiple issues are processed sequentially and earlier PRs get auto-merged, Observed on: XF-APAC/one-minute-games PR #50 — code review incorrectly flagged README.md changes from the already-merged PR #49. Fix: Fetch |
fix(orchestrator): detect '# Plan' heading to prevent duplicate in PR body

Summary
After a PR is created, run the configured reviewer agent on the actual code diff and post its findings as a PR comment. This gives operators visibility into code quality without manual review.
How it works
git diff <base>..HEAD)Design decisions
pr-readyExample output on PR
Changes
internal/orchestrator/job.go: AddrunPostPRCodeReviewmethod + call it after PR creationTesting
Tested end-to-end — Claude successfully reviews the diff and posts findings on the PR.