The #70 loop case waits, bounded, for the loop to end, never reading it once after a fixed wait (martha#222) #249

Manually merged
terra merged 2 commits from hygiea/222-setsid-loop-wait into main 2026-11-26 09:32:25 +00:00
Member

Cause. keep_a_test_run_in_one_temporary_root.node-test.ts, "a process a run started in a session of its own ends with the run, and its root goes after it (martha#70)" waited a fixed WAIT_MS after the wrapper returned, then read isRunning(loop) once. The wrapper's tear-down sends SIGSTOP then SIGKILL before it exits, but on a loaded host the kernel finishes the kill after that window: run 5102 attempt 1, job "gate coverage", task 17025 (2026-11-26 02:21→02:38Z) red at true !== false on a commit that does not touch the file, and the same commit passed the case in pass 1.

The fix. untilGone looks up to WAITS looks of WAIT_MS (5 s — 100× the old fixed wait, well above the tear-down's grace) and the case is red only if the loop outlives that limit. The root assertion is unchanged: the wrapper removes its roots synchronously before it exits.

Evidence.

  • Mutant: with the wrapper's tear-down endWhatNamesTheDirectories call dropped (and restored), the case is red after the bound: "the loop 113 the run left in a session of its own outlived the run" (5.7 s).
  • The file, 14/14 pass on this tip through run_the_tests_in_a_namespace_of_their_own.sh (nice -n 10), twice. One earlier run red on the neighbouring #70 case at "the loop went with the killed run": that case and its code are untouched here, it passed 14/14 on main 74041d92 on the same box minutes later, and both re-runs here; filed as #248 so it is not mistaken for this diff.

Refs #222

**Cause.** `keep_a_test_run_in_one_temporary_root.node-test.ts`, "a process a run started in a session of its own ends with the run, and its root goes after it (martha#70)" waited a fixed `WAIT_MS` after the wrapper returned, then read `isRunning(loop)` once. The wrapper's tear-down sends SIGSTOP then SIGKILL before it exits, but on a loaded host the kernel finishes the kill after that window: run 5102 attempt 1, job "gate coverage", task 17025 (2026-11-26 02:21→02:38Z) red at `true !== false` on a commit that does not touch the file, and the same commit passed the case in pass 1. **The fix.** `untilGone` looks up to `WAITS` looks of `WAIT_MS` (5 s — 100× the old fixed wait, well above the tear-down's grace) and the case is red only if the loop outlives that limit. The root assertion is unchanged: the wrapper removes its roots synchronously before it exits. **Evidence.** - Mutant: with the wrapper's tear-down `endWhatNamesTheDirectories` call dropped (and restored), the case is red after the bound: "the loop 113 the run left in a session of its own outlived the run" (5.7 s). - The file, 14/14 pass on this tip through `run_the_tests_in_a_namespace_of_their_own.sh` (`nice -n 10`), twice. One earlier run red on the *neighbouring* #70 case at "the loop went with the killed run": that case and its code are untouched here, it passed 14/14 on main 74041d92 on the same box minutes later, and both re-runs here; filed as #248 so it is not mistaken for this diff. Refs #222
The loop's liveness is waited for, not read once after a fixed wait (martha#222)
Some checks failed
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been skipped
dependency advisories / node in installer (container) (pull_request) Has been skipped
CI / nothing private (pull_request) Has been skipped
dependency advisories / node in . (pull_request) Successful in 14s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 9s
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
dependency advisories / node in installer (pull_request) Successful in 13s
dependency advisories / advisories (pull_request) Successful in 0s
CI / links resolve (pull_request) Successful in 5s
CI / structural floor (pull_request) Successful in 25s
CI / no import cycle (pull_request) Successful in 27s
CI / Martha's names are its own (pull_request) Successful in 31s
CI / the posted text check bites (pull_request) Successful in 12s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 13s
CI / the engine drift check bites (pull_request) Successful in 29s
CI / workflows are valid (pull_request) Successful in 14s
CI / no test the base passed goes missing (pull_request) Successful in 38s
CI / the host drift check bites (pull_request) Successful in 1m41s
CI / the pictures change only with the version (pull_request) Successful in 19s
CI / every check runs in a job (pull_request) Successful in 14s
CI / every job has a timeout (pull_request) Successful in 14s
CI / no literal restates a defined value (pull_request) Successful in 1m1s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 13s
CI / installer (pull_request) Successful in 2m27s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 42s
CI / gate coverage (pull_request) Failing after 10m45s
CI / the relay loads in the recorded host (pull_request) Successful in 16m4s
CI / the clean-install proof removes its container (pull_request) Successful in 20m6s
182179bfdf
The martha#70 case read isRunning(loop) once, WAIT_MS after the run
exited, so a kill the kernel finished late on a loaded host read as a
loop that outlived its run. It now looks, bounded, up to WAITS looks of
WAIT_MS, and is red only if the loop outlives that limit.

Evidence: with the wrapper's tear-down kill dropped, the case is red
after the bound, "the loop 113 the run left in a session of its own
outlived the run".
Wait a run's whole deadline for a killed process to go (martha#222)
All checks were successful
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been skipped
dependency advisories / node in installer (container) (pull_request) Has been skipped
CI / nothing private (pull_request) Has been skipped
dependency advisories / node in . (pull_request) Successful in 13s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 11s
dependency advisories / node in installer (pull_request) Successful in 11s
dependency advisories / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 4s
c4 model / c4-model (pull_request) Successful in 0s
CI / links resolve (pull_request) Successful in 5s
CI / structural floor (pull_request) Successful in 23s
CI / Martha's names are its own (pull_request) Successful in 30s
CI / no import cycle (pull_request) Successful in 28s
CI / the posted text check bites (pull_request) Successful in 11s
CI / the host drift check bites (pull_request) Successful in 1m14s
CI / the engine drift check bites (pull_request) Successful in 55s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 11s
CI / workflows are valid (pull_request) Successful in 14s
CI / no test the base passed goes missing (pull_request) Successful in 37s
CI / the pictures change only with the version (pull_request) Successful in 18s
CI / no literal restates a defined value (pull_request) Successful in 1m12s
CI / installer (pull_request) Successful in 2m23s
CI / every job has a timeout (pull_request) Successful in 10s
CI / every check runs in a job (pull_request) Successful in 14s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 19s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 33s
CI / the relay loads in the recorded host (pull_request) Successful in 15m14s
CI / gate coverage (pull_request) Successful in 17m28s
CI / the clean-install proof removes its container (pull_request) Successful in 22m24s
38034e08b6
The forge showed five seconds too tight: run 5538, job "gate coverage",
task 18467, red after 5364 ms with the loop still there. A process the
host has not finished ending — one in uninterruptible sleep under a full
suite — is not one the run left behind, so the bound is now
TEAR_DOWN_DEADLINE_MS, read from RUN_DEADLINE_MS, the same deadline a
wrapped command gets before the check calls it hung.

Also drops "grace" from the comment: the tear-down gives passes, not a
timed grace (review wording note).
terra manually merged commit 3d2eb0b23b into main 2026-11-26 09:32:25 +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!249
No description provided.