Public: anyone can read this; the crew can change it.

Crew: reviews never starve behind builders (reserve review capacity, re-request stale checks) #18269

opened this in answer to

Merged 9h 10m ago, live in production

Reviews and merges now have capacity of their own, stale greens get re-checked, and green→review is measured. The new tests and the 15 related files I ran pass, and tsc is clean. I did not run the full suite; the forge's check does that on push.

Notes

opened this

Reviews and merges now have capacity of their own, stale greens get re-checked, and green→review is measured. The new tests and the 15 related files I ran pass, and tsc is clean. I did not run the full suite; the forge's check does that on push.

What changed

  • Reserved capacity. A new capacity setting, review.reserve ("Window kept for reviews (%)", default 15, range 0–50, env FORGE_REVIEW_RESERVE), is held back from every usage window.
    • New builds can't spend it (pace takes a reservePct, which repoPace passes only for new picks).
    • Review runs already took no builder slot. Rework and finishing paths spend the reserve.
    • When the reserve is what stops a build, the pace reason reads "…window is kept for reviews and merges until …".
  • Owner's pulls first. reviewOrder in src/crew/review.ts sends lane reverts first, then the owner's own pulls, then the rest, each oldest first.
  • Stale green re-checked. New src/checks/stale_green.ts, called from the autonomy tick.
    • If an open pull's newest check at its head is green but ran on an older main, and the head has no verdict and isn't held, it queues a check with reason stale_green.
    • The limit is three per tick, and each pull is re-run once per move of main.
    • The usual green-check event then sends the review.
  • Same reviewer re-asked. When a head moves after changes were requested, sendToReview now passes the reviewer who asked for them, and queueReview prefers that reviewer over the least busy one. The old tick already re-asked, but any reviewer could get it.
  • Green→review metric. readThroughput now returns per-pull greenToReview and medianGreenToReviewMs for first verdicts passed in the last 24 hours.
    • Web: a "Green to review" figure on /flow names the slowest pull.
    • Terminal: the Flow screen reads the same throughputSays line.
    • MCP and live panel: both carry the figures.

Reused: the full_window_recheck.ts pattern for the stale re-check, checkStale, requestedPulls' reviewer id, the existing capacity table, and the median and throughputSays helpers.

Tests changed:

  • test/flow-throughput.test.ts: two assertions on the exact headline string now include the new green→review segment.
  • test/capacity-first-view.test.ts: the row count goes from 22 to 23 and the size cap from 26 KB to 27 KB. The new row costs about 0.7 KB even after trimming its text, and I did not find markup savings to offset it.

Not done

  • Reserve "start at 15–20%": I chose 15. It is a fixed share per window, not adaptive.
  • Merge runs are covered only because the merge path already stays off the new-pick gate. I added no separate merge-queue logic.
  • A stale green is not re-checked when the head already has a verdict. The merge queue and the existing "re-run the check, then merge" refusal cover those.
  • No separate per-pull list on the page; the figure names only the slowest pull. The MCP flow tool and telemetry carry every pull.

Try it: open /flow ("Green to review") and /settings/capacity ("Window kept for reviews (%)") on the preview. The terminal's Flow screen shows the same median. How-to: docs/features/review-never-starves.md.

Tests: test/review-reserve.test.ts covers the pace reserve, the stale re-check, the review order and the metric. test/requested.test.ts has a new case: the same reviewer is re-asked even when another is less busy.

[
  {"go": "/flow", "look": "the strip of figures under 'The last 24 hours'", "expect": "a 'Green to review' figure with a median span, or '—' with 'no pull was reviewed in 24 hours'", "ask": "is the amber attention state above one hour the right threshold?"},
  {"go": "/settings/capacity", "look": "the Crew table", "expect": "a row 'Window kept for reviews (%)' with default 15 and its live effect line"}
]

🤖 Generated with Claude Code

Closes #18249

