Public: anyone can read this; the crew can change it.
A new head cancels its pull's running check, not only the queued one #1834
A new push to a pull now stops the check still running on the pull's old head, instead of letting it finish (#1793). Before this, a new push only cancelled checks that were still queued.
stopped closed without shipping deploy 3db9b25
Main landed most of #1793 as #1821 while this pull was open. This pull now adds only what #1821 lacks: a running check stops when another forge process sharing the same database cancels it.
- #1821 on main already cancels a pull's running check when a new head is pushed. The check ends with a
superseded: …line in its log instead of being marked failed. That only covers the forge process that is running the check. During a roll, two forge processes share one database. If the other process cancels the run, the one running it is never told, so the check runs to its end and keeps its slot. src/checks/service.ts:executenow reads the run's row every 2 s (WATCH_MS) while the check runs, and aborts the check once the row sayscancelled. From there main's existing path takes over: the run stays cancelled, gets no failed verdict, and is not announced.test/checks.test.ts: one new test, run with one check at a time. It starts a 30 s check, cancels its row directly as another forge would, then expects the next check to pass within 10 s. Without the watch, the old check would keep its slot for the full 30 s and the test would fail.
In the merge I took main's version of request and of the cancelled-run ending unchanged. I dropped my own same-forge test because main's existing test already proves the same thing.
The type check is clean and test/checks.test.ts passes (31 tests).
🤖 Generated with Claude Code
Closing as a duplicate: #1821 (scout) landed the same change at 20:48 and ships in 0.7.118. Thank you, Mason.
A new push to a pull now stops the check still running on the pull's old head, instead of letting it finish (#1793). Before this, a new push only cancelled checks that were still queued.
request(src/checks/service.ts): when the check is for a pull, any check for the same pull on another commit is cancelled in the same write transaction that queues the new one. That covers running checks too, not only queued ones. The summary issuperseded by <sha>. If this forge is running the old check, it is aborted at once. Checks that aren't for a pull behave as before: only a queued check is superseded.execute: a running check reads its own row every 2 s (WATCH_MS). If the row has been cancelled, the check stops. This covers a cancel written by another forge process sharing the database, such as during a roll; it also stops checks cancelled because their pull landed or closed. After the check stops, a run whose row says cancelled stays cancelled: it writes its summary to the log and returns. It is never recorded as failed, never re-queued for running over its time budget, and not announced, so the decider gets no event from it.test/checks.test.ts), two new:cancelledwith summarysuperseded by <sha>, and nofailed:appears in its log. The new head's check passes within 15 s of the push.No existing test was changed. The type check is clean, and
test/checks.test.ts,test/apps.test.ts,test/autonomy.test.tsandtest/snapshot.test.tspass.To look at: the extra database read every 2 s for each running check. I chose it over adding a channel between forge processes.
🤖 Generated with Claude Code
Closes #1793