Skip to content

test(sdk): settle health-check commands before the next exec test starts - #4905

Merged
dr-bonez merged 1 commit into
integration/registry-cache-syncfrom
fix/integration-sdk-exec-flake
Nov 24, 2026
Merged

dr-bonez merged 1 commit into
integration/registry-cache-syncfrom
fix/integration-sdk-exec-flake

Conversation

@helix-red

@helix-red helix-red commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

This stops the intermittent exec.lifecycle.test.ts failure (timedOutAfter: null, expected 10) on integration/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 -x of #4881's only commit (2cf57f322 by @Dominion5254), applied unchanged with that authorship kept. #4881 is the same fix against master; it is approved and green but not merged. When master is 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 test health checks can terminate while fast commands finish therefore ended with its 36 sub.exec calls 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 after term() 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 exec fails every time: exec spawns 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)

  • The test file was run 30 times pinned to one CPU core with three busy loops, and every run executed its tests. Before (5c6ff92fe): 7/30 failed with the CI error and 30/30 printed MaxListenersExceededWarning from the shared child's listeners. After (d1a9ad2d8): 0/30 failed and 0/30 warned.
  • make start-sdk-test passes: 418/418 SDK jest tests, 542/542 start-core tests, and the RPC-doc script tests.
  • CI on this head: SDK, Runtime & Script Tests passes. 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

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 helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants