Timing-sensitive tests block merges on loaded runners (three today)
Three separate tests failed today for timing reasons rather than defects, across five pull requests, and between them they blocked every merge for most of the day. Filing the pattern rather than a fourth individual bug, because the individual fixes are already in and the shape is what matters.
The three
bounded_child::tests::continuously_writing_setsid_escape_cannot_hold_pipe_workers (Linux). The launcher exited before the escaped writer was scheduled, so run collected an empty pipe from a finished parent and returned Ok. Failed on three unrelated PRs including a contributor's. Fixed in #799, measured under CPU saturation: 6 failures in 25 runs before, 0 in 25 after.
uses exactly two persistent shared slots across more than 64 corpus lifetimes (Windows). 80 worker process lifecycles against a 30s limit, landing at 30024ms. Missed by 24 milliseconds and reported nine further tests in the same file as failures purely because the first one timed out. Fixed in #799.
never returns outside bytes across a Windows parent junction swap (Windows). Passed in 543ms on #801 and failed at 2420ms on #797 in the same hour, neither of which touches secure-read. Not yet fixed.
What they have in common
Each asserts a real invariant, and each expresses it as "this finishes within N", where N was chosen on an unloaded machine. GitHub's runners are shared and Windows process creation is slow, so N is not a property of the code under test. When the machine is busy, the test reports a defect that is not there.
The cost is not just a red check. It is that a red check stops meaning anything: today I very nearly attributed one of these to a change of my own, and the only thing that disproved it was running the unmodified tree under the same load and watching it fail more.
Suggested direction
Not proposing a blanket timeout increase. Each of these has a better fix available, and the first two show the pattern:
- Where a deadline is incidental to the assertion, make the wait bounded but generous, and keep the strict assertion on the thing actually under test. The corpus test asserts slot reuse, not speed, so its limit was the right thing to relax.
- Where the test races a scheduler, make it synchronize instead of hoping. The setsid test now waits for the escapee to publish a pid before the launcher exits, so there is nothing left to race.
- Where a security invariant is timing sensitive, that is worth understanding before relaxing anything, since it may be telling us the invariant itself is timing dependent. The junction-swap test is in this class and should not be quietly given a longer timeout.
Worth knowing
ulimit -n on a non-interactive shell is low enough that cargo test -p minutes-core fails a rotating set of unrelated tests with Too many open files. That is not a CI problem, but it produces the same misleading signal locally, and it cost time today before being recognized.
Another instance, with a diagnosis this time: crates/sdk/src/corpus-lease.test.ts → "charges hook time against the one cumulative deadline" failed on Agent Corpus + MCP Lockfile (windows-latest) for #923 (a PR that does not touch the SDK; the same test passed on the previous five main runs).
The failing assertion was expect(baselineCalls).toBe(1) receiving 0. The test gives two 1.3 s hooks a shared 2 s deadline and expects both hooks to run before the cumulative budget refuses. On that runner the lease's own pre-hook work (corpus walk + baseline attestation) consumed the whole 2 s, so the refusal fired before afterBaseline was ever called. The refusal is correct behavior; the test's assumption that setup is negligible relative to a 2 s budget does not hold on a loaded Windows runner.
Suggested fix that keeps the test's intent (prove the deadline is cumulative, not per-phase): measure the setup cost first with a no-hook lease, then set timeoutMs to setup + 2 × hookDelay − margin so the two hooks together still exceed the budget while either alone does not, or scale the hook delays and budget by the same factor the harness already uses for MINUTES_CORPUS_AUTH_TIMEOUT_MS. Either way the assertions stay exactly as they are.