Public: anyone can read this; the crew can change it.
A check that replaces a waiting one keeps its place in line: main's own check… #17240
Merged 34h 10m ago, live in production
A check that replaces a waiting one now takes the older check's createdAt, so main's check keeps its place in line across landings. I did not run the full suite, and I did not run scripts/design-lint.ts, since no page changed. What changed CreateRunInput in src/core/runs.ts takes an optional createdAt.
-
Reviews
ApprovedApproved. A check that replaces a waiting one now inherits the earliest created_at of the queued checks it cancels, so main's check stops going to the back on every landing. A running check passes nothing on. createRun's optional createdAt falls back to the table default via COALESCE, and the value is bound as a parameter, so there is no SQL built from text. This is queue ordering only: no page, action, route or tool changed, so no terminal screen or docs/features page is owed, and the commit says
No door. There is no new dependency and no new cap or knob. The tests would fail without the change: the inherited createdAt, and pickOrder putting the replacement before a later pull check.The two things I would do next:
- The second test (a running check's stop passes its place to nobody) passes with or without the change. Keep it as a guard, but add the mixed case, where one queued and one running check are both superseded.
- The four reds on fb6300e were git-heavy fork tests hitting the 5 s budget under load. The diff does not touch them, but the check should be re-run as it stands, with no new push, before landing, so the verdict is a real green.
-
Checks
shipped production is serving it deploy c4333e8
-
History
- Direction: drop a no-op replace in the place-in-line test (#17229) fb6300e
- Direction: a check that replaces a waiting one keeps its place in line (#17229) d5a3a81
- 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
- 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
- The fast tier no longer under-selects a lock bump or data read by path (#17203) 7125c9e
- The home says in one line how much is flowing up and down, and opens /forks/flows (#17146) 59563dc
- The forge's boot can run the bundle of src/main.ts, and a test holds its spawn-to-ready under 1.5 s (#17160) 5bbff79
- Keep the phone dock one 44 px row: the Chat/Preview tabs lose the seg padding there too (#17196) 6ce04d3
- The game agent reaches compose where timeout(1) exists: a shell function is never handed to timeout 40253a4
- Hold the Talk pane's Live fallback by its value, not its old word (#17197) 01e9b02
9 earlier comments
A check that replaces a waiting one now takes the older check's createdAt, so main's check keeps its place in line across landings. I did not run the full suite, and I did not run scripts/design-lint.ts, since no page changed.
What changed
CreateRunInputinsrc/core/runs.tstakes an optionalcreatedAt.createRunwrites it withCOALESCE(?16, strftime(...)), so the table's default still applies when none is given.- In
src/checks/request.ts, the transaction records the earliestcreatedAtamong the queued runs it cancels and passes it to the new run. A running check it stops passes nothing on, because that check already had its turn. Ties still break by id, aspickNextdoes. - I changed no budget,
STARVATION_MS,CREW_WAIT_CAP_MS,LAND_SETTLE_MSor concurrency.
Tests
- The new
test/check-supersede-keeps-place.test.tscovers your three cases against a realrequest. For the first two it uses a stub lane with a real app and repository. - Run with the source change stashed, the first (main keeps R1's
createdAt) and third (pickOrderputs R2 before P2) tests fail. With the change, all three pass. - The second test (a stopped running check hands nothing on) passes either way, since it asserts the old behaviour is kept.
test/checks-queue.test.tsandtest/checks.test.tspass, andtsc --noEmitis clean.
Not done, and checks
- There is no terminal or
docs/featureschange. The change is queue ordering only, and the commit line saysNo door: …. scripts/gate.tsraised no error. It noted that two test helpers resemblecommitintest/check-base-moved.test.tsandoldenintest/runs-lease.test.ts. I did not fold them together, because that would touch unrelated tests.- I did not use the
keep_planorestimatetools.
I read the diff against #17229 and it is right.
- An inherited createdAt keeps the database's own format, since it comes from the row it replaces.
- checksForHead and the verdict order by id, not created_at, so they are untouched.
- silenceUnstartedChecks only acts once no check has started or finished for RUNNER_WAIT_MAX_MS. An older place cannot make a live runner read silent. One nit: the .replace(/\.(\d+)Z$/, ".$1Z") in back() does nothing and can go. This is the fix that lets main's check run at all, so please review and land it as soon as its own check is green.
A check that replaces a waiting one now keeps the waiting one's place in line, so main's check is no longer pushed to the back each time a new commit lands (#17229).
What changed
- In
src/checks/request.ts, when a newer commit supersedes a queued check, the new check takes the earliestcreated_atamong the checks it replaced. - A check that was already running had its turn, so it passes nothing on.
createRuninsrc/core/runs.tstakes an optionalcreatedAt. Without it, the column keeps its current "now" default.test/check-supersede-keeps-place.test.tshas three tests, including that the replacing check is picked before a pull check queued after the one it replaced.
Review feedback
- I removed the no-op
.replace(/\.(\d+)Z$/, ".$1Z"). It was in the test'sback()helper, not insrc/, and the test still passes without it. tsc --noEmitis clean and the 3 tests pass. I did not run the full suite; the forge runs it on the push.
Check refusals you listed
- Both doors: the commit says
No door: internal queue ordering, since no page, action, API route or tool changed. - Issue number: both commits are named
Direction: … (#17229). as never: the test uses noas never.- Dead-code test: the new
CreateRunInput.createdAtfield has a caller inrequest.ts, and I added no new exports.
Not changed
gate.tsflagsback()in the test as a duplicate ofoldenintest/runs-lease.test.ts. They update different columns (created_atversusheartbeat_at), so I left both.- The over-100-column comment in
src/core/runs.tsis for the nightly rewrap.
To try it, run bun test test/check-supersede-keeps-place.test.ts.
🤖 Generated with Claude Code
Reviewed: correct, and it is the fix main needs right now. In the last five minutes main's check was superseded unstarted three times (6896d92 at 22:18:56, 0c2f468 at 22:18:59, 8192e6e at 22:20:42), each replacement going to the back of the line; 7e3dfba's is queued behind about ten pull checks now. Two readers of created_at I checked on main: silenceUnstartedChecks only fires after the runner has been idle 10 minutes, so an inherited age can only settle a check the runner was already not answering (no new risk); and pickOrder's starvation boost is exactly what should carry main's check forward. Land this as soon as its own check passes.
The reviewer's latest comment asks for no code change, so I made none. The branch is already pushed at fb6300e9a, and its check will run against that commit.
What this pull does
- A check that replaces a waiting one takes the earliest
created_atamong the checks it replaced (src/checks/request.ts). createRuntakes an optionalcreatedAt(src/core/runs.ts). When it is absent, the column keeps the "now" default.- A check that was already running passes nothing on.
test/check-supersede-keeps-place.test.tshas three tests, including that the replacing check is picked ahead of a pull check queued after the one it replaced.
Readers of created_at
- I did not re-check these myself. I'm relying on your reading of
silenceUnstartedChecksandpickOrder's starvation boost. - My earlier read was that
checksForHeadand the verdict order by id, so they are untouched.
Check refusals you listed
- Both doors: the commits say
No door: …, since no page, action, API route or tool changed. - Issue number: both commits are named
Direction: … (#17229). as never: the test uses none.- Dead-code test: I added no new exports. The one new field,
CreateRunInput.createdAt, is used inrequest.ts.
bun x tsc --noEmit is clean and the three new tests pass. I did not run the full suite, because the forge runs it on the push.
gate.ts flags back() in the test as a duplicate of olden in test/runs-lease.test.ts. They update different columns (created_at versus heartbeat_at), so I left both.
To try it, run bun test test/check-supersede-keeps-place.test.ts.
🤖 Generated with Claude Code
A check that replaces a waiting one now takes over that check's place in line. The new test file and the type check pass. I didn't run the rest of the suite, and the forge's check runs it on the push. The gate has no failures and two notes: a long comment in src/core/runs.ts, and two small test helpers that look like ones in other test files. I left both.
- Ordering:
CreateRunInputinsrc/core/runs.tstakes an optionalcreatedAt.createRunwrites it when given and uses the table's default otherwise. - Supersede: in
request(src/checks/request.ts), when the transaction cancels a run that was stillqueued, the new run inherits the earliest suchcreatedAt. A check that was already running passes nothing on, so a replacement for it goes to the back as before. - Tests:
test/check-supersede-keeps-place.test.tscovers the replacement keeping the cancelled check'screatedAt, and a running check passing nothing on. - Check findings: the four findings you listed are met, and each commit line is named
Direction: … (#17229). The change is internal ordering, with no page, action, route or tool, so no terminal or how-to change was needed. - Not changed: no budget, knob, limit or concurrency change, and no change to
pickNext.
To try it, run bun test test/check-supersede-keeps-place.test.ts.
@mason The check on fb6300e (run 01m8stwhwasg59b4cxmyyf41yn) failed 4 of 28,849, all git-heavy fork tests at bun's 5 s budget: "the last ten follows, newest first…", "fork flows > the MCP tool answers the same data", "a repeat on the same two heads does not run the comparison again". None of them touch createRun's new createdAt or request's supersede. The same follow-history test failed on #17161's check at 22:48 and on #17221, #17177 and #17226 before it (load flake, fixed for that one test by #17260). The runner had 11% disk free.
Please run this check again as it stands, with no new push, and land fb6300e when it passes. It is the one that lets main's own check start, and pulls that are red only on lane flakes wait for main's next green check, so everything held that way waits on this pull.
No code change and no push. Re-running the check and landing the pull are both outside what I can do. I can't trigger a check run, and a person merges.
The branch is at fb6300e. I rebased it onto main while investigating, then reset it to fb6300e. A rebase would have rewritten the commit, and a plain push of a rewritten branch would be rejected as a force push.
Cause. The four failures are not caused by this pull's change (createRun's new createdAt and the supersede path in request). The failing tests are git-heavy fork tests: the last-ten-follows history test, "fork flows > the MCP tool answers the same data", and "a repeat on the same two heads does not run the comparison again". They hit bun's 5 s limit while the runner was loaded, as you described.
What I ran locally. The new test test/check-supersede-keeps-place.test.ts and the three fork test files (fork-flows, fork-follow-history, upstream-counts) pass when run alone. Running those four files together twice, the follow-history test failed once with toBe mismatching and passed once. So it is a load flake, as you said, and I haven't touched it.
What this pull does. A check that replaces a waiting check for the same repo and environment now takes over the replaced check's created_at, so it keeps its place in line. A check that was already running had its turn, so its replacement goes to the back as before. The test covers this.
Needed from a person. Re-run the check on fb6300e as it stands, then merge it once it is green.
No page, action, API route or tool changed.
This pull's only check on fb6300e failed at 22:51, and nothing has re-run it since (the pulls list's "green" is the list bug #17265 fixes). Two of its four reds are fixed now: #17260 landed at 23:04 and splits the follow-history test, and #17269 (for #17268, the /mcp lazy load) is queued. None of the four touch this diff. Please re-run the check on fb6300e as is, with no push, and land it when it is green. Main's own check is still waiting in line behind pull checks (queued since 23:15), which is the problem this pull fixes.
Re-running the check on fb6300e is not something I can do from here, and I made no push. I can't trigger a check, and a person lands the pull. The branch is still at fb6300e, which has no code change since the failed run.
I also looked at the four things the check refuses most often. None of them applies to this diff:
- Both doors: the pull changes no page, action, API route or tool. The commit line says
No door: internal queue ordering; no page, action, API route or tool changes. - Tests building the real input: the new test
test/check-supersede-keeps-place.test.tsdoesn't useas never. - Dead-code test: this pull adds no new export. It adds an optional
createdAtfield to the existingCreateRunInput, andrequestuses it. - Issue number in the commit line: both commits carry
(#17229)in theDirection:form.
The pull description follows.
What changed. A check that replaces a waiting check for the same repo and environment now takes over the replaced check's created_at. It keeps its place in line instead of going to the back, which stops pull checks starving main's own check.
src/checks/request.tsrecords the earliestcreatedAtamong the queued checks it supersedes.src/core/runs.tsletscreateRunaccept an optionalcreatedAt. Without one it still uses the database default.- A check that was already running had its turn, so its replacement queues at the back as before.
test/check-supersede-keeps-place.test.tscovers both cases.
What I chose not to do. I did not touch the fork-follow-history, MCP or upstream-counts tests that failed on fb6300e. They are git-heavy fork tests that hit the 5 s limit under load. Locally they pass alone, and the follow-history one failed once in two runs of the four files together. Neither #17260 nor #17269 touches this diff.
How to try it. Run bun test test/check-supersede-keeps-place.test.ts. Queue a check, push a newer commit while it waits, and the new run keeps the old one's created_at. A person needs to re-run the check on fb6300e as it stands and land the pull once it is green.
A check that replaces a waiting one now takes the older check's
createdAt, so main's check keeps its place in line across landings. I did not run the full suite, and I did not runscripts/design-lint.ts, since no page changed.What changed
CreateRunInputinsrc/core/runs.tstakes an optionalcreatedAt.createRunwrites it withCOALESCE(?16, strftime(...)), so the table's default still applies when none is given.src/checks/request.ts, the transaction records the earliestcreatedAtamong the queued runs it cancels and passes it to the new run. A running check it stops passes nothing on, because that check already had its turn. Ties still break by id, aspickNextdoes.STARVATION_MS,CREW_WAIT_CAP_MS,LAND_SETTLE_MSor concurrency.Tests
test/check-supersede-keeps-place.test.tscovers your three cases against a realrequest. For the first two it uses a stub lane with a real app and repository.createdAt) and third (pickOrderputs R2 before P2) tests fail. With the change, all three pass.test/checks-queue.test.tsandtest/checks.test.tspass, andtsc --noEmitis clean.Not done, and checks
docs/featureschange. The change is queue ordering only, and the commit line saysNo door: ….scripts/gate.tsraised no error. It noted that two test helpers resemblecommitintest/check-base-moved.test.tsandoldenintest/runs-lease.test.ts. I did not fold them together, because that would touch unrelated tests.keep_planorestimatetools.Closes #17229