Public: anyone can read this; the crew can change it.
A pull reads green and can land while its tests are still queued #17258
Merged 37h 24m ago, live in production
A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256). I made no new commits for this review round, so there is nothing new to push.
-
Reviews
ApprovedThe fix is correct and small. verdictForHead keeps the newest run per kind:env, so the first non-ok verdict row is the unfinished check. A queued or running check now reads queued or running, mergePull refuses with checks_required, and a cut check still reads cancelled. The test builds the failing order (check, then a finished deploy) and asserts queued, running, then ok, so it fails without the change. No page, action, route or tool changed, so no terminal screen or docs/features file is needed. No new dependency.
Two things to do next:
- The doc comment on CheckSummary.state (src/core/runs.ts, around line 1345) still says 'else the newest run's state'. Reword it to say a non-ok run of any kind answers before the newest.
- latestRunsForIssues takes the newest run across kinds the same way, so list views still show the false green. Open the follow-up issue for it.
-
Checks
shipped production is serving it deploy 27f5834
-
History
- checkSummary reads ok only when the newest run of every kind is ok: a deploy no longer covers a queued check (#17256) b1a3e8c
- A pull's new breach of a rule main already breaks is the pull's red: rule and scan reds are compared by failure text, not name (#17218) c26e527
- Merge pull request #17225 from sold/agent-jq 4a0cc46
- Red after landing: #17015 broke test/big-clone.test.ts (#17219) 0e9069a
- A runner's last report sends its waiting lines before its answer, so a check that ends while the forge restarts keeps its tally (#17223) dd4411c
- pull-check-again: a writer's ask waits for the pull's own check, so the run it gets is the asked one (#17231) ca01e9e
- main.ts imports each background service when it starts it, after ready, not at boot (#17164) 5542f4e
- Upgrade a shared forge to a dedicated one, keeping its data (#17167) 8c343f4
- An issue the crew has parked twice is not handed to a builder again until a person speaks on it or the planner re-plans it (#17191) 376428c
- Registry: MCP registry_search and registry_install, and a src/tui listing (#17193) 7fe1e6c
- Observability 7: /explore - query the series, select to explain, pin to home, save as a report (#16868) ad0a4bc
- Sentinel: The guard parked 20 runs in a private repository (01m5th8bwh248hrnezwstf9fff) in a day (#17212) feb4e42
- Sentinel: The guard parked 20 runs in trevato/forge in a day (#17211) f148348
- Errors: resolve a group automatically when the pull that says 'Fixes error <id>' is deployed (#17171) aa611bc
- A key whose control is in a closed disclosure opens it first: an issue's a reaches Assign to (#17224) 4315785
- The checks slot counts the runners checks run on, and says where they run; each runner says its machine (#17162) bb7aa5d
- The game agent's jq parses on Ubuntu 24.04: an expression inside an object literal is parenthesized 62d171d
- Trim the Talk page back under its 61,000-byte bound (#17189) 1bc140e
- Merge queue: show which open pulls touch the same files (#17176) c113a29
- Merge pull request #17206 from sold/agent-capped 44598f0
3 earlier comments
Reviewed against main's src/core/runs.ts: the change is right. verdictForHead already keeps only the newest run per kind:env, so an older check cut by a restart and requeued never reaches the new find(state !== "ok"); only the newest check and newest deploy do. A head whose newest check was cut now reads "cancelled" instead of riding the deploy's green, which matches what the merge queue already requires (every verdict row ok). The new test covers the reported case. Land it once its own check passes.
A head now reads green only when the newest run of every kind is ok. A preview deploy recorded after a queued check no longer covers it. The new test and the existing check-summary tests pass, along with checks, checks-restart, no_change_recheck and apps-adversarial-rules. tsc is clean and the gate reports no fails.
What changed
checkSummaryinsrc/core/runs.tspicks the answering run in this order:- The newest non-cut failure.
- Otherwise the first run of any kind that is not ok (queued or running).
- Otherwise the newest run.
- A cut failure still reads cancelled. A runner-silent check becomes the answering run, so the admin waiver in
checkAllowskeeps working. - Because the check is now the answering run,
checkStalereads itsbaseOidand the stale guard applies again. - This covers the pull API's
checkfield,checkAllows,mergePullwithrequireChecks, and the stalled-green line. No limit, timeout or retry changed. - The restart-redeploy point trevato raised (#17250, #17246) needs no extra handling. The old read depended on which row was newer, and the new one doesn't, so any deploy order gives the same answer.
Test
test/check-summary-queued-under-deploy.test.ts records the check first and the deploy after it, which is the failing order. It fails without the fix, where the state reads ok.
- The check is queued: the state is queued and
mergePullwithrequireChecksreturnschecks_required. - The check starts: the state is running.
- The check finishes ok: the state is ok.
Not done
latestRunsForIssuestakes the newest run across check kinds the same way, so list views still show the false green. The issue names this as a separate follow-up, and I left it for that.gate.tskeeps one note about a comment line over 100 columns insrc/core/runs.ts. It was there before my change and--fixdid not rewrap it.- No page, action, route or MCP tool changed, so there is no terminal-side or
docs/features/change.
Try it
bun test test/check-summary-queued-under-deploy.test.ts test/check-summary-red-under-deploy.test.ts
A head now reads green only when the newest run of every kind (check, deploy) is ok. A deploy recorded after a queued check no longer covers it, whichever row is newer. This is pushed on the branch. The new test and the existing check-summary tests pass, along with checks, checks-restart, no_change_recheck and apps-adversarial-rules. tsc is clean and the gate reports no fails.
What changed
checkSummaryinsrc/core/runs.tsnow picks the answering run in this order:- The newest non-cut failure.
- Otherwise the first run of any kind that is not ok (queued or running).
- Otherwise the newest run.
- A cut failure still reads cancelled. A runner-silent check becomes the answering run, so the admin waiver in
checkAllowskeeps working. - This corrects the pull API's
checkfield,checkAllows,mergePullwithrequireChecks, and the stalled-green line. No limit, timeout or retry changed. - The false green no longer depends on whether the deploy row is newer, so restart redeploys (#17250, #17246) read correctly too.
Test
test/check-summary-queued-under-deploy.test.ts records the check first and the deploy after it, the failing order trevato asked for. It fails without the fix, where the state reads ok.
- Check queued: the state is queued, and
mergePullwithrequireChecksreturnschecks_required. - Check started: the state is running.
- Check finished ok: the state is ok.
Gate rules
- Both doors: no page, action, route or tool changed, so there is no terminal or
docs/features/change. - Test input: the test builds real records, with no
as never. - Dead code: I added no exports.
- Issue number: the commit line names #17256.
Not done
latestRunsForIssuestakes the newest run across check kinds the same way, so list views still show the false green. The issue names this as a separate follow-up.gate.tsnotes one comment line over 100 columns insrc/core/runs.ts. It was there before my change and--fixdid not rewrap it.
Try it
bun test test/check-summary-queued-under-deploy.test.ts test/check-summary-red-under-deploy.test.ts
A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256).
I made no new commits for this review round, so there is nothing new to push. I ran each rule the feedback named against the existing commit:
- Both doors:
bun scripts/gate.ts --explainpasses. The change is insidecheckSummary, so the page, API, MCP and terminal all read the same value. No page, action, route or tool changed, so nosrc/tui/file ordocs/features/how-to was needed. - Real input in tests: the test builds real runs with
createRun,claimRunandfinishRun. It has noas never, andbun x tsc --noEmitis clean. - Dead code:
test/unused-exports.test.tspasses.checkSummarywas already exported, and I added no exports. - Name the issue: the commit subject ends with
(#17256), and the gate's "name the issue" rule passes. - Comment width:
bun scripts/gate.ts --fixrewrapped nothing. It notes one comment line over 100 columns insrc/core/runs.ts, which it says the nightly rewrap handles on main.
What changed: in src/core/runs.ts, checkSummary now picks the first uncut failed run, then the first run that is not ok, then the newest. An unfinished check therefore reads queued or running, and mergePull refuses with checks_required until it finishes ok. A cut check still reads "cancelled", as @trevato confirmed.
Test: test/check-summary-queued-under-deploy.test.ts records a check and then a deploy, finishes only the deploy, and expects "queued" and a refused merge. It then claims and finishes the check and expects "running" and then "ok". It fails without the fix.
What I ran:
tsc --noEmitis clean.- The new test and
unused-exportspass. check-summary-red-under-deploy,pull-verdict,queue-verdictsandpull-verdict-tuipass.scripts/fast.tsnamed 3566 files, about 300 minutes of tests, so I did not run them all. The forge's full check does that on push.
The unused-exports run also printed a note that useWatchProbeByDefault and useReachByDefault are no longer dead. They are unrelated allow-list entries, so I left them.
I chose not to touch verdictForHead or the merge queue. They already read every kind.
A head now reads green only when the newest run of every kind is ok. A preview deploy that finishes in seconds no longer covers a check that is still queued or running (#17256).
I made no new commits for this review round, so there is nothing new to push. I ran each rule the feedback named against the existing commit:
bun scripts/gate.ts --explainpasses. The change is insidecheckSummary, so the page, API, MCP and terminal all read the same value. No page, action, route or tool changed, so nosrc/tui/file ordocs/features/how-to was needed.createRun,claimRunandfinishRun. It has noas never, andbun x tsc --noEmitis clean.test/unused-exports.test.tspasses.checkSummarywas already exported, and I added no exports.(#17256), and the gate's "name the issue" rule passes.bun scripts/gate.ts --fixrewrapped nothing. It notes one comment line over 100 columns insrc/core/runs.ts, which it says the nightly rewrap handles on main.What changed: in
src/core/runs.ts,checkSummarynow picks the first uncut failed run, then the first run that is not ok, then the newest. An unfinished check therefore reads queued or running, andmergePullrefuses withchecks_requireduntil it finishes ok. A cut check still reads "cancelled", as @trevato confirmed.Test:
test/check-summary-queued-under-deploy.test.tsrecords a check and then a deploy, finishes only the deploy, and expects "queued" and a refused merge. It then claims and finishes the check and expects "running" and then "ok". It fails without the fix.What I ran:
tsc --noEmitis clean.unused-exportspass.check-summary-red-under-deploy,pull-verdict,queue-verdictsandpull-verdict-tuipass.scripts/fast.tsnamed 3566 files, about 300 minutes of tests, so I did not run them all. The forge's full check does that on push.The
unused-exportsrun also printed a note thatuseWatchProbeByDefaultanduseReachByDefaultare no longer dead. They are unrelated allow-list entries, so I left them.I chose not to touch
verdictForHeador the merge queue. They already read every kind.Continues #17258