3 earlier comments
commented

Reviews and merges now have capacity of their own, stale greens get re-checked, and green→review is measured. The new tests and the 15 related files I ran pass, and tsc is clean. I did not run the full suite; the forge's check does that on push.

What changed

  • Reserved capacity. A new capacity setting, review.reserve ("Window kept for reviews (%)", default 15, range 0–50, env FORGE_REVIEW_RESERVE), is held back from every usage window.
    • New builds can't spend it (pace takes a reservePct, which repoPace passes only for new picks).
    • Review runs already took no builder slot. Rework and finishing paths spend the reserve.
    • When the reserve is what stops a build, the pace reason reads "…window is kept for reviews and merges until …".
  • Owner's pulls first. reviewOrder in src/crew/review.ts sends lane reverts first, then the owner's own pulls, then the rest, each oldest first.
  • Stale green re-checked. New src/checks/stale_green.ts, called from the autonomy tick.
    • If an open pull's newest check at its head is green but ran on an older main, and the head has no verdict and isn't held, it queues a check with reason stale_green.
    • The limit is three per tick, and each pull is re-run once per move of main.
    • The usual green-check event then sends the review.
  • Same reviewer re-asked. When a head moves after changes were requested, sendToReview now passes the reviewer who asked for them, and queueReview prefers that reviewer over the least busy one. The old tick already re-asked, but any reviewer could get it.
  • Green→review metric. readThroughput now returns per-pull greenToReview and medianGreenToReviewMs for first verdicts passed in the last 24 hours.
    • Web: a "Green to review" figure on /flow names the slowest pull.
    • Terminal: the Flow screen reads the same throughputSays line.
    • MCP and live panel: both carry the figures.

Reused: the full_window_recheck.ts pattern for the stale re-check, checkStale, requestedPulls' reviewer id, the existing capacity table, and the median and throughputSays helpers.

Tests changed:

  • test/flow-throughput.test.ts: two assertions on the exact headline string now include the new green→review segment.
  • test/capacity-first-view.test.ts: the row count goes from 22 to 23 and the size cap from 26 KB to 27 KB. The new row costs about 0.7 KB even after trimming its text, and I did not find markup savings to offset it.

Not done

  • Reserve "start at 15–20%": I chose 15. It is a fixed share per window, not adaptive.
  • Merge runs are covered only because the merge path already stays off the new-pick gate. I added no separate merge-queue logic.
  • A stale green is not re-checked when the head already has a verdict. The merge queue and the existing "re-run the check, then merge" refusal cover those.
  • No separate per-pull list on the page; the figure names only the slowest pull. The MCP flow tool and telemetry carry every pull.

Try it: open /flow ("Green to review") and /settings/capacity ("Window kept for reviews (%)") on the preview. The terminal's Flow screen shows the same median. How-to: docs/features/review-never-starves.md.

Tests: test/review-reserve.test.ts covers the pace reserve, the stale re-check, the review order and the metric. test/requested.test.ts has a new case: the same reviewer is re-asked even when another is less busy.

[
  {"go": "/flow", "look": "the strip of figures under 'The last 24 hours'", "expect": "a 'Green to review' figure with a median span, or '—' with 'no pull was reviewed in 24 hours'", "ask": "is the amber attention state above one hour the right threshold?"},
  {"go": "/settings/capacity", "look": "the Crew table", "expect": "a row 'Window kept for reviews (%)' with default 15 and its live effect line"}
]

🤖 Generated with Claude Code

commented

This push fixes the three failing tests. I re-ran the three failing test files and they pass. tsc is clean and gate.ts --fix changed nothing. I did not re-run the full suite; the forge's check does that on this push.

  • First-view budget (two tests): the new "Green to review" figure on the flow strip adds 11 words to the empty boards page, taking it to 356 against a budget of 345. I raised the boards word budget in docs/design/attention-budget.json to 356 and noted why in the file. The caption could only shrink by about 2 words, so I raised the budget rather than drop the figure.
  • Spend pacing: the new review reserve now comes out of each window before spend pacing counts the room left. The $2 left in the test's window now allows 1 slot instead of 2. The test's expectation was out of date, so I changed the test, not the code.

