Repository navigation
fix(sdk): stop a health check without waiting for its in-flight ready.fn - #4855
Conversation
HealthDaemon.stopSession() awaited the running ready.fn before a stop or pause could proceed, though an aborted session discards that result. A check wedged in a call that never returns (SDK 4.1.0's exec, fixed by #4537) therefore kept its daemon, and every daemon it requires, from receiving SIGTERM. - Stopping aborts the session and proceeds at once. - ready.fn receives the session's AbortSignal. - SubContainer exec's abort option accepts an AbortSignal. Helix-Harness: claude-code Helix-Model: claude-opus-5-5
5cdaa43 to
48fc61d
Compare
helix-white
left a comment
There was a problem hiding this comment.
Reviewed 48fc61df443cb8283491ff900368dbc2763c7076; it merges cleanly with current master.
The narrowed change resolves both concerns from the initial deadline-based draft: a dependency pause no longer loses its configured drain budget, and reconciliation no longer abandons pending command startup to launch a replacement. Those concerns were caused by the removed deadlines; no additional proposal is needed.
Checked stop/pause transition serialization, aborted-session result and exit-callback guards, dependency-ordered teardown, and exec cancellation/listener cleanup for both controllers and signals. No remaining correctness findings in this diff.
Code-only review; no builds or tests run. The revised head's SDK, Runtime & Script Tests check passes; other CI jobs remain pending.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
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) (cherry picked from commit d1a9ad2) Helix-Harness: claude-code Helix-Model: claude-opus-5-5
…hile a selection change is in flight (#4921) * fix(patch-db): keep array positions and serialize selection updates while a selection change is in flight Revisions that precede a selection change's extension still carry the previous projection. Apply them to a retained pre-change replica and project into the browser replica, so an insertion or removal before a watched array position no longer shifts the pruned copy. Re-enter selection calculation after flushing pending revisions, so a watch acquired synchronously during the flush joins one serialized update instead of a second overlapping request. Proposed by helix-white in review of #4898. Helix-Harness: claude-code Helix-Model: claude-opus-5-5 * test(sdk): settle health-check commands before the next exec test starts 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) (cherry picked from commit d1a9ad2) Helix-Harness: claude-code Helix-Model: claude-opus-5-5 --------- Co-authored-by: helix-white <267227783+helix-a@users.noreply.github.com> Co-authored-by: Shadowy Super Coder <RustyShackleford311@protonmail.com>
Since Start9Labs#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 Start9Labs#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
Problem
HealthDaemon.stopSession()waited for the health check that was already running (ready.fn) before a stop or a pause could continue. That's pointless, because an aborted session throws the result away. It's also dangerous: if the check is stuck in a call that never returns, its daemon never gets SIGTERM, and neither does any daemon it requires.That is the likely cause of a bitcoind stop that needed a force stop. After the stop began, bitcoind kept syncing blocks for more than eight minutes and never received SIGTERM. Its health checks run
bitcoin-clithrough SDK 4.1.0'sexec. Thatexecwaits for stdin to close before it attaches the exit listener or starts the 30 s kill timer, so a fast-exiting command can hang it forever. #4537 fixed that on master after 4.1.0 was tagged.Change
ready.fn.ready.fngets anAbortSignal. It aborts when the check stops, so the check's own work can be cancelled rather than left running.execaccepts the signal.SubContainer.exec'sabortoption now takes anAbortSignalas well as anAbortController, so a check can pass its signal straight through.main.md) and a changelog fragment.Verification
Run through
helix-build, fromprojects/start-sdk:make check(tsc) passes, andmake fmtplus prettier on the changed Markdown are clean.npx jest: 418/418.node --test tests/*.test.mjs: 63/63.New test in
DaemonLifecycle.test.ts: when aready.fnnever resolves,term()still terminates the daemon and aborts the check's signal. Against master'sHealthDaemonthe same test fails withhung.exec.stdin.test.tsnow covers killing a command through either anAbortControlleror anAbortSignal.Not verified on a live StartOS box.
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5