Repository navigation
test(sdk): settle health-check commands before the next exec test starts - #4905
Conversation
Since #4855, HealthDaemon.term() returns without awaiting an in-flight ready.fn. "health checks can terminate while fast commands finish" therefore ended with its 36 sub.exec calls still waiting on readFile. They spawned after the next test pointed the cp.spawn mock at its hung-stdin child, so they shared that child and its kill timers raced the test's own 10 ms deadline. A leftover 25 ms timer that fired first killed the child with timedOut still false, failing "the deadline covers a stdin callback that never arrives" with timedOutAfter: null. The sharing occurred on every run since #4855 (MaxListenersExceededWarning on the shared child's emitters); the failure needed a >15 ms scheduling stall between the two spawns. The health test now awaits those commands after term() has settled within its own bound. (cherry picked from commit 2cf57f3) Helix-Harness: claude-code Helix-Model: claude-opus-5-5
helix-white
left a comment
There was a problem hiding this comment.
Approved at d1a9ad2d86569dd82e6bfc284ae8db7f89aada01; no correctness findings. Merges cleanly into integration/registry-cache-sync.
Verified the test-file change is identical to #4881. The command promise is assigned before signaling entry, and the batch is drained after the separately bounded health.term() check. This prevents commands from using the following test's spawn mock without changing production behavior or the termination contract.
Reviewed the lifecycle fixture, HealthDaemon cancellation, and SubContainerEager.exec completion/cleanup paths. No builds or tests run during review. The SDK, Runtime & Script Tests CI check passed; other build/test checks remain pending.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
This stops the intermittent
exec.lifecycle.test.tsfailure (timedOutAfter: null, expected10) onintegration/registry-cache-sync, so #4898 and #4903 stop failing CI on it. Test-only: no SDK or OS behaviour changes, so there is no changelog fragment.It is a
git cherry-pick -xof #4881's only commit (2cf57f322by @Dominion5254), applied unchanged with that authorship kept. #4881 is the same fix againstmaster; it is approved and green but not merged. Whenmasteris next merged into the integration branch, the file is identical on both sides, so there is no conflict and no double change.Cause. Since #4855,
HealthDaemon.term()returns without waiting for a health check that is still running. The testhealth checks can terminate while fast commands finishtherefore ended with its 36sub.execcalls still in flight. The next test then pointed the spawn mock at a child that never exits. The leftover calls spawned that same child and attached their own 25 ms kill timers to it. When one of those fired before the next test's 10 ms deadline, the child died with the test's timeout flag unset. That needs a stall of more than about 15 ms between the two spawns, which busy CI runners occasionally produce. The fix keeps the promise for those commands and awaits it afterterm()has settled within its own bound. The test still checks that stopping doesn't wait for the check, and again checks that the commands finish.Two alternatives don't work, both established on #4881. Passing the check's abort signal to
execfails every time:execspawns before it checks the signal. Resetting the spawn mock per test doesn't help, because leftover calls use whichever mock is current when they spawn.Implementation diff: +0 / −0 lines in 0 files (excludes lockfiles, tests, docs, release notes, and changelog).
Testing (in a Helix build cache on the integration head)
5c6ff92fe): 7/30 failed with the CI error and 30/30 printedMaxListenersExceededWarningfrom the shared child's listeners. After (d1a9ad2d8): 0/30 failed and 0/30 warned.make start-sdk-testpasses: 418/418 SDK jest tests, 542/542 start-core tests, and the RPC-doc script tests.SDK, Runtime & Script Testspasses. The binary builds, start-core, StartWRT, rpc-toolkit and generated-artifact jobs were still running at hand-off; this change does not touch their inputs.Helix-Harness: claude-code
Helix-Model: claude-opus-5-5