Skip to content

Make pr-reviewer agent iterate to an ideal merge candidate#707

Open
aram356 wants to merge 1 commit into
mainfrom
pr-reviewer-iterative-workflow
Open

Make pr-reviewer agent iterate to an ideal merge candidate#707
aram356 wants to merge 1 commit into
mainfrom
pr-reviewer-iterative-workflow

Conversation

@aram356
Copy link
Copy Markdown
Collaborator

@aram356 aram356 commented May 17, 2026

Summary

  • Teaches the pr-reviewer agent to iterate review → implement → re-review on a stacked fix-up PR, rather than emit a single read-only review the author has to translate by hand.
  • Establishes naming and lifecycle for the fix-up branch (review/<timestamp>-<pr-number>) and fix-up PR title (<timestamp> Review fixes for #<pr-number>), with the same PR reused across passes.
  • Requires re-fetching the PR's current head at the start of every pass so the review tracks force-pushes and rebases instead of going stale.

Changes

File Change
.claude/agents/pr-reviewer.md Add the ## Goal section (ideal-merge-candidate target). Step 1 re-fetches origin/<headRefName> and works against it. Step 6 now collects two decisions per finding: include in review, and implement as code. New Step 7 manages the stacked fix-up branch/PR — branch and title use <timestamp> fixed at engagement start, the same PR is reused across passes (rebased onto current head + force-push-with-lease), per-pass CI gates run before push. Step 8 updates the verdict matrix (🔧 fixed in fix-up PR no longer forces REQUEST_CHANGES) and adds an inline-comment format that references the fix-up PR for implemented findings. New Step 9 documents the re-review loop and the stop conditions (no new actionable findings, blocked on author, user says so). Step 10 (Report) lists both PRs and tags implemented vs. already-fixed-upstream findings. Rules forbid pushing fix-up commits without explicit user approval, targeting main from a fix-up PR, and force-pushing without --force-with-lease after a rebase.

Closes

Closes #706

Test plan

This change is documentation-only inside .claude/agents/ — none of the CI gates exercise this file directly. The workflow was validated end-to-end on PR #621:

  • Pass 1 produced findings and a fix-up PR; the author then force-pushed a rebased head with ~20 new commits.
  • Pass 2 re-fetched the head, dropped findings that had been resolved upstream, rebased the fix-up branch onto the new head (resolving conflicts in registry.rs and main.rs by taking the author's behavior change and re-deriving the struct refactor on top), and landed the remaining fixes in fix-up PR 20260514-172210 Review fixes for #621 #705.
  • The verdict logic, branch/PR naming convention, stop conditions, and the re-fetch step all held up across two passes.

No code is affected; no need to run the Rust/JS gates.

Checklist

The pr-reviewer agent now iterates review → implement → re-review on
a stacked fix-up PR until a full pass surfaces no actionable findings,
rather than producing a single read-only review.

Key workflow changes:
 - Re-resolve the PR's current head at the start of every pass; work
   against origin/<headRefName> rather than a previously checked-out copy
 - Triage each finding twice: include in review, and implement as code
 - One fix-up branch / PR per review engagement, reused across passes:
   branch `review/<timestamp>-<pr-number>` (UTC YYYYMMDD-HHMMSS), title
   `<timestamp> Review fixes for #<pr-number>`, base = the PR's head
 - Inline comments and the review-body summary reference the fix-up PR
   for findings that were implemented; verdict no longer forces
   REQUEST_CHANGES when all wrenches are addressed in the fix-up PR
 - Stop conditions: no new actionable findings (ideal merge candidate),
   blocked on author, or user says so
 - Rules forbid pushing or submitting without explicit user approval,
   targeting `main` from a fix-up PR, or skipping --force-with-lease
   after a rebase

Closes #706
@aram356 aram356 self-assigned this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make pr-reviewer agent iterate to an ideal merge candidate

1 participant