CI `test` can stall after the last test result until the 30-minute job limit, so the `run-tests.ts` re-run never runs

Author: 22nsukCreated Sep 27, 2026Updated Sep 28, 2026

Summary

On at least two CI runs, one on main and one on a PR, bun run test stopped producing output about six minutes in. It never printed the suite summary, and the job was cancelled at timeout-minutes: 30. Cleanup then terminated three orphaned bun processes. Both stalls came right after the same test group in tests/skills/ce-work-cross-model-routes.test.ts.

This differs from the shape documented in docs/solutions/developer-experience/bun-parallel-worker-loses-subprocess-exit.md. That doc covers tests that fail at exactly the per-test timeout and are recovered by the serial re-run in scripts/run-tests.ts. Here the first bun test --parallel pass never exits. run-tests.ts waits on it with a spawnSync that has no timeout, so the re-run logic never runs. The job then spends about 24 minutes idle before GitHub cancels it.

Evidence

Run Ref Run tests started Last test result Cancelled Failures printed before stall
36030803525 main push, 7e705b68 (#1772) 16:56:27 17:03:20 17:26:31 none
36339941640 PR #1699, c97d9487 18:15:14 18:21:20 18:45:17 2 (see below)

Common to both runs:

  • The last result line is from ce-work adapter results, identity, and secret handling (tests/skills/ce-work-cross-model-routes.test.ts). In the PR run it is that file's final test, the worker result schema pins terminal and scope-expansion shapes.
  • The logs contain no Ran N tests across M files line and no output from the run-tests.ts re-run.
  • Every one of the 175 test files appears in a group header. The PR run printed 4,310 distinct test results (the main run 4,307); a local run of the same tree reports 4,323 tests. Nearly all results were reported before the stall.
  • Post-job cleanup logs Terminate orphan process: pid (...) (bun) three times.

The PR run's two printed failures match the known lost-child-exit signature: cross-model-adversarial-review skip paths ... surfaces short provider errors without dropping the diagnostic at 30030ms, and ce-babysit-pr pr-snapshot engine > watch: takeover interrupts and reaps an active fetch subprocess at 5019ms. The main run printed no failures before it stalled.

For comparison, the green main run 36176331686 (a763b392) finished Run tests in about 2.5 minutes.

What is and is not established

  • Established: the job-level symptom and its timing in both runs, the missing summary line, and the three orphaned bun processes at cleanup.
  • Not established: which worker or file failed to exit. It could be a wedged worker that never reports completion, a test file's afterAll blocked on a lost child exit, or the parallel coordinator waiting on a worker that has already finished its tests. The logs alone do not distinguish these.
  • Not reproduced locally. On WSL2 Linux with Bun 1.4.2, bun run test on c97d9487 finished in about 60s: 4,319 pass, 1 skip, 3 timing failures in peer-job-runner and ce-pov-cross-model-routes. The same doc notes that a many-core machine is a poor proxy for the 4-core runner.
  • Plausibly the same bun defect the doc cites (oven-sh/bun#34069, #41024), surfacing at a point where no per-test timeout applies. That is a hypothesis, not a finding.

Why it matters

A stalled pass costs 30 minutes of runner time and yields no failure report. Because the wrapper never regains control, the existing recovery path cannot help, and the cancelled job carries less diagnostic information than an ordinary red run. It also blocks unrelated PRs: #1699 changes only skill prose and eval catalog entries, and its changed tests pass.

Possible directions (not a proposed patch)

  • Bound the first pass in scripts/run-tests.ts by wall-clock time, well under the job limit. When the bound fires, name the files with no reported result and treat the pass as failed, rather than letting GitHub cancel the job.
  • Leave some headroom between that bound and timeout-minutes so post-failure diagnostics (open processes, the partial junit report) can be printed.
  • Keep the existing rule that only TimeoutError-only first passes are re-run; a stalled pass is a different signal and should not silently turn green.

Related: docs/solutions/developer-experience/bun-parallel-worker-loses-subprocess-exit.md, #1745 (a separate fixture-cache failure in non-isolated runs; CI uses --parallel, so it does not explain this), #1699 (where the PR-side stall was observed).

Source: EveryInc/compound-engineering-plugin