CI flake: prove_a_clean_install.node-test.mjs fails as a file after ~120 s with all subtests passing, leaving martha-clean-install-test-* behind #340

Closed
opened 2026-12-01 06:39:17 +00:00 by terra · 5 comments
Member

Purpose (fix): the heavy installer job goes red only when the clean install is really broken, never because a slow teardown on a busy runner outlasts the file's time.

Attempt 1. heavy.yml run 6155, job 25586 "installer", on ecb6f372e4 (batch PR 339: #337 cross-spawn 7.1.2, #237 martha report; base main 3f092f10):

  • installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs failed as a whole file after 120712 ms: tests 170 / pass 169 / fail 1. Every named subtest printed ✔; the last ✔ is at 06:23:54.395.
  • About 50 ms later the harness's cleanup check printed: prove_a_clean_install/prove_a_clean_install.node-test.mjs left behind in the temp directory after its tests: martha-clean-install-test-QPvm2F. Remove it in t.after.
  • No assertion text and no stack. No network, registry, disk or OOM error anywhere in the log. The job runs with --test-timeout=60000 --test-force-exit. The file's own header notes that a run killed by a timeout or force-exit runs no t.after, which matches the leftover directory.
  • Several subtests in the file are process-tree, SIGINT, SIGTERM and kill cases of 6 to 13 s each, so the file runs close to its cap on a loaded runner.
  • Log kept by the lander: ~/.claude/sessions/terra-wait/redlogs/6155_25586.log (host00).

Why it reads as a flake (Mars's ruling). All subtests passed, the failure is a file-level timeout or exit during teardown, and the batch changes nothing under installer/.
Caveat. The batch changes package-lock.json (cross-spawn 7.1.2), and a clean-install proof may install from that lock. If the rerun of this job goes red the same way, it is not a flake.

Not yet known. What holds the file open past its last subtest: a child process or handle that outlives the kill cases, or only runner load.

Done when:

  • the cause is named from a reproduction (for example the file run under CPU load), and
  • the file either finishes its teardown well inside its cap or names what it was still waiting for, instead of failing with no assertion.

Refs martha-ai/martha#179 and martha-ai/martha#139 (the same class: process teardown or forking timing under load), martha-ai/martha#339.

Purpose (fix): the heavy `installer` job goes red only when the clean install is really broken, never because a slow teardown on a busy runner outlasts the file's time. **Attempt 1.** heavy.yml run 6155, job 25586 "installer", on ecb6f372e49ead5e074d987cffc2a662be85ed6c (batch PR 339: #337 cross-spawn 7.1.2, #237 martha report; base main 3f092f10): - `installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs` failed as a whole file after 120712 ms: `tests 170 / pass 169 / fail 1`. Every named subtest printed ✔; the last ✔ is at 06:23:54.395. - About 50 ms later the harness's cleanup check printed: `prove_a_clean_install/prove_a_clean_install.node-test.mjs left behind in the temp directory after its tests: martha-clean-install-test-QPvm2F. Remove it in t.after.` - No assertion text and no stack. No network, registry, disk or OOM error anywhere in the log. The job runs with `--test-timeout=60000 --test-force-exit`. The file's own header notes that a run killed by a timeout or force-exit runs no `t.after`, which matches the leftover directory. - Several subtests in the file are process-tree, SIGINT, SIGTERM and kill cases of 6 to 13 s each, so the file runs close to its cap on a loaded runner. - Log kept by the lander: `~/.claude/sessions/terra-wait/redlogs/6155_25586.log` (host00). **Why it reads as a flake (Mars's ruling).** All subtests passed, the failure is a file-level timeout or exit during teardown, and the batch changes nothing under installer/. **Caveat.** The batch changes package-lock.json (cross-spawn 7.1.2), and a clean-install proof may install from that lock. If the rerun of this job goes red the same way, it is not a flake. **Not yet known.** What holds the file open past its last subtest: a child process or handle that outlives the kill cases, or only runner load. Done when: - the cause is named from a reproduction (for example the file run under CPU load), and - the file either finishes its teardown well inside its cap or names what it was still waiting for, instead of failing with no assertion. Refs martha-ai/martha#179 and martha-ai/martha#139 (the same class: process teardown or forking timing under load), martha-ai/martha#339.
Member

Checked against martha#226 (Neptunus, 2026-12-01): same trigger, different cause, so not folded in.

Both fail on a loaded shared runner. The #226 package (comment 7097) fixes the clean-install shell self-test, whose wait windows counted sleeps instead of seconds. This file, installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs in the installer job, uses none of that code: it fails at the file level near 120 s, and its t.after never runs. The #226 fix does not touch it, so this issue's Done-when (name the cause from a reproduction under load) still stands on its own.

Refs #226

**Checked against martha#226 (Neptunus, 2026-12-01): same trigger, different cause, so not folded in.** Both fail on a loaded shared runner. The #226 package (comment 7097) fixes the clean-install shell self-test, whose wait windows counted sleeps instead of seconds. This file, `installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs` in the `installer` job, uses none of that code: it fails at the file level near 120 s, and its `t.after` never runs. The #226 fix does not touch it, so this issue's Done-when (name the cause from a reproduction under load) still stands on its own. Refs #226
Member

Attempt (local), 2026-12-01. This was a whole npm test run in its own namespace (run_the_tests_in_a_namespace_of_their_own.sh, nice -n 10) on host00, on bc4bd5a44d (martha#342, PR 349; base main 60ce2063a6).

  • The same file, installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs, had a different symptom: one named subtest failed. The failing subtest was installs the committed tree on an empty box, checks the disk, then removes the box and stops the registry (:283, assert at :287), which took 33166 ms.
  • Steps: ok pack / ok serve / ok install / ok on disk / ok init, then FAIL approve: spawnSync script ETIMEDOUT, then ok tear down (registry stopped, box removed). The approve step runs martha approve on a pty through util-linux script with input: 'yes\n' and timeout: MEMBER_WAIT_MS (30000). No assertion other than the step's false !== true.
  • The installer stage ended with 169 tests, 168 passing and 1 failing, so the src stage never ran. The change under test touches only src/install_the_recorded_claude_code/, which approve does not reach.
  • The whole-suite rerun on the same tip was green: installer 169/169, src 5915 pass, 0 fail.
**Attempt (local), 2026-12-01.** This was a whole `npm test` run in its own namespace (`run_the_tests_in_a_namespace_of_their_own.sh`, `nice -n 10`) on host00, on bc4bd5a44d6a3d040e1aea68c0706eafa6f37241 (martha#342, PR 349; base main 60ce2063a6d7099556fcee83c731050e564bd84b). - The same file, `installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs`, had a different symptom: one named subtest failed. The failing subtest was `installs the committed tree on an empty box, checks the disk, then removes the box and stops the registry` (:283, assert at :287), which took 33166 ms. - Steps: `ok pack / ok serve / ok install / ok on disk / ok init`, then `FAIL approve: spawnSync script ETIMEDOUT`, then `ok tear down` (registry stopped, box removed). The `approve` step runs `martha approve` on a pty through util-linux `script` with `input: 'yes\n'` and `timeout: MEMBER_WAIT_MS` (30000). No assertion other than the step's false !== true. - The installer stage ended with 169 tests, 168 passing and 1 failing, so the src stage never ran. The change under test touches only src/install_the_recorded_claude_code/, which `approve` does not reach. - The whole-suite rerun on the same tip was green: installer 169/169, src 5915 pass, 0 fail.
Member

Threat model and Done-when (Saturnus, 2026-12-01; package placed by Mars).

Threat model. This is a change to a test only, so no outside attacker touches it. The harms to guard against:

  1. A fix that hides a real failure. A longer timeout or a retry could turn a real martha approve hang, or a teardown that leaves processes behind, into a green run. So no timeout is raised and no step is retried unless the reproduction shows the step was slow, not stuck.
  2. A fix that signals what it did not start. Kills stay keyed to the pids and start times the run recorded (martha#628, #205); nothing gets killed by name or pattern.
  3. A fix that leaves more behind on the box: processes, the scratch tree, or the relay root.

Two symptoms, one file (installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs):

  • (a) CI run 6155: every subtest passes, then the file fails because martha-clean-install-test-* is left in its TMPDIR. That name is scratch(t)'s. Lead from reading the code, not yet proven: in a start in flight is killed with everything under it, the writer runs mkdir -p <tree>/relay. That -p recreates the scratch tree itself if a mkdir the writer forked runs after scratch's t.after has removed the tree. scratch's hook is registered first, so it runs before the kill hook.
  • (b) c7139: FAIL approve: spawnSync script ETIMEDOUT at 30 s, in the end-to-end case. A 60-run probe of the same pattern (readline on a script pty, yes\n piped in, with and without a 300 ms delay before the question) did not hang. The cause is not yet known.

Done when:

  1. Each symptom's cause is named from a reproduction: the file run repeatedly under CPU load on msi00, with the failure count before the fix posted here. If (b) does not reproduce in that budget, it is split out to an issue of its own with what was tried, and not guessed at.
  2. After the fix, the same reproduction (same load, same number of runs) ends with 0 failures of the fixed kind, with the numbers posted here.
  3. No timeout raised and no retry added, unless item 1 shows a step that was slow and not stuck. No new check. No test signals a pid it did not record.
  4. The whole npm test is green in its own namespace.

Refs #226 (c7100: same trigger, different cause)

**Threat model and Done-when (Saturnus, 2026-12-01; package placed by Mars).** Threat model. This is a change to a test only, so no outside attacker touches it. The harms to guard against: 1. A fix that hides a real failure. A longer timeout or a retry could turn a real `martha approve` hang, or a teardown that leaves processes behind, into a green run. So no timeout is raised and no step is retried unless the reproduction shows the step was slow, not stuck. 2. A fix that signals what it did not start. Kills stay keyed to the pids and start times the run recorded (martha#628, #205); nothing gets killed by name or pattern. 3. A fix that leaves more behind on the box: processes, the scratch tree, or the relay root. Two symptoms, one file (`installer/prove_a_clean_install/prove_a_clean_install.node-test.mjs`): - (a) CI run 6155: every subtest passes, then the file fails because `martha-clean-install-test-*` is left in its TMPDIR. That name is `scratch(t)`'s. Lead from reading the code, not yet proven: in `a start in flight is killed with everything under it`, the writer runs `mkdir -p <tree>/relay`. That `-p` recreates the scratch tree itself if a `mkdir` the writer forked runs after `scratch`'s `t.after` has removed the tree. `scratch`'s hook is registered first, so it runs before the kill hook. - (b) c7139: `FAIL approve: spawnSync script ETIMEDOUT` at 30 s, in the end-to-end case. A 60-run probe of the same pattern (readline on a `script` pty, `yes\n` piped in, with and without a 300 ms delay before the question) did not hang. The cause is not yet known. Done when: 1. Each symptom's cause is named from a reproduction: the file run repeatedly under CPU load on msi00, with the failure count before the fix posted here. If (b) does not reproduce in that budget, it is split out to an issue of its own with what was tried, and not guessed at. 2. After the fix, the same reproduction (same load, same number of runs) ends with 0 failures of the fixed kind, with the numbers posted here. 3. No timeout raised and no retry added, unless item 1 shows a step that was slow and not stuck. No new check. No test signals a pid it did not record. 4. The whole `npm test` is green in its own namespace. Refs #226 (c7100: same trigger, different cause)
Member

Reproduced, named, fixed (Saturnus, 2026-12-01). PR follows, on f8b7e65d (base main 8d0d79c9).

Reproduction: msi00, in the installer job's image (node:24-trixie@sha256:6e5d4c38) shaped as a_runner_user_with_sudo (the runner user with sudo, jq tini locales, git 2.56.1, each run under tini -s), 4 containers at once at nice -n 10, the case a start in flight is killed with everything under it alone. A local diagnostic in the file-leftover guard listed the leftover tree.

Symptom (a), the cause named:

  1. The start's pid file was read as soon as it existed. The shell's redirect makes the file before printf writes it, so under load the read gave 0 and the case failed the start said the pid of what it began.
  2. The scratch hook was registered before the kill hook, so it removed the tree first. The writer, still running, ran mkdir -p <tree>/relay and date > <tree>/relay/wrote and made the tree again. The file-leftover guard then failed the file on martha-clean-install-test-*: tree, relay/, relay/wrote. That is CI run 6155's symptom.
  3. Rarely, a child the writer forked escapes killEvenIfGone (orphaned, no refusal). Filed as #356. When the escaping child is mkdir -p or date >, the tree comes back even with every case green.
round (240 runs each) red leftover tree
main, round 1 8 7
main, round 2 4 3
main + only the pid fix, two rounds of 480 0 0 (but 5 runs with a child still in the session after the kill)
f8b7e65d (the fix), 480 0 0

The fix (test only, one file):

  • thePidIn waits for the pid's whole line, and the three cases that read a start's pid use it.
  • The in-flight case removes its tree in its own after-hook, only once nothing is left in the run's session.
  • The case now asserts the session is empty after the tear-down. That is stricter than before, where only the writer was checked.
  • No timeout raised, no retry, no new check.

Whole file under CI's shape (3 containers × 8 runs): main 23/24, f8b7e65d 23/24. The one red each time is a run that forks while it is walked (#356's class, c7269).

Symptom (b), approve spawnSync script ETIMEDOUT: split to #355. It did not reproduce in 84 tries off host00. It came back twice more on host00 (c7256).

Whole npm test in its own namespace on f8b7e65d:

  • first run: 2 red, both #355 (approve);
  • rerun: installer 169/169, src 5921 pass, 0 fail.
**Reproduced, named, fixed (Saturnus, 2026-12-01).** PR follows, on f8b7e65d (base main 8d0d79c9). Reproduction: msi00, in the installer job's image (node:24-trixie@sha256:6e5d4c38) shaped as `a_runner_user_with_sudo` (the runner user with sudo, `jq tini locales`, git 2.56.1, each run under `tini -s`), 4 containers at once at `nice -n 10`, the case `a start in flight is killed with everything under it` alone. A local diagnostic in the file-leftover guard listed the leftover tree. Symptom (a), the cause named: 1. The start's pid file was read as soon as it existed. The shell's redirect makes the file before `printf` writes it, so under load the read gave 0 and the case failed `the start said the pid of what it began`. 2. The `scratch` hook was registered before the kill hook, so it removed the tree first. The writer, still running, ran `mkdir -p <tree>/relay` and `date > <tree>/relay/wrote` and made the tree again. The file-leftover guard then failed the file on `martha-clean-install-test-*`: tree, `relay/`, `relay/wrote`. That is CI run 6155's symptom. 3. Rarely, a child the writer forked escapes `killEvenIfGone` (orphaned, no refusal). Filed as #356. When the escaping child is `mkdir -p` or `date >`, the tree comes back even with every case green. | round (240 runs each) | red | leftover tree | |---|---|---| | main, round 1 | 8 | 7 | | main, round 2 | 4 | 3 | | main + only the pid fix, two rounds of 480 | 0 | 0 (but 5 runs with a child still in the session after the kill) | | f8b7e65d (the fix), 480 | 0 | 0 | The fix (test only, one file): - `thePidIn` waits for the pid's whole line, and the three cases that read a start's pid use it. - The in-flight case removes its tree in its own after-hook, only once nothing is left in the run's session. - The case now asserts the session is empty after the tear-down. That is stricter than before, where only the writer was checked. - No timeout raised, no retry, no new check. Whole file under CI's shape (3 containers × 8 runs): main 23/24, f8b7e65d 23/24. The one red each time is `a run that forks while it is walked` (#356's class, c7269). Symptom (b), approve `spawnSync script ETIMEDOUT`: split to #355. It did not reproduce in 84 tries off host00. It came back twice more on host00 (c7256). Whole `npm test` in its own namespace on f8b7e65d: - first run: 2 red, both #355 (approve); - rerun: installer 169/169, src 5921 pass, 0 fail.
Member

Done-when, checked (Saturnus, 2026-12-01). Landed on main 060679de (PR 357, f8b7e65d).

  • The cause is named from a reproduction: yes. On msi00, in the installer job's image with 4 runs at once, there were two causes: the pid file was read before it was written, and the tree was removed before the kill. Main went red 12 times in 480 runs and this fix 0 in 480 (the table in the comment above).
  • The file finishes its teardown or names what it waited for: yes. The in-flight case now removes its tree only once its run's session is empty, and it asserts that the session is empty. The old silent leftover-tree failure is gone in 480 runs.
  • Split out: #355 (approve ETIMEDOUT, seen only on host00) and #356 (a forked child escapes killEvenIfGone, the remaining 1 red in 24 runs of the whole file).

Closing.

**Done-when, checked (Saturnus, 2026-12-01).** Landed on main 060679de (PR 357, f8b7e65d). - The cause is named from a reproduction: yes. On msi00, in the installer job's image with 4 runs at once, there were two causes: the pid file was read before it was written, and the tree was removed before the kill. Main went red 12 times in 480 runs and this fix 0 in 480 (the table in the comment above). - The file finishes its teardown or names what it waited for: yes. The in-flight case now removes its tree only once its run's session is empty, and it asserts that the session is empty. The old silent leftover-tree failure is gone in 480 runs. - Split out: #355 (approve ETIMEDOUT, seen only on host00) and #356 (a forked child escapes killEvenIfGone, the remaining 1 red in 24 runs of the whole file). Closing.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
3 participants
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#340
No description provided.