Repository navigation
Description
Not the rare flake I first called it. It has now hit roughly half of the runs that reach it, and each hit burns the full 30-minute job budget and cancels every later step — so the SDK suite never runs at all on those.
Signature
06:17:00 test agent::rung_c_sigkill_boundaries_resume_only_unfinished_steps_via_real_cli
has been running for over 60 seconds
06:42:29 ##[error]The operation was canceled.
Test kernel reaches 30m15s / 30m16s and dies. When healthy, the whole crash_resume binary — all 34 tests including this one — finishes in 38 seconds.
Tally of runs that reached the test
| run | branch | outcome |
|---|---|---|
| 33843408251 | feat/tick-runner-0903 (#157) |
passed the test (38s binary) |
| 33843430434 | feat/v2-surface-package (#134) |
passed the test (38s binary) |
| 33843397637 | feat/v2-gate-contract (#139) |
hung, cancelled 30m15s |
| 33844679490 (1st) | fix/155-crash-skips-backoff (#158) |
hung, cancelled 30m16s |
| 33844679490 (rerun) | same commit | passed, whole job 6m46s |
| 33847657688 | ci/analyzer-skip-0904 (#159) |
Test kernel in progress 16+ min at time of writing |
Same commit both hung and passed (#158), which rules out any particular branch and rules out my own suspicion that the kernel-touching PRs were at fault — I asserted that on #139 and have corrected it there.
Not reproducible locally
macOS, this repo, on the #158 branch:
crash_resumefull binary: PASS in 37–47s, 34/34, at default parallelism,--test-threads=4, and--test-threads=2;- the test alone: 3/3 PASS in ~1s.
So it is specific to the Linux runner, not to thread count and not to the test in isolation.
Why it matters more than a flaky test normally would
- It is not a failure, it is a hang. The job burns its whole budget, then cancels — 30 minutes per hit.
- Cancellation skips
Install SDK dependenciesand everything after, so a hit means the SDK suite does not run at all. A PR can look "checked" while two thirds of the gate never executed. - At roughly 50% it will hit most PRs on first try, so the practical cost is a re-run cycle on nearly everything.
This was invisible before #153, because the kernel suite never ran in CI.
Suggested direction, not a fix
The test drives kill/resume boundaries against a real CLI. A resume path waiting on something that never arrives — a process that does not reap, a socket read with no deadline, a lease that is never released — fits the evidence. Worth adding a hard per-test timeout so the failure is a fast red with a backtrace instead of a 30-minute cancellation, independent of the root cause; the diagnosis is much easier from a panic than from a killed job.
Found while landing #154/#158/#159. Filed separately because it blocks every PR and is unrelated to any of them.
Activity
ops(drive-log): rung_c hang is ~50% of runs; filed #160
kjgbot commentedon Sep 4, 2026
Narrowed: the hang is in
main, and there are exactly two unbounded waitsIt is not any PR's code
#159 changes one file,
.github/workflows/cloud-runtime-artifact.yml, and nothing else:Its kernel tree is byte-identical to
main. It has now been hanging inTest kernelfor 26+ minutes. So the hang is inmainitself, reachable by any PR — it is not #139's gate work and not #158's retry change. That closes out both of my earlier wrong attributions.wait_untilis bounded, so it is not the culpritcrash_resume/support.rs:124:15 seconds, then it panics. A stalled journal condition would give a fast red with a clear message, which is not what we see.
The two waits that are unbounded
1.
kill_process_group→child.wait()(support.rs:132)kill_groupdoeskill(-pid, SIGKILL)on the group. If the child is not reaped — it is spawned.process_group(0), so this depends on process-group semantics holding exactly as expected —child.wait()blocks forever.2.
resume.wait_with_output()(agent.rs:134)If the resumed run never reaches a terminal state — a dispatch that never arrives, a lease never released — this never returns.
Relevant detail: the child is asleep for 300 seconds when it is killed
--pause-before-steplands inengine/drive.rs:So the process being SIGKILLed is mid-
sleep(300), and the test body runs that whole sequence twice (before-first,between-first-agent). That is the state the kill has to interrupt cleanly, every time.I am deliberately not naming which of the two waits it is. I have guessed wrong three times on the related #155 and the cost each time was real; distinguishing these needs either a runner with a thread dump or a bounded reproduction, not more reading.
Concrete suggestion, unchanged and still root-cause-independent
Put a hard timeout on both waits. A test that fails in 60s with "resume did not exit" or "SIGKILLed child was not reaped" is diagnosable; a 30-minute cancellation with no output is not, and it currently costs the SDK suite entirely because cancellation skips every later step.
ops(drive-log): #160 narrowed to main; two unbounded waits identified
kjgbot commentedon Sep 4, 2026
Reproduced locally, and the blocking wait is neither of the two I named
Both of my earlier candidates (
child.wait(),resume.wait_with_output()) are wrong. Here is the actual state, captured from a live hung process.Reproduction — no more 30-minute CI round trips
macOS cannot reproduce this. A Linux container can, but only running the whole binary; the test alone passes every time.
Single test, Linux: 3/3 PASS in 0s. Full binary, Linux: hangs, still running at 10+ minutes against 47s on macOS.
That the test passes alone but hangs in the full binary is itself the finding: it depends on state left behind by earlier tests in the same process.
What is actually blocked
Two things:
1. A leaked daemon.
pid=94hasppid=1— reparented to init. Arelayflowd servefrom an earlier test in this binary outlived its parent without being reaped, and its data dir/tmp/.tmpN14qfHis still on disk alongside the current test's/tmp/.tmprxJwfJ. SoServerGuard's cleanup did not run, or its kill missed.2. A socket read that can never return. The hang is
unix_stream_data_wait— a blocking read on a unix socket, in the worker event path (worker.event("step.dispatch")), with no timeout. The file descriptors say why it can never wake:Inode
16469is held twice by the test process and by neither daemon. With no other peer holding the write end, no data will ever arrive — and because the test still holds the far end itself, the read does not even get an EOF. It blocks forever rather than failing.So the sequence is: an earlier test leaks a daemon, the fixture state that leak leaves behind causes the worker's socket to be wired to a peer that will never write, and
worker.event(...)waits on it with no deadline.What I would fix, in order
pid=94, ppid=1should not exist. Whatever owns that daemon must reap it — that is the defect the rest follows from.worker.event(...)should take a deadline, so a missing dispatch is a fast, named failure instead of a permanent block. This is the "bound the wait" suggestion from before, now aimed at the right wait.I am not proposing a patch yet — @khaliqgant asked for root cause first, and the leak is the part that deserves an owner's judgment about lifetime, not a quick timeout from me.
Correction
I previously listed
child.wait()andresume.wait_with_output()as the two unbounded waits and said one of them was it. Neither is. I found them by reading; this was found by looking at a hung process, which is what I should have done one step earlier given I had already been wrong three times on the related #155.kjgbot commentedon Sep 4, 2026
Repro confirmed cleanly, with the identical signature to CI:
rc=124istimeout(1)firing at my 400s bound. Same test, same message CI prints before it burns the 30-minute budget.So this is now reproducible in ~7 minutes on a laptop instead of a 30-minute CI cycle with no diagnostics, and a hung process can be inspected live — which is how the
ppid=1leaked daemon and the doubly-held socket inode above were found.Worth knowing for whoever picks this up: run the whole
crash_resumebinary, not the single test. Alone it passes 3/3 in 0s.ops(drive-log): #158/#159 merged; #160 root-caused and locally reprod…
ops(drive-log): 08:55Z tick — #139 rerun past #160 hang
kjgbot commentedon Sep 4, 2026
It requires parallel execution — and serialising costs ~1 second
Decisive experiment, same Linux container, same commit (
f1314b1), same binary:versus the default parallel run, which hangs and gets killed at my 400s bound:
So the hang is not "Linux" and not that test in isolation — it needs tests running concurrently in the same process. That fits the two artefacts captured from the live hang: a
relayflowd servefrom an earlier test reparented to init (ppid=1), and a socket whose inode was held twice by the test process and by neither daemon, so the read could never return or even see EOF.The cost of serialising is approximately nothing
A healthy parallel run of this binary is 38s. Sequential is 39s. These tests spend their time waiting on spawned daemons and sockets, not on CPU, so there is no parallelism to lose.
Compare that to the status quo: roughly half of runs burn the full 30-minute job budget and are cancelled, and cancellation skips
Install SDK dependenciesand every step after it — so the SDK suite does not run at all on those. A PR looks checked when two thirds of the gate never executed.Suggested immediate mitigation, explicitly not a fix
Add
--test-threads=1to the kernel step. It runs the identical 34 tests and hides nothing; it only removes the concurrency the defect needs. One second of wall clock buys a deterministic gate.The underlying defect stays open here and still wants fixing — the daemon leak in particular is real regardless of how the suite is scheduled, and a test double outliving its test is the kind of thing that eventually bites outside the harness.
I am not opening that PR unilaterally: @khaliqgant asked me to chase the root cause rather than patch around it, and serialising is exactly patching around it. Say the word and it is a one-line change.
ops(drive-log): #160 needs parallelism; serialising costs ~1s
ops(drive-log): 19:23Z — #140 PR check hitting the #160 hang
kjgbot commentedon Sep 4, 2026
Cost tally: this has now burned six CI cycles
Another one just now — #140's PR check,
Test kernelrunning from 19:08, cancelled at 30 minutes. Second time on that PR alone.Six cancellations × 30 minutes = three hours of CI wall-clock, and each one also skips
Install SDK dependenciesand everything after it — so on those runs the SDK suite never executed at all. A PR can sit "checked" with two thirds of the gate unrun.The measured mitigation is still one line and effectively free:
One second of wall clock, same 34 tests, nothing hidden. It does not fix the daemon leak — the
ppid=1orphan and the doubly-held socket are still real and still want fixing — it just stops the leak from eating a 30-minute budget on half of all runs.@khaliqgant asked for root cause over patching around it, which is why I have not opened that PR. Recording the running cost so the tradeoff is visible rather than implicit: the root fix is in the session layer and wants an owner, while the serialisation is available now.
ops(drive-log): #160 cost tally — six cancellations, ~3h CI lost
ops(drive-log): app installed; #160 now blocks the #3270 live proof
ops(drive-log): 22:05Z quiet — #160 hang blocks #168's check (7th can…
ops(drive-log): 22:33Z — 7th #160 cancellation confirmed, #168 re-run…
ops(drive-log): 8th #160 cancellation; pausing re-runs on #168
kjgbot commentedon Sep 5, 2026
Root cause found. Not a flake, not
busy_timeout— the crash-repair path is not race-safe.left: 2in CI istwo_racing_deliveries_of_one_event_produce_exactly_one_run(event_wake.rs:162). The test is correct and it caught a real exactly-once violation in the product.The defect
Registry::claim_eventrepairs a claim whose run never materialised:That repair cannot distinguish a crashed run from a previous process from a concurrent run that has not registered yet. Both are exactly "a claim row with no matching
runsrow".wake.rsmakes that window explicit — the claim is taken before the run exists:So for two racing deliveries A and B of one event:
changed == 1, returnsNone, proceeds — but has not created its journal yet.INSERT OR IGNOREis ignored, readsexisting = A.COUNT(1) FROM runs WHERE run_id = A→ 0. A is still inside the window.None.left: 2.The doc comment on
claim_eventdescribes the crash case it was written for accurately. The bug is that the test it uses for "crashed" is also true of "in flight".What this explains
busy_timeoutis necessary for lock contention but has nothing to do with this window — which is why it was demonstrably not sufficient.I earlier called this branch-specific, then a rare flake. Both were wrong; it is deterministic given the interleaving.
Fix shape
The repair needs to separate "abandoned" from "in flight", which the current predicate cannot do. The narrowest correct change is to record the engine's boot generation on the claim:
Someand dedupe;That preserves the crash-recovery behaviour the comment defends while closing the race, and needs no cross-file transaction (the journal is a separate SQLite file, so claim + registration cannot simply share one).
Alternative considered and rejected: a time-based abandonment threshold. It trades a correctness bound for a timing guess, which is the same class of mistake as the tick-count window in the
allSettledrepair.Not implementing tonight — @khaliqgant asked to hold #160 for a real fix rather than a patch-around, and this touches the exactly-once core. Diagnosis first; the change wants its own PR and an independent signoff.
Blocks #168.
docs(drive-log): 2026-09-05 09:36Z — #160 root cause is a claim-repai…
khaliqgant commentedon Sep 5, 2026
Make a fix for this
docs(drive-log): 2026-09-05 09:54Z — #160 fixed, opened as #171
fix(kernel): stop the claim repair from stealing an in-flight claim
refactor(kernel): fix extraction indent, state the one-engine invariant
fix(kernel): resume adopts a real journal whose registry row is missing
fix(kernel): stop the claim repair from stealing an in-flight claim
refactor(kernel): fix extraction indent, state the one-engine invariant
fix(kernel): stop the claim repair from stealing an in-flight claim
fix(kernel): stop the claim repair from stealing an in-flight claim
docs(drive-log): 2026-09-05 14:27Z — #171 merged, #160 closed