Repository navigation
test(link): make the ssh runner test guard a hang guard, not a timing race - #8582
Conversation
… race bounded() raced a 250 ms wall-clock guard against the runner's own 25 ms deadline. On a stalled macOS CI host (dev batch run 43063783324, macos 3/4) the guard won and "late stdin end and exit rejections after timeout are observed" failed with the guard's message instead of the runner's timeout. The guard is now 2 s, inside Bun's default 5 s test timeout so a real hang still fails with the same message, and it yields one macrotask before rejecting so a settlement queued by the same timer batch wins. The runner is unchanged.
|
✅ Deterministic PR hygiene checks passed. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@lidge-jun Could you run the full cross-platform CI on current The PR checks passed, but their macOS and Windows jobs were skipped. In the earlier dev run https://github.com/lidge-jun/opencodex/actions/runs/43063783324, macOS failed on the usage-filter index contention fallback and the SSH runner timeout test. Please confirm those two cases pass on native macOS, along with the overall Linux/Windows/macOS results. Thank you. |
Summary
The
devbatch run 43063783324 (852bc147b6) failed on macos 3/4 attests/clients/link-ssh-runner.test.ts:152, "late stdin end and exit rejections after timeout are observed". The test expected the runner'stimeoutrejection and got the helper's own "run did not settle within the test deadline".The fault is in the test helper.
bounded()raced a 250 ms wall-clock guard against the runner's own 25 ms deadline, so it acted as a second timer competing with the one under test. The failing case took 420.73 ms, so the runner VM had stalled for well over 250 ms, and the guard won.bounded()is now a hang guard and no longer a timing assertion:The runner (
src/link/ssh-runner.ts) is unchanged.No code change from #8551 or #8559 is involved. #8551 left the
run()timeout path byte-identical: it only added a stderr line-tap branch thatrun()never enables. #8559 didn't touch the runner. #8551 did add newlink-ssh-capture*test files, which changed which files share this test's CI batch, so a load or timing shift from batch composition can't be ruled out. The fix doesn't depend on that question. The test file hasn't changed since #6955 (October). None of the 20 earlier faileddevbatches (2026-10-30 to 2026-11-11) failed any test in this file. This batch is the first time it showed up.Reproduction. I could not reproduce the failure deterministically on local macOS with Bun 1.4.4, the same version as CI:
bun test --isolate --parallel=1 --timeout 60000): 14 runs, 8 of them under 24 CPU hogs, 0 failures.--rerun-each 40: 1160 pass, 0 fail.--isolate: all pass.setImmediate, or a +1 ms timer.So the runner path is sound on this host. The CI failure needed a stall that local runs don't produce, and the fix removes the helper's dependence on two independent timers firing in order.
Verification
bun test tests/clients/link-ssh-runner.test.ts: 29 pass, 0 fail.bun test --isolate --parallel=1 --timeout 60000 tests/clients/link-ssh-runner.test.ts --rerun-each 20: 580 pass, 0 fail.cancellation.abort()from the runner as a temporary mutation, then restored it. The 11bounded()tests that depend on that abort (14 tests use the helper; the 3 output-limit cases reject without it) all failed at about 2 s with "run did not settle within the test deadline".bun checkon the test file reports one existing TS2769 at what is now line 214 (line 204 ondev). It isn't introduced here, and test files are outsidebun run typecheck.NOT RUN: full
bun run test, a macOS CI rerun (the coordinator runs thedevbatch), any deterministic local reproduction of the CI stall.Checklist
Summary by CodeRabbit