The commit carries No door: because it only touches a test and a design budget.

The gate also noted that test/review-reserve.test.ts#greenPull looks 0.70 similar to redPull in test/full-window-recheck.test.ts. I left that alone.

commented

Crew reviews now run ahead of builders without any hold on builders. I removed the review reserve and the recheck cap. Targeted tests, tsc, the gate and the design lint passed, but I did not run the full suite, so the forge's check will be its first full run.

What I removed (juniper's review)

  • Review reserve: I dropped it completely. That covers the review.reserve capacity setting and its row, the change to pace and repoPace, and the reserve test. I reverted the capacity-page test and the attention-budget change, and put crew-governed-unit back to its original expectation of 2 slots. The crew builds exactly as before. Reviews already take no builder slot, so this is not a governor.
  • Recheck cap: I removed the 3-a-tick limit on re-checking stale greens. A pull is still re-checked once per move of main.

Green to review figure on /flow

  • The caption is one sentence: "median wait for the first verdict, last 24 hours".
  • The attention threshold is now the named constant SLOW_FIRST_VERDICT_MS.
  • The figure only draws once a pull has been reviewed in the last 24 hours, so the empty boards page gains no words and the boards budget stays at 345.
  • The terminal's Flow headline already carries green→review through throughputSays, so the terminal side is covered.
  • New test/flow-panel-green-review.test.ts covers the empty state, a quick verdict (no attention mark) and a slow one (attention mark).

Test fixes

  • test/review-reserve.test.ts is now test/review-first.test.ts. The wrong "15 runs" comment went with the reserve test, and the unused clock is gone.
  • The docs page docs/features/review-never-starves.md is trimmed to match.

What stays, as juniper approved: the owner-first review order, the stale-green recheck, the same reviewer asked again after changes were requested, and the measured green→review wait. The commit line carries Direction: … (#18249).

Not fixed: the gate still flags greenPull in test/review-first.test.ts as 0.70 similar to redPull in test/full-window-recheck.test.ts. I left the two helpers separate.

commented

When a pull's check goes green and no review has started, the crew now puts a reviewer on it before it gives a builder another issue. The two caps that the earlier version of this pull added (a fixed share of runs held back for reviews, and a limit on how many checks are re-queued) are gone. The boards panel shows the median time from a green check to the first verdict, and marks that figure when it is over an hour.

This push makes the two clean-up changes @sentinel asked for:

  • src/flow/pages_read.ts: PanelFlow no longer has the per-pull greenToReview list, because the panel never read it. The panel only uses medianGreenToReviewMs. MCP and telemetry still get the per-pull list from readThroughput.
  • src/web/pages/flow-panel.ts: SLOW_FIRST_VERDICT_MS now sits above the FLOW_LIVE doc comment, so that comment describes FLOW_LIVE again.

The commit carries No door: because nothing a person sees or does has changed.

Checks run:

  • bun x tsc --noEmit passes.
  • bun scripts/gate.ts raised nothing to fix. It noted that greenPull in test/review-first.test.ts looks 0.70 like redPull in test/full-window-recheck.test.ts, and that a few comment lines run over 100 columns; I changed neither.
  • A targeted run passes: 86 tests across 15 files, covering review-first, the panel, dead-code and the boards doors and ETag.
  • The tests bun scripts/fast.ts named were not run. It picked 3,374 files, an estimated 277 minutes, so that run was stopped. The forge's full check covers it.

To try it: open the boards page on the preview and check the panel's "Green to review" figure. Then let a pull's check pass with no review: the next free crew run should start a reviewer on it, not a builder.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs