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

A check that started and has written nothing is found and asked again, so six… #16111

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

Three of the four items are done. The main-thread pauses are not: I found no cause and filed #16108 for the profile. Typecheck passes and scripts/gate.ts reports nothing after --fix.

Notes

shipped production is serving it deploy b03b44b

opened this

Three of the four items are done. The main-thread pauses are not: I found no cause and filed #16108 for the profile. Typecheck passes and scripts/gate.ts reports nothing after --fix. I ran the new tests and the related ones (check budget, restart, vitals, telemetry, autonomy), and all pass. I did not run the whole suite. scripts/fast.ts reported the diff too broad to name tests, so I picked them myself. The forge's full check still runs on this push.

What changed

  • Stalled checks. A running check that has written nothing and has no check_job row for 5 minutes is stopped and queued again once, with the log line interrupted: started, wrote nothing and was offered to no runner; queued again. The second time it fails with check stalled: started and wrote nothing, offered to no runner, twice; not trying again.
    • The 5 minutes is generous: a healthy check writes in seconds and offers its job soon after. It is still far below the 2.5 hours of 2026-11-23.
    • The check is raced against the stall timer, so the slot is freed even if the runner never answers the abort. The abandoned check keeps running in the background.
    • The code is src/checks/stall.ts, src/checks/execute.ts and STALLED_SUMMARY in src/core/runs.ts.
    • test/check-stall.test.ts uses a runner that never returns: the slot frees, the check is queued again once, then fails.
  • Git reader deadline. Every read through a pooled cat-file reader now has a 30 s deadline (READER_DEADLINE_MS). Past it the process is killed and dropped, the caller gets a ReaderTimeout, and the next read starts a fresh process. A late reply from the killed process can't affect its replacement. test/reader-deadline.test.ts uses a reader that never answers.
  • Vitals. src/flow/silent_checks.ts counts checks that have been running for 10 minutes or more with an empty log. The miss reads N checks have run M minutes with nothing written, and it appears in the misses of GET /api/v1/telemetry/flow, in the crew tick's offTarget and on the flow screen.
    • readVitals and sharedVitals take an optional dataDir to read the logs. Callers that don't pass it get no silent-check field, so existing readers are unchanged.
    • test/check-stall.test.ts covers the miss.

Not done

  • The long pauses. I could not profile with about 420 cells here. The sweep in src/apps/egress.ts is a few lines, and my guess is it is only the timer that fires when a long pause ends. A garbage collection on a heap near 8 GiB is the likelier cause, but that is a guess. I changed nothing in egress.ts and filed #16108 for a profile on the stage rig.
  • The stuck reader. I did not prove that a stuck cat-file reader caused the stall. The reader deadline and the stall watchdog each stop that failure whatever the cause turns out to be.
  • Slow checks. A check that has written at least one line and then hangs is still bounded only by its normal budget, not by the stall watchdog.

Try it: on /flow, or in the misses of GET /api/v1/telemetry/flow, a running check that is 10 or more minutes old with an empty log shows the new miss. To run the new tests: bun test ./test/check-stall.test.ts ./test/reader-deadline.test.ts.

🤖 Generated with Claude Code

Closes #16105

2 earlier comments
commented

Three of the four items are done. The main-thread pauses are not: I found no cause and filed #16108 for the profile. Typecheck passes and scripts/gate.ts reports nothing after --fix. I ran the new tests and the related ones (check budget, restart, vitals, telemetry, autonomy), and all pass. I did not run the whole suite. scripts/fast.ts reported the diff too broad to name tests, so I picked them myself. The forge's full check still runs on this push.

What changed

  • Stalled checks. A running check that has written nothing and has no check_job row for 5 minutes is stopped and queued again once, with the log line interrupted: started, wrote nothing and was offered to no runner; queued again. The second time it fails with check stalled: started and wrote nothing, offered to no runner, twice; not trying again.
    • The 5 minutes is generous: a healthy check writes in seconds and offers its job soon after. It is still far below the 2.5 hours of 2026-11-23.
    • The check is raced against the stall timer, so the slot is freed even if the runner never answers the abort. The abandoned check keeps running in the background.
    • The code is src/checks/stall.ts, src/checks/execute.ts and STALLED_SUMMARY in src/core/runs.ts.
    • test/check-stall.test.ts uses a runner that never returns: the slot frees, the check is queued again once, then fails.
  • Git reader deadline. Every read through a pooled cat-file reader now has a 30 s deadline (READER_DEADLINE_MS). Past it the process is killed and dropped, the caller gets a ReaderTimeout, and the next read starts a fresh process. A late reply from the killed process can't affect its replacement. test/reader-deadline.test.ts uses a reader that never answers.
  • Vitals. src/flow/silent_checks.ts counts checks that have been running for 10 minutes or more with an empty log. The miss reads N checks have run M minutes with nothing written, and it appears in the misses of GET /api/v1/telemetry/flow, in the crew tick's offTarget and on the flow screen.
    • readVitals and sharedVitals take an optional dataDir to read the logs. Callers that don't pass it get no silent-check field, so existing readers are unchanged.
    • test/check-stall.test.ts covers the miss.

Not done

  • The long pauses. I could not profile with about 420 cells here. The sweep in src/apps/egress.ts is a few lines, and my guess is it is only the timer that fires when a long pause ends. A garbage collection on a heap near 8 GiB is the likelier cause, but that is a guess. I changed nothing in egress.ts and filed #16108 for a profile on the stage rig.
  • The stuck reader. I did not prove that a stuck cat-file reader caused the stall. The reader deadline and the stall watchdog each stop that failure whatever the cause turns out to be.
  • Slow checks. A check that has written at least one line and then hangs is still bounded only by its normal budget, not by the stall watchdog.

Try it: on /flow, or in the misses of GET /api/v1/telemetry/flow, a running check that is 10 or more minutes old with an empty log shows the new miss. To run the new tests: bun test ./test/check-stall.test.ts ./test/reader-deadline.test.ts.

🤖 Generated with Claude Code

commented

This fixes the failing gate rule, and the fix is pushed. The forge's check hasn't run on it yet.

test/check-stall.test.ts set process.env["FORGE_CELLS"] = "off" at the top level and never put it back. It now saves the prior value and sets FORGE_CELLS=off in beforeAll. afterAll restores or deletes it. The save line also carries the // env-restored: afterAll marker.

After the fix, bun scripts/gate.ts reports no failing rule. It still prints two notes, neither of which blocks:

  • Long comments: three files have comment lines over 100 columns. The note says the nightly rewrap handles them on main.
  • Duplicate logic: sharedVitals in src/flow/vitals.ts is flagged as 0.61 similar to sharedParked in src/flow/parked.ts. I left it, because this fix is about the test's environment.

bun x tsc --noEmit is clean. bun test test/check-stall.test.ts passes (2 tests).

The gate only judges committed diffs, so it kept flagging line 19 until I committed the change.

🤖 Generated with Claude Code

commented

The two audit tests that came back red on the last check, timers-named and spawn-argv, now pass here. I haven't confirmed the other two red tests, and the forge's check hasn't run on this push yet. The gate and tsc are clean.

  • Timers: src/checks/stall.ts and src/git/read.ts each add a one-shot deadline timer that only settles a promise. I listed both in test/timers-named.test.ts as deadline timers.
  • Spawn: src/git/read.ts runs Bun.spawn([...this.command, this.mode]). The command is a constructor seam that defaults to ["git", "cat-file"], and only tests pass another. I added it to scripts/spawn-argv-allow.json with that reason.
  • Not reproduced: openapi-covers-routes and pull-check-again, which holds "asking again over HTTP", pass when I run them alone. The check log shows openapi-covers-routes green on main, so I couldn't find a cause. If either is still red on this push, the next log should show whether it depends on test order. This is the one open risk.
  • Not run: I couldn't run the wider set of tests this change reaches (scripts/fast.ts named 3529 files). I stopped that run, so the forge's check will be the first to run them.

🤖 Generated with Claude Code

Approved

Approved. I opened the preview: / answered 200 and /flow answered, and the page loads. The screenshots are outside what my file tools may read, so I did not see them. The silent-check miss only shows when a check is stuck, which the preview does not have, so the tests carry that behaviour. The change frees a lane slot held by a check that never wrote or offered a job, puts a deadline on a stuck cat-file reader, and says silent checks in the vitals and the flow screen. That fits the pipeline-first direction. Each behaviour has a test, and the timer and spawn audits are updated.

Two things I would do next:

  1. Split bundles like this into single-purpose pulls: the stall watchdog, the reader deadline and the vitals miss are three concerns. Also make the watchdog recheck rather than fire once, since a check that writes one line and then hangs is still only bounded by its normal budget.
  2. Add a short docs/features/ note for the new vitals miss, and loosen the timing in test/check-stall.test.ts (a 20 s give-up on a 50 ms poll is timing-sensitive). If openapi-covers-routes or pull-check-again, which the builder could not reproduce, are red on the forge check, chase the order dependence.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs