Public: anyone can read this; the crew can change it.
Reviews are the bottleneck: reviewer runs fail on review anchors, count as failed for pushing nothing, and hold slots #500
Closes #487
stopped closed without shipping deploy f97a3b2
6 earlier comments
Reviewer runs now post their verdict through the right route and count as ok when they do. Every green pull an agent wrote is sent to a reviewer. A review that never comes back is sent once more and then stops holding the pull, which covers the operator's addition. The full forge.json check passes on the final push: 632 tests across 44 files, plus tsc --noEmit.
Posting a review (actions/pulls.ts, http/api.ts, crew/brief.ts)
- The cause of the
bad_anchorfailures: the reviewer brief told agents to POST their verdict to…/reviews, which is the line-comment route. - The brief now uses
…/review-states, which takes an optionalcomments: [{path, line, side, body}](at most 50). - Every anchor is checked before anything is written, so one bad anchor posts nothing.
bad_anchornow explains how an anchor is written (side, numbering, the@@ -a,b +c,d @@header). A verdict sent to…/reviewsis told it belongs on…/review-states.- The brief tells the reviewer to resend once after a
bad_anchor, then drop the comments into the body. addReviewnow shares the anchor checks with the verdict route.
Who reviews, and when (new crew/review.ts)
- A change touching auth, token, secret, sandbox or http paths goes to the reviewer whose brief's first paragraph mentions security (Sentinel). Everything else goes to the other reviewer (Juniper). Reading only the first paragraph matters, because every brief's shared rules mention security too.
- A green check sends an agent's pull to review in any repository with a reviewer, not only autonomous ones. A tick sweep catches anything the event missed.
- Attempts are read from the run table, replacing the in-memory map that never re-queued and was lost on restart.
- The first review is sent on green. If it ends without a verdict, or is still out after 20 minutes, it is sent once more. After the second miss, or an hour green with no verdict, the review has lapsed.
- A lapsed pull lands on green. The land decision records
review: "lapsed", and a note goes on the pull after it merges (posted earlier, it would start a builder run).
Settling runs
crew/runner.ts: a review run skipslandWork. It isokwhen the reviewer posted a verdict during the run and failed otherwise; what it pushed no longer decides it. Its last message is no longer posted on the pull.crew/dispatch.ts: only the verdict wakes the builder, not each line comment.
Board: each app card in the Today region gets one line, shown only when there is something to say: pulls awaiting review, median time from green to a verdict, and verdicts per reviewer. It is computed by the new core/review-stats.ts.
What I chose not to do
- Releasing slots after a finished run is left to #474.
- The "park instead of land" repo setting is not built. A lapsed review always lands with a note; parking can come later if wanted.
- I did not re-add juniper and sentinel to trevato/forge's crew; that is a person's step once this merges. Their roles should be
reviewer.
Tests: test/review-route.test.ts (reviewer choice, retry and lapse rules, sweep, run settle) and test/review-lines.test.ts (the API) are new. There are added cases in review-gate.test.ts (a review that lapses, and the pull still lands), crew.test.ts (an end-to-end review run with the stand-in Claude) and board.test.ts. These test files are now part of forge.json's check. No existing assertion was changed.
Two tests failed while I worked, and neither is caused by this change:
test/reviews-states.test.tsfails the same way on unmodifiedmainin this sandbox (the connection resets while it creates tokens over HTTP). It isn't in the check.fork-flow's "a mirror whose git is not ready yet" failed once on timing in an earlier full run, passed alone, and passed in the final full run.
To try it: post {"state":"changes_requested","comments":[{"path":"…","line":1,"side":"new","body":"…"}]} to /api/v1/repos/:o/:n/pulls/:n/review-states, then open /board.
🤖 Generated with Claude Code
Reviews no longer stall pulls. Reviewer runs post their verdict through the right route and count as ok when they do, and every green pull an agent wrote is sent to a reviewer. A review that never comes back stops holding the pull. This push also covers the 20:30Z diagnosis on #487: departed reviewers, the uncapped rounds, duplicate and misaimed reviews, and builders that never answer.
The last full forge.json check had one failure, fork-flow's "a mirror whose git is not ready yet". It is a timing race in mirror setup (the test seeds the upstream git 300 ms after the mirror starts), it passes when run alone, and it passed in the previous full run with these test files. tsc --noEmit is clean.
What changes for the stuck pulls
- Departed reviewers. An agent's verdict counts only while that agent is a reviewer on the pull's crew. Juniper's standing change requests on #442, #467 and the conflicted pulls stop holding them as soon as this merges. The rule lives in
reviewSummary, so the merge gate, autonomy and the pulls page all agree. - Round cap. The reviewer gets two rounds of changes per pull; a round is a head it asked changes on. A third request is shown as a comment and no longer blocks landing. The brief reads the same
REVIEW_ROUNDSconstant. - Builders that don't answer. A builder's feedback run that ends without pushing, while a change request stands on the head, parks the pull (autonomous repos only).
- Duplicates. The same verdict sent twice on one head returns the existing review, and the review run still settles
ok. - Wrong preview. I couldn't confirm the cause from here. The likeliest one: a review run resumed the reviewer's earlier session, carrying an older head's diff and preview. Review runs now always start fresh, and the brief names the one preview to judge.
Earlier in this pull
- One way to post a review. The brief had told reviewers to POST verdicts to
…/reviews, the line-comment route; that is where everybad_anchorcame from. Verdicts now go to…/review-states, which takes optional line comments. If one anchor is wrong nothing is posted, and the error explains the anchor format so the run can resend once. - Who reviews. Changes touching auth, token, secret, sandbox or http paths go to the reviewer whose brief's first paragraph mentions security (Sentinel); everything else goes to the other (Juniper). Every green agent pull is sent, in any repository with a reviewer, autonomous or not.
- Retry and lapse. A review that ends without a verdict, or is still out after 20 minutes, is sent once more. After the second, or an hour green with no verdict, the pull lands with a note. Attempts are read from the run table, so a restart forgets nothing.
- Settling. A review run is
okwhen its verdict is on the pull, whatever it pushed. - Board. Each app card shows pulls awaiting review, the time from green to a verdict, and verdicts per reviewer.
Not done
- Releasing slots after a finished run is left to #474.
- There is no "dismiss review" action; the role rule covers the departed-reviewer case.
- There is no repo setting to park a lapsed pull instead of landing it.
- Pulls already stuck behind a builder that never answered are only parked on that builder's next feedback run, not swept now.
- Juniper and Sentinel are not re-added to trevato/forge's crew; that's for a person once this merges, with role
reviewer.
Tests: test/review-route.test.ts and test/review-lines.test.ts are new. Cases are added to review-gate.test.ts, crew.test.ts (end-to-end review runs, including the no-resume check) and board.test.ts. These test files are now part of forge.json's check, and no existing assertion was changed. test/reviews-states.test.ts fails the same way on unmodified main here (the connection resets while it creates tokens) and isn't in the check.
To try it: POST {"state":"changes_requested","comments":[{"path":"…","line":1,"side":"new","body":"…"}]} to /api/v1/repos/:o/:n/pulls/:n/review-states, then open /board.
🤖 Generated with Claude Code
Merged main into this branch. Reviewer runs still behave as before: they read pulls through review anchors, they don't count as failed for pushing nothing, and their verdicts gate only for the reviewer role, two rounds, one verdict per head.
Conflict: forge.json's check was the only conflict. I took main's shorter form (test-shards.ts -- <name> …) and put this branch's four tests back into it: review-route, review-lines and review-gate (next to crew) and board (before board-windows). Everything else merged automatically, including src/crew/autonomy.ts, dispatch.ts, runner.ts, src/http/api.ts, src/web/pages/board.ts and test/board.test.ts.
Check: I ran the merged check locally. It ran 718 tests across 50 files in three shards. Only the last shard's tally was captured (223 pass, 0 fail), and the exit code shown came from a pipe, so the other two shards' results weren't confirmed separately; the forge's own run of the check on this push will confirm them.
To try: look at the check line in forge.json. The preview is at https://lab--500--forge-trevato-apps.open-platform.sh.
🤖 Generated with Claude Code
I merged main into the branch again and fixed the two conflicts so both sides' intent survives. This branch's change to reviewer runs is unchanged.
src/crew/autonomy.ts, insettleAgentRun:mainadded a rule that a run cut short (by a provider limit, a network error or a restart) ends with no note and no strike. This branch addedansweredWithoutChange, which parks a pull when a builder's feedback run ends without pushing anything while the reviewer still asks for changes. The interruption rule now runs first, so a run that was cut short never parks a pull as an unanswered review request.forge.json, incheck:main's list is kept, including its newcrew-parks. This branch'sreview-route,review-lines,review-gateandboardtests are added back.
I ran the full check locally: the type check passed and all 727 tests in 51 files passed across 3 shards, with 0 failures.
To try it, read settleAgentRun in src/crew/autonomy.ts and the check line in forge.json. The preview is at https://lab--500--forge-trevato-apps.open-platform.sh.
🤖 Generated with Claude Code
I merged main into the branch again. This branch's change to reviewer runs is unchanged. The full check passed locally: the type check and 732 tests in 52 files across 3 shards, with 0 failures.
Conflict: forge.json's check was the only conflict, and it was a list of test names. I kept main's list, including its new told-by, and added back this branch's review-route, review-lines, review-gate and board. Every name on the list has a matching file under test/. Main's other changes in src/actions/pulls.ts and src/web/pages/board.ts merged without conflict.
To look at: the check line in forge.json. The preview is at https://lab--500--forge-trevato-apps.open-platform.sh.
🤖 Generated with Claude Code
Closes #487