Skip to content

Loop review rounds in review-and-fix until clean - #7

Merged
zcorpan merged 28 commits into
mainfrom
zcorpan/review-and-fix-loop
Nov 4, 2026
Merged

zcorpan merged 28 commits into
mainfrom
zcorpan/review-and-fix-loop

Conversation

@zcorpan

@zcorpan zcorpan commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Makes one review-and-fix invocation do all the work, so it shouldn't need to be run again:

  • Review, one commit per finding, and self-review repeat in rounds. The first round is a full review, later rounds review the fixes, and a clean or nits-only round of those is followed by another full review. The loop ends on a full review that finds nothing above nits, on a new open question, or after ten rounds.
  • Fixes go on a <PR branch>-fixes branch, which is continued within the conversation. Fixes for the agent's own unpushed fixes are fixup commits, squashed after the loop so each finding has one commit.
  • Nothing is pushed or posted until after the loop, asking first unless told to. The posted comment covers only what's relevant to the author.

One invocation now repeats review, fixes, and self-review until a round finds only nits or raises an open question, after at least one full review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zcorpan

zcorpan commented Oct 25, 2026 •

Copy link
Copy Markdown
Member Author
AI review and fixes

Reviewed at a1a0b4b

I reviewed the looping change, walking through the stop conditions case by case. I self-reviewed the fixes by checking that the frontmatter parses and that no line goes past 100 columns.

Blockers

  • SKILL.md Rounds: the five-round cap could be bypassed. If the first round was a delta and five delta rounds ran, the full-round rule forced a sixth round, and nothing bounded the rounds after it. Fixed in e61b81a: never more than five rounds, and the fifth is made full if needed.

Suggestions

  • SKILL.md Rounds: a nits-only round said "without another round", while the full-round rule said to run one. Fixed in 41b6343: the full-round rule now overrides, and "Later rounds are delta rounds, except as below."
  • SKILL.md Rounds: if an unanswered question from an earlier comment counted, every re-run would stop after one round. Fixed in 7c7e29d: only new open questions stop the loop.
  • SKILL.md Rounds: a regression found in your own fix wasn't a "finding", so that round "found nothing" and the loop stopped without reviewing the fix for it. Fixed in 1315f3a: such problems still count, at their severity.
  • SKILL.md Rounds: "reviewed in an earlier invocation" allowed a first delta round even if that review was never posted. Its fixes were discarded with the fresh branch. Fixed in 5c17122: the first delta round is based on the last posted review.
  • SKILL.md Fixing: read once per round, "fresh local branch" would drop earlier rounds' unpushed fixes. Fixed in 3152322: the branch is created once per invocation.
  • SKILL.md Stop, push, report: nothing covered the author pushing while the agent worked. Fixed in 22f9f02:
    • Author commits are only part of a first delta round.
    • If either branch moved since you built on it, push and post nothing, and tell the user. Pushing just one branch would leave the comment citing fix commits that were never pushed.

Nits

  • SKILL.md Reviewing: within one invocation, "comments since the last round" no longer meant anything, and "the PR heads" could be read as refetching every round. Fixed in 9afd383.
  • SKILL.md: a full round requires running the tests, and self-review requires rebuilding. That didn't fit PRs without tests or a build. Fixed in 0d41e7d.
  • SKILL.md Rounds: a fifth round reported "didn't converge" even when it found only nits, or stopped on a new open question. Fixed in 748622f.
  • The description and README didn't match the stop conditions, the cap, or the ask-first step. Fixed in e02df3e.

@zcorpan

zcorpan commented Oct 25, 2026 •

Copy link
Copy Markdown
Member Author
AI review and fixes

Reviewed at e02df3e

I reviewed the whole skill again, focusing on whether one invocation leaves nothing for a re-run, on the stop logic, and on continuing earlier unpushed work. I self-reviewed the fixes by checking that the frontmatter parses and that no line goes past 100 columns.

Blockers

  • SKILL.md Fixing: continuing after an unpushed stop (e.g. the user answering an open question) made a fresh branch from the remote head, which threw away the fixes the user had just reviewed. Since asking first is the default, this is the normal path. Fixed in aaffff2:
    • Fixes go on a <PR branch>-fixes branch created from the remote PR head, and that branch is pushed to the PR branch. Existing branches are never reset.
    • Unpushed fixes from earlier in the conversation are continued, rebased onto the remote head if it moved. A fully pushed -fixes branch is fast-forwarded and reused, and in any other case the agent asks the user.
    • The comment covers fixes from earlier in the conversation and cites the current fix commits.

Suggestions

  • SKILL.md Rounds: the loop could stop on a clean delta round while problems remained that only a full review finds, so a re-run was still needed. Fixed in 11a24d2:
    • A clean or nits-only delta round is followed by a full round, unless it's the tenth round or raised a new open question.
    • Items deliberately left with the author don't count as findings, so they can't keep the loop going.
  • SKILL.md Rounds: every invocation needs a full round anyway, so an initial delta round only cost a round of the cap. Fixed in c910ff1: the first round is always full.
  • SKILL.md Rounds: the cap of five rounds is too low for large PRs like Add streaming HTML insertion methods html#12758. Fixed in c90da24 by raising it to ten.
  • SKILL.md Reviewing: findings from the last review that were neither fixed nor declined, and answers to its open questions, were never acted on. Fixed in c693399: the first round carries them over from the last posted review, or the last draft comment, and takes answers from the user as well as the author.
  • SKILL.md Stop, push, report: the comment should contain only what's relevant to the author. Fixed in 5ced7c0: the review process (rounds, reviewers, which fixes were re-reviewed) goes only in the report to the user. The comment keeps how the fixes were checked.
  • SKILL.md Stop, push, report: "push and post nothing" could be read as "push, and post nothing", and nothing covered a failed push. Fixed in f6ed061.
  • SKILL.md Rounds: the fifth round's findings weren't clearly meant to be fixed. Fixed in 8ac27e6.

Nits

  • README: it put running the tests under self-review and left review out of what repeats. Fixed in e90444e.
  • SKILL.md Reviewing: parallel reviewers weren't told about the user's decisions. Fixed in b70c297.

@zcorpan

zcorpan commented Oct 25, 2026 •

Copy link
Copy Markdown
Member Author
AI review and fixes

Reviewed at b70c297

I reviewed the whole skill again, including the git commands it prescribes, which I tried in scratch repos with Git 2.54. I self-reviewed the fixes by checking that the frontmatter parses and that no line goes past 100 columns.

Suggestions

  • SKILL.md Rounds and Stop, push, report: fixes for the agent's own fixes piled up as separate commits, so a single finding could cite up to nine commits, some of them partly undone by later ones. That's hard for humans to review. Fixed in 8f57b4f:
    • Problems in your own unpushed fixes are fixed with git commit --fixup.
    • After the loop, the fixups are squashed with git rebase --autosquash <the remote PR head you built on>, which leaves pushed commits alone. The squash is aborted if it stops for any reason, and the tree is checked to be unchanged.
    • Commits made while the user reviews are self-reviewed and squashed the same way, and the draft is shown again if it changed.
  • SKILL.md Fixing: when continuing unpushed fixes after the author force-pushed, "rebased onto the remote PR head" would replay the author's old commits along with the fixes, and the push would then add those duplicates to the PR. Fixed in b6b2e0c: only your own fixes are rebased (git rebase --reapply-cherry-picks --empty=stop --onto <new head> <the head you built on>, so no fix is dropped silently), and if that stops, the agent aborts and asks the user.

zcorpan and others added 23 commits October 25, 2026 22:37
A full round forced after the cap could keep the loop going without bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Otherwise a question still unanswered from an earlier comment would stop every re-run after one round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Otherwise a round that only found a regression from an earlier fix would stop the loop without reviewing the fix for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An earlier review that was never posted had its fixes discarded with the fresh branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pushing only one branch would leave the comment citing fix commits that were never pushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Within one invocation, "since the last round" no longer meant anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The invocation needs a full round anyway, so an initial delta round only cost a round of the cap. This also removes the rules for forcing a full round later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Large PRs need more than five rounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Otherwise unfixed findings and the author's answers to open questions were never acted on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Delta rounds can converge while the whole still has problems a full review would find, so a clean or nits-only delta round is followed by a full round. Items left with the author don't count, so they can't keep the loop going.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Starting from the remote head would discard fixes the user just reviewed. Fixes go on a `-fixes` branch that is continued within the conversation, reused once fully pushed, and otherwise left for the user to decide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment is feedback for the author; rounds and re-review status go in the report to the user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes for your own unpushed fixes become fixup commits, squashed after the loop, so reviewers see one commit per finding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plain rebase onto a force-pushed head would replay the author's old commits too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zcorpan
zcorpan force-pushed the zcorpan/review-and-fix-loop branch from f5a1230 to b6b2e0c Compare October 25, 2026 22:37
zcorpan and others added 2 commits October 26, 2026 08:29
A delta tenth round always counted as not converged, even when it found nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zcorpan and others added 2 commits October 26, 2026 08:42
They would be carried onto the `-fixes` branch, into test results and possibly fix commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zcorpan

zcorpan commented Oct 26, 2026

Copy link
Copy Markdown
Member Author
AI review and fixes

Reviewed at b6b2e0c

I reviewed the whole skill again, including two problems from using it on a large whatwg/html PR, and walked through the stop conditions case by case. I self-reviewed the fixes by checking that the frontmatter parses and that no line goes past 100 columns.

Suggestions

  • SKILL.md Rounds: when the ninth round was a full round with findings, the tenth had to be a delta round, and a delta round at the cap always counted as not converged, even when it found nothing. Fixed in 66388ef: the tenth round is always full and also looks closely at the previous round's fixes, so a clean tenth round means the loop converged.
  • SKILL.md Stop, push, report: nothing said to switch checkouts back after pushing, so they could be left on the -fixes branches. Fixed in 37a0965: once every push succeeds, or if there's nothing to push, each checkout goes back to what it had checked out before the agent last switched it to its -fixes branch. That also covers detached checkouts and several invocations in one conversation.
  • SKILL.md Fixing: uncommitted changes to tracked files would be carried onto the -fixes branch, into test results and possibly fix commits, or back when switching back. Fixed in 253fd6e: if a checkout has such changes at the start, or before switching it, the agent asks the user.

Nits

  • SKILL.md Fixing: --empty=stop needs Git 2.45; 2.44 rejects it. My earlier fix introduced it. Fixed in cd62406 by saying so.

@noamr

noamr commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

I found in my own workflow that it helps telling the reviewer agent to be "adversarial" or work with a clean context, to avoid self-conviction etc. I wonder how you see that in the context of the review-and-fix loop @zcorpan

@zcorpan

zcorpan commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Claude decides to do that when I tried running this, but it could maybe be stated to do so for full reviews.

@noamr noamr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets land this and iterate. Thanks!

@zcorpan
zcorpan merged commit e44bef9 into main Nov 4, 2026
@zcorpan
zcorpan deleted the zcorpan/review-and-fix-loop branch November 4, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants