martha#225: every child this file starts is waited for to its end, so a loaded box cannot report it left running #247

Manually merged
terra merged 3 commits from ceres/225-held-process-leak into main 2026-11-27 01:15:03 +00:00
Member

Purpose (reliability): a full-suite run is not red because of a child process that one test leaves behind.

What was wrong

src/end_a_launch/recorded_inside_the_hold.node-test.ts spawns a member and ended it in t.after with member.kill('SIGKILL'). A kill sends a signal; it does not return once the child is gone. The run judges what a file left running after its last hook, and gives the kernel only SETTLE_TURNS turns of the loop to let a child go (prove_the_core/a_test_run_ends/every_test_file_cleans_up.ts), so on a slower box the child can still be a live ProcessWrap when the file ends — which is the red #225 records: left running after its tests: a child process (ProcessWrap). Stop it in t.after., in 211 ms, in the same job where step 14 passed the same file.

The change, one file

  • One helper, endThe(member), ends every child this file starts: it registers the exit before the signal and waits for it, so an exit cannot land between the two and be waited for forever, and a child that has already ended is left alone — the rule end_a_launch.ts follows for a child that is not running.
  • The first case's t.after now ends its member through it.
  • A second case is the red-first proof: it spawns a child that would on its own outlive the tear-down (A_CHILDS_DELAYED_EXIT_MS), asks for its end, and asserts it has ended when the tear-down returns.

Proof

  • Whole file, fixed: 2 of 2 cases pass (npm run test:file -- src/end_a_launch/recorded_inside_the_hold.node-test.ts, in run_the_tests_in_a_namespace_of_their_own.sh).
  • Red first: with endThe's wait removed (the old tear-down, member.kill('SIGKILL') and return), 3 runs of 3 fail on the new case with AssertionError: the child had ended by the time the tear-down returned, so the file cannot leave it running. With the wait back, both cases pass.
  • npm run typecheck and npm run lint clean; check:restated-values, check:no-import-cycle, check:no-launcher-outlives-its-run, check:no-member-outlives-its-run and check:every-check-runs-in-a-job pass on the tip.

Refs martha-ai/martha#225, martha-ai/martha#198.

Purpose (reliability): a full-suite run is not red because of a child process that one test leaves behind. ## What was wrong `src/end_a_launch/recorded_inside_the_hold.node-test.ts` spawns a member and ended it in `t.after` with `member.kill('SIGKILL')`. A kill sends a signal; it does not return once the child is gone. The run judges what a file left running after its last hook, and gives the kernel only `SETTLE_TURNS` turns of the loop to let a child go (`prove_the_core/a_test_run_ends/every_test_file_cleans_up.ts`), so on a slower box the child can still be a live `ProcessWrap` when the file ends — which is the red #225 records: `left running after its tests: a child process (ProcessWrap). Stop it in t.after.`, in 211 ms, in the same job where step 14 passed the same file. ## The change, one file - One helper, `endThe(member)`, ends every child this file starts: it registers the exit before the signal and waits for it, so an exit cannot land between the two and be waited for forever, and a child that has already ended is left alone — the rule `end_a_launch.ts` follows for a child that is not running. - The first case's `t.after` now ends its member through it. - A second case is the red-first proof: it spawns a child that would on its own outlive the tear-down (`A_CHILDS_DELAYED_EXIT_MS`), asks for its end, and asserts it has ended when the tear-down returns. ## Proof - Whole file, fixed: **2 of 2 cases pass** (`npm run test:file -- src/end_a_launch/recorded_inside_the_hold.node-test.ts`, in `run_the_tests_in_a_namespace_of_their_own.sh`). - Red first: with `endThe`'s wait removed (the old tear-down, `member.kill('SIGKILL')` and return), **3 runs of 3 fail** on the new case with `AssertionError: the child had ended by the time the tear-down returned, so the file cannot leave it running`. With the wait back, both cases pass. - `npm run typecheck` and `npm run lint` clean; `check:restated-values`, `check:no-import-cycle`, `check:no-launcher-outlives-its-run`, `check:no-member-outlives-its-run` and `check:every-check-runs-in-a-job` pass on the tip. Refs martha-ai/martha#225, martha-ai/martha#198.
Every child this file starts is waited for to its end, so a loaded box cannot report the file as one that left a child running (martha#225)
Some checks failed
dependency advisories / advisories (pull_request) Has been cancelled
dependency advisories / node in . (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Has been cancelled
dependency advisories / node in installer (pull_request) Has been cancelled
dependency advisories / node in . (container) (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been cancelled
dependency advisories / node in installer (container) (pull_request) Has been cancelled
c4 model / c4-model (pull_request) Has been cancelled
c4 model / c4-model-1 (pull_request) Has been cancelled
CI / links resolve (pull_request) Has been cancelled
CI / gate coverage (pull_request) Has been cancelled
CI / structural floor (pull_request) Has been cancelled
CI / Martha's names are its own (pull_request) Has been cancelled
CI / no import cycle (pull_request) Has been cancelled
CI / the relay loads in the recorded host (pull_request) Has been cancelled
CI / the host drift check bites (pull_request) Has been cancelled
CI / the engine drift check bites (pull_request) Has been cancelled
CI / the posted text check bites (pull_request) Has been cancelled
CI / the clean-install proof removes its container (pull_request) Has been cancelled
CI / the ring reaches the owner on the live run's tmux (pull_request) Has been cancelled
CI / workflows are valid (pull_request) Has been cancelled
CI / installer (pull_request) Has been cancelled
CI / nothing private (pull_request) Has been cancelled
CI / no test the base passed goes missing (pull_request) Has been cancelled
CI / the pictures change only with the version (pull_request) Has been cancelled
CI / no literal restates a defined value (pull_request) Has been cancelled
CI / every check runs in a job (pull_request) Has been cancelled
CI / every job has a timeout (pull_request) Has been cancelled
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Has been cancelled
standalone / the pinned Node is nodejs.org's (pull_request) Has been cancelled
cda072ac50
The tear-down killed the child and returned: a kill is sent, not delivered, and the
run judges what a file left running only a few turns of the loop after its last hook,
so on a slower box the child could still be a live handle. One helper now registers the
exit before the signal and waits for it, and a child that has already ended is left
alone, as end_a_launch.ts leaves a child that is not running.

The red-first case spawns a child that would outlive the tear-down and asserts it has
ended when the tear-down returns: with the wait removed it fails, with it in place it
passes.
Mars's r=1 note B: the name and the comment said the child's exit was delayed, which it is
not -- any child still running when its end is asked for gives the same assertion. The
constant is the child's lifetime, and the comment says what it is for.
terra manually merged commit 61ec8da029 into main 2026-11-27 01:15:03 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
martha-ai/martha!247
No description provided.