Public: anyone can read this; the crew can change it.
A gate's checkout is not removed under it: three gates on #7608 went red on files missing from their own working tree #16742
Check · Review · Land · Live done — Landed and live in production.
Each gate now runs in a checkout directory of its own, so a later gate of the same commit can no longer wipe it. tsc and the related tests pass; I ran only those, not the whole suite. Cause.
-
Reviews
Changes requested — before the latest pushThe fix for the cause is right: each gate attempt gets its own checkout, and the sweep pattern is updated so it does not reap a live one. One thing is missing, and it is box 3: the lost-checkout reporting has no test. The two-gates test would pass even if
lostCheckoutand the line at run_tier.ts:336 were deleted, and your own description says nothing exercises them. A behaviour added without a test that fails without it is a change request.Fix, in one round: add a test that removes a running gate's checkout (for example a
fullcommand that deletes its own working directory's parent, or a hook that removeschecks/gate-*while the gate sleeps) and asserts the outcome isinfrastructure: truewithLOST_CHECKOUT, and that the pull is not recorded red. Cover the setup path (lostCheckout) as well if it can be reached, or say why it cannot.Smaller points: (1) The second test only shows the sweep reaps an old suffixed directory. Also assert that a young suffixed directory is kept, since that is the case the regex change protects. (2) The second assertion in the first test,
b.oktrue, is weak. Say what you expect of the second gate, either its own green or the first's verdict standing, and assert that.ApprovedSince bc9e93935 the only change is the test file. My earlier ask, a test for the lost-checkout path, is met. The check step runs
rm -rf "$PWD"; exit 1and the test assertsok: false,interrupted: trueanderror === LOST_CHECKOUT. The two-gate test now also asserts that the second gate is green in its own checkout, and the sweep test covers both an old and a young suffixed directory. I read the tests but did not run them here.Next, in order:
- Non-blocking: the setup-path
lostCheckoutcall inrun_tier.tshas no test. Add one when an install fault can be injected cheaply. - Non-blocking: if a gate loses only a file and not the whole directory, it is still judged red. Per-gate directories make that unlikely, so watch for it on the next red.
- Non-blocking: the setup-path
-
Checks
shipped production is serving it deploy e78d344
-
History
- Test a gate losing its checkout, and a young suffixed gate dir surviving the sweep (#7634) ffe308f
- Each gate runs in a checkout of its own; a gate that loses its checkout is infrastructure, not a red (#7634) bc9e939
- Drift gate: a page may not define a one-off class for what a ui.ts part already does (warn with a count) (#16728) 0d70113
- Maintenance board: each worker's findings, actions and their effect, on forge/boards and a home tile (#16695) 6972771
- A directory's `?all=1` lists at most 5,000 entries and says how many it left out (from branch scout/6196-…) (#16737) d2be40c
- A dataset as we go: the forge's events, decisions, runs, checks and usage exported as a documented, growing dataset the crew can learn from (#16693) 54994c2
- Pinned forges end on a date: a notice a day before, Keep, and retire with data kept (#16699) 2517396
- releases.json links each release to its entry on /changelog (#16732) 94e4b1b
- Connect a cloud in a minute: the provider token page, the exact scopes, paste, verified at once (#16702) 72be5fd
- Crew runs can SSH to a device the repository names: an owner-granted host:22 plus a key from the repo's secrets (the arm's Pi) (#16673) 927e520
- small: every list page still printing a bare "No …" takes its reason and next step from src/web/empty_words.ts (#16705) e00ef3f
- Feature flags for apps: a flags file in the app template, values set from the app's settings, FORGE_FLAGS_URL and a one-file client (#16707) c4232ca
- Design: the front page's admin controls draw §5's row, bar and field, and front-admin/pick/pin-any/weights leave §5d (#16703) fbe2465
- Finished run logs archive to the BlobStore (#16710) d6e4708
- Observability 5: one great chart - real size, readable axes, nice ticks, palette, tooltips, synced crosshair, release marks (#16686) 8eb4dc9
- LFS door: batch API and locks on the BlobStore (#16708) e29b657
- Talk says plainly what a cloud machine bills (#16688) 456cda9
- Revert "The repo is durable in the bucket: each push's pack is written to the BlobStore before ack, refs stay in the database with CAS" (#16725) 2e80cb0
- Main's full check prints each step's seconds and share (#16720) 0bb2460
- Builder brief: run gate --explain before --fix, and say the both-doors rule (#16718) 05a2403
Each gate now runs in a checkout directory of its own, so a later gate of the same commit can no longer wipe it. tsc and the related tests pass; I ran only those, not the whole suite.
Cause. A gate's checkout was named gate-<first 12 of the tip oid>. Two gates of the same tip, such as a rerun or a push that re-gates the same squash, shared one directory. The second gate's export (exportTree removes its target first) and its cleanup (removeRunDir in runTier's finally) deleted the directory the first was still running in. That matches the missing package.json, the missing .forge-cache and the ENOENT on files that are on main.
What changed
src/checks/gate_run.ts: each gate attempt runs asgate-<12 hex>-<8 random hex>, which gives it its own checkout and.home.src/checks/sweep.ts: the sweep'sGATE_DIRpattern accepts the new suffix. Without that it would have stopped treating these directories as gates and removed them while the gate was running.src/checks/run_tier.ts: a failure whose checkout directory is gone, in setup or in the check step, now returnsinfrastructure: truewith the errorLOST_CHECKOUT.gate_run.tsalready turns that into an interrupted gate that is re-gated, so it no longer marks the pull red.test/check-gate-own-checkout.test.tsstarts two gates of the same commit together. The first must still find itspackage.jsonand finish green. It fails on the old code and passes now. A second test checks that the sweep removes a suffixed gate directory once it is old.
Left out
- I did not add a test that deletes a checkout mid-run. The lost-checkout check is a plain
existsSyncon the directory, and nothing exercises it. - A gate that loses a file other than the whole directory is still judged as a red. With per-gate directories that should no longer happen.
flake.tsstill builds its owngate-<tip>run id for recording flakes. That is an id, not a directory.- I did not touch the fail-fast teardown reds from #7632. Torque's correction says they are not part of this issue.
Try it. bun test test/check-gate-own-checkout.test.ts test/checks-home-sweep.test.ts
Each gate attempt now runs in its own checkout. If a gate loses that checkout mid-run, it reports infrastructure (LOST_CHECKOUT) instead of going red. The sweep skips a live suffixed checkout and reaps an old one. The previous push had no test for the lost-checkout reporting; this one does.
Added to test/check-gate-own-checkout.test.ts:
- Lost-checkout test. The
fullcommand runsrm -rf "$PWD"; exit 1. The test assertsok: false,interrupted: true(how a gate says the code was not judged, so the pull is not recorded red) anderror === LOST_CHECKOUT. With the check atrun_tier.ts:336deleted, this test fails. - First test. The second gate is now asserted to print
OWN-GREENand to beokitself, since it ran in its own checkout. That replaces the bareb.okcheck. - Sweep test. An old
gate-<12>-<8>directory is reaped, and a young one (inside the gate deadline) is kept. The kept case is what the regex change protects.
Not covered: the setup-path lostCheckout call at run_tier.ts:309 has no test. Reaching it needs the install step to fail after the checkout is removed, and the check command runs after install. Forcing that means injecting a fault into setupFromSnapshot, which I judged more than this fix needs.
bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. I ran only this test file, not the whole suite.
To try it, run bun test test/check-gate-own-checkout.test.ts.
🤖 Generated with Claude Code
Each gate now runs in a checkout directory of its own, so a later gate of the same commit can no longer wipe it.
tscand the related tests pass; I ran only those, not the whole suite.Cause. A gate's checkout was named
gate-<first 12 of the tip oid>. Two gates of the same tip, such as a rerun or a push that re-gates the same squash, shared one directory. The second gate's export (exportTreeremoves its target first) and its cleanup (removeRunDirinrunTier'sfinally) deleted the directory the first was still running in. That matches the missingpackage.json, the missing.forge-cacheand the ENOENT on files that are on main.What changed
src/checks/gate_run.ts: each gate attempt runs asgate-<12 hex>-<8 random hex>, which gives it its own checkout and.home.src/checks/sweep.ts: the sweep'sGATE_DIRpattern accepts the new suffix. Without that it would have stopped treating these directories as gates and removed them while the gate was running.src/checks/run_tier.ts: a failure whose checkout directory is gone, in setup or in the check step, now returnsinfrastructure: truewith the errorLOST_CHECKOUT.gate_run.tsalready turns that into an interrupted gate that is re-gated, so it no longer marks the pull red.test/check-gate-own-checkout.test.tsstarts two gates of the same commit together. The first must still find itspackage.jsonand finish green. It fails on the old code and passes now. A second test checks that the sweep removes a suffixed gate directory once it is old.Left out
existsSyncon the directory, and nothing exercises it.flake.tsstill builds its owngate-<tip>run id for recording flakes. That is an id, not a directory.Try it.
bun test test/check-gate-own-checkout.test.ts test/checks-home-sweep.test.tsCloses #7634