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

Flaky test: a child forge spawned into a cell serves its app at <app>--<child>--<parent> #10683

opened this in answer to

Merged 25d 12h ago, live in production

This is a likely cause of the flake, not a confirmed one. I couldn't reproduce it, because bwrap and socat aren't available here and the test skips. tsc is clean and the test run only confirmed it skips.

Notes

opened this

This is a likely cause of the flake, not a confirmed one. I couldn't reproduce it, because bwrap and socat aren't available here and the test skips. tsc is clean and the test run only confirmed it skips.

Cause. The 150 s polling deadline in test/helpers/real-spawn-e2e.ts only started after spawnForge and bootHostedChild had finished. Under load those two steps can take minutes. When that happened, the helper's total time went past the test's 200 s timeout, so the test failed on a timeout. Run alone, the machine is quiet, so it passed. That fits the issue's two failures and the green reruns.

Change.

  • Helper: the deadline now counts from the helper's start, 170 s in total, so spawn and boot use up the same budget as the polling.
  • Test: the spawned helper process is now killed at 210 s, so a stuck run can't leave a child forge behind. The test timeout is 230 s, above both.

Not done. I didn't change what the test asserts, and I didn't try to make spawn or boot faster.

To try it. Run bun test test/spawn-cell-e2e.test.ts on a host with bwrap and socat. The forge's check runs it on push.

Closes #10593

2 earlier comments
commented

This is a likely cause of the flake, not a confirmed one. I couldn't reproduce it, because bwrap and socat aren't available here and the test skips. tsc is clean and the test run only confirmed it skips.

Cause. The 150 s polling deadline in test/helpers/real-spawn-e2e.ts only started after spawnForge and bootHostedChild had finished. Under load those two steps can take minutes. When that happened, the helper's total time went past the test's 200 s timeout, so the test failed on a timeout. Run alone, the machine is quiet, so it passed. That fits the issue's two failures and the green reruns.

Change.

  • Helper: the deadline now counts from the helper's start, 170 s in total, so spawn and boot use up the same budget as the polling.
  • Test: the spawned helper process is now killed at 210 s, so a stuck run can't leave a child forge behind. The test timeout is 230 s, above both.

Not done. I didn't change what the test asserts, and I didn't try to make spawn or boot faster.

To try it. Run bun test test/spawn-cell-e2e.test.ts on a host with bwrap and socat. The forge's check runs it on push.

commented

This is still a hypothesis. I couldn't run the test here (no bwrap or socat, so it skips), and tsc is clean.

What changed

  • Separate budgets: spawn and boot get 120 s, and the poll gets its own 150 s that starts after boot ends. A slow spawn no longer shortens the poll. I added this because of your first point.
  • Phase named in the failure: if spawn and boot run out, the error says "the spawn and boot phase did not finish in 120s". A poll that runs out still comes back as the helper's usual seen result, with its status and body.
  • Timeouts: the test kills the helper at 290 s and times out at 310 s. Those are the 120 s and 150 s budgets plus slack.
  • SIGTERM cleanup: the helper now handles SIGTERM by stopping the server and calling stopCellChildren, then exiting 143. I haven't exercised this path, since no cell can start here.

Evidence, which is thin

  • I couldn't tie the two failures to a timeout. Issue #10593 has no comments, and I can't read the check logs.
  • The timeout theory comes from the code. Spawn and boot ran outside the 150 s poll, so a loaded machine could pass 200 s. The issue also says the test passed when run alone.
  • If the two failures were not timeouts, this change won't fix them. It does make the next one say which phase failed. Please check the failure messages in check run 01m71xew03k2k1a05rzpkbw2pc to confirm.

Not done: no README or dependency change, and no change to what the test asserts.

One slip: the previous push left tsc red for one commit. It's fixed in the latest push.

commented

This gives the cell end-to-end test a time limit for each phase, so a run that runs out of time says which phase did. This is a hypothesis, not a confirmed fix. Neither of the two flaky failures in #10593 has a failure message I could read, so nothing yet ties them to a timeout. The test also could not run here: the sandbox has no bwrap or socat, so the test skips. If the next failure names the spawn-and-boot phase, the hypothesis holds. If it's a mismatch at status 200, the cause is something else and this doesn't fix it.

The suspected cause: the 150 s polling window only started after spawnForge and bootHostedChild had finished. On a loaded machine those two steps plus polling could run past the test's 200 s limit, so the test failed under load in the full check but passed when run alone.

What changed (test/helpers/real-spawn-e2e.ts, test/spawn-cell-e2e.test.ts):

  • Spawn and boot are now one named function, spawnAndBoot, with a 120 s budget. If it runs out, the error reads the spawn and boot phase did not finish in 120s.
  • Polling gets its own 150 s, starting after boot ends. A slow spawn no longer shortens it.
  • Teardown (the finally block and a new SIGTERM handler) waits up to 15 s for spawnAndBoot to finish before stopping cell children. A child that work starts late is still stopped. If spawning is still stuck after those 15 s, a child it starts later could still be left running.
  • Limits: the test kills the helper process at 290 s and times out at 310 s, which is the two budgets plus slack. A passing run is no faster or slower than before; only the worst case is bounded.
  • No README, dependency or src/ changes.

Where I disagree: the 310 s limit is long, but it is the real worst case for an end-to-end test that boots an actual cell. Making it shorter without speeding up spawn and boot would bring the flake back. Making spawn faster is a separate change to src/spawn/, not part of this pull.

bun x tsc --noEmit and bun scripts/gate.ts pass. bun test test/spawn-cell-e2e.test.ts skips here. The forge's check runs it for real.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs