Skip to content

fix(bin): bound every test-run script and the whole run, and sweep leftover fixture processes - #7398

Open
babbarc wants to merge 5 commits into
kunchenguid:mainfrom
babbarc:fm/upstream-offer-test-run-hang-bounds
Open

babbarc wants to merge 5 commits into
kunchenguid:mainfrom
babbarc:fm/upstream-offer-test-run-hang-bounds

Conversation

@babbarc

@babbarc babbarc commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Keep the fleet's upstream offer #7398 (bounding every test-run script and the whole run, plus sweeping leftover fixture processes) live: rebase it onto current upstream main so it stays mergeable.

Context that makes the ask readable: all 19 of its checks pass, but upstream's own recent work touched the same three files, so the PR now conflicts and cannot be merged as-is. Upstream's maintainer said the change is still a merge-or-leave call for their own captain, that nothing was asked of us, and that the head then merged cleanly. The offer is still genuinely unimplemented upstream - current upstream bin/fm-test-run.sh carries none of the per-script default bound, the whole-run bound, or the leftover-process sweep.

What Changed

  • bin/fm-test-run.sh now applies a 3600s per-script bound in every mode, not only --changed, unless --per-script-timeout-secs is passed (0 still disables it). It also adds a whole-run bound, --run-timeout-secs, which defaults to 21600s. A supervising parent re-runs the invocation under fm_exec_timed. When the whole-run bound trips, the parent exits 124 and names the scripts or phase the run was in. It also forwards INT/TERM/HUP to the child. A tripped per-script bound is named again on stderr after the summary.
  • Each script runs with a marker unique to the run and the script, carried in FM_TEST_RUN_FIXTURE_MARKS. When a bound trips or the run is interrupted, every process still carrying that marker gets TERM, then KILL. This catches descendants that moved into their own session or process group. The sweep finds them through /proc where it exists and ps -E otherwise. On an interrupted run the leftover run temp dir is removed after the sweep.
  • tests/fm-test-run.test.sh adds tests for: the default per-script bound in every mode, the sweep of escaped descendants, the whole-run bound stopping a hang, and no fixture processes left after an interrupt. CONTRIBUTING.md now lists the per-script and whole-run hang bounds among what bin/fm-test-run.sh owns.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The fix round only reorders the sweep ahead of a now non-fatal temp-tree removal, which correctly keeps the sweep, the FAIL line, and the 124/128+n exit status from being skipped. The rest of the change keeps the user-decided defaults and the bounds the intent requires, and the only remaining finding is a minor test-robustness gap.

Testing

I ran the four focused bound tests from tests/fm-test-run.test.sh; all passed in about 15s. Then I drove the real runner by hand against a throwaway git repo whose fixture hangs and starts a setsid helper. - Real Ctrl-C in a tmux pty: exit 130, "run interrupted by SIGINT ... swept 7", and the fixture and helper are gone, even though ps showed the fixture in GNU timeout's own process group. - Per-script bound under --all: exit 1 with a FAIL line naming the script and "swept 1". - Whole-run bound: exit 124, sweep reported. - Defaults with no flags: ps showed a 21600s watchdog and timeout -k 1 3600 wrapping the script; a TERM to the runner's pid then exited 143 with the sweep. - Healthy run: a real repo script passed with default bounds on. The change has no UI, so the evidence is CLI transcripts and pane captures. All throwaway repos and tmux servers were removed, and the worktree is clean.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Running --all with no flags wraps each script in the 3600s per-script bound and the whole invocation in the 21600s bound ✅ pass live default-bounds-process-tree.txt (ps shows timeout -k 1 3600 around the fixture and the perl watchdog with 21600); test_default_per_script_bound_applies_in_every_mode
A hung script under --all trips the per-script bound: exit 1, FAIL line names the script, escaped setsid helper swept ✅ pass live bounds-trip-all-mode.txt (first block: exit=124 record, 'swept 1 leftover process(es)', run EXIT=1, both pids gone)
A run that outlives --run-timeout-secs is stopped with exit 124, names what it was running, and sweeps leftover processes ✅ pass live bounds-trip-all-mode.txt (second block: EXIT=124 after 4s, 'whole-run bound tripped ... swept 1'); test_run_timeout_bounds_the_whole_invocation
Adversarial: a real terminal Ctrl-C during --all, with the fixture in timeout's own process group, still kills the fixture and its escaped helper ✅ pass live ctrl-c-terminal-pane.txt (EXIT=130, 'run interrupted by SIGINT ... swept 7'); kill -0 showed both pids gone
Adversarial: a TERM sent to the runner's pid alone exits 143 and leaves no fixture process ✅ pass live default-bounds-process-tree.txt (runner exit=143, 'interrupted by SIGTERM ... swept 7'); test_interrupted_run_leaves_no_fixture_process also covers -j 2 with an unremovable temp dir
A healthy real repo script still passes with the default bounds on ✅ pass live healthy-real-script-default-bounds.txt (tests/fm-timeout-lib.test.sh exit=0)
Evidence: Focused bound/sweep/interrupt tests

Source: Focused bound/sweep/interrupt tests

ok - every selection mode bounds each script by default, and 0 opts out
ok - a tripped per-script bound sweeps descendants that left its process group
ok - --run-timeout-secs bounds the whole invocation, scripts and selection alike
ok - an interrupted run leaves none of its script's processes running
ALL-SELECTED-DONE
Evidence: Real terminal Ctrl-C pane capture

Source: Real terminal Ctrl-C pane capture

^Cfm-test-run: FAIL: run interrupted by SIGINT while running tests/fm-live-hang.test.sh; swept 7 leftover fixture process(es) EXIT=130

bin/fm-test-run.sh --all; echo EXIT=$?
[yeti@alps repo]$ bin/fm-test-run.sh --all; echo EXIT=$?
FM_TEST_BEGIN 2026-11-03T19:44:11Z tests/fm-live-hang.test.sh family=unclassified expected_gate_skip=none
ok - fixture about to wedge
^Cfm-test-run: FAIL: run interrupted by SIGINT while running tests/fm-live-hang.test.sh; swept 7 leftover fixture process(es)
EXIT=130
[yeti@alps repo]$
Evidence: Per-script and whole-run bounds tripping in --all mode

Source: Per-script and whole-run bounds tripping in --all mode

$ bin/fm-test-run.sh --all --per-script-timeout-secs 3
FM_TEST_BEGIN 2026-11-03T19:44:33Z tests/fm-live-hang.test.sh family=unclassified expected_gate_skip=none
ok - fixture about to wedge
not ok - tests/fm-live-hang.test.sh exceeded the per-script bound of 3s (--per-script-timeout-secs) and was terminated; swept 1 leftover process(es) outside its process group
FM_TEST_END 2026-11-03T19:44:37Z tests/fm-live-hang.test.sh exit=124 duration_ms=4030 gate_skip=false
FM_TEST_SUMMARY total=1 failed=1 skipped_gate=0 duration_ms=4074
FM_TEST_SUMMARY_FAMILY family=unclassified count=1 duration_ms=4030 failed=1
FM_TEST_SLOWEST rank=1 script=tests/fm-live-hang.test.sh duration_ms=4030
fm-test-run: FAIL: per-script bound tripped: tests/fm-live-hang.test.sh exceeded --per-script-timeout-secs 3s and was terminated
EXIT=1 after 4s
pid 182439 gone
pid 182441 gone

$ bin/fm-test-run.sh --all --per-script-timeout-secs 0 --run-timeout-secs 3
FM_TEST_BEGIN 2026-11-03T19:44:38Z tests/fm-live-hang.test.sh family=unclassified expected_gate_skip=none
ok - fixture about to wedge
fm-test-run: FAIL: whole-run bound tripped: this run exceeded --run-timeout-secs 3s while running tests/fm-live-hang.test.sh and was terminated; swept 1 leftover fixture process(es)
EXIT=124 after 4s
pid 184378 gone
pid 184380 gone
Evidence: Default bounds visible in process tree, plus TERM sweep

Source: Default bounds visible in process tree, plus TERM sweep

$ bin/fm-test-run.sh --all  (no bound flags) - process tree while the fixture runs:
 185140  185124 perl -MPOSIX=WNOHANG,setpgid -MTime::HiRes=time -e        my ($bound, $grace, $owner, $shell_parent) = (shift, shift, shift, shift);       # exec preserves the shell PID, including in Bash 3.2 subshells where       # BASHPID is unavailable. Keep the pre-exec parent for startup races.       $owner = $shell_parent if $owner == $$;       my $parent = getppid();       my ($pid, $pending, $kill_at, $timed_out) = (0, "", 0, 0);       for my $sig (qw(TERM INT HUP)) {         $SIG{$sig} = sub {           if ($pid) { kill $sig, -$pid } else { $pending = $sig }           $kill_at ||= time + $grace;         };       }       my $child = fork;       exit 127 unless defined $child;       if ($child == 0) {         $SIG{$_} = "DEFAULT" for qw(TERM INT HUP);         setpgid(0, 0);         exec @ARGV;         exit 127;       }       setpgid($child, $child);       $pid = $child;       kill $pending, -$pid if $pending;       my $deadline = time + $bound;       sub finish {         my $status = shift;         kill "KILL", -$pid if $kill_at;         exit 124 if $timed_out;         exit(($status & 127) ? 128 + ($status & 127) : $status >> 8);       }       while (1) {         my $done = waitpid $pid, WNOHANG;         finish($?) if $done == $pid;         exit 127 if $done == -1;         if ($kill_at) {           if (time >= $kill_at) {             kill "KILL", -$pid;             waitpid $pid, 0;             finish($?);           }         } elsif (time >= $deadline) {           $timed_out = 1;           $kill_at = time + $grace;           kill "TERM", -$pid;         } elsif (getppid() != $parent || !kill(0, $owner)) {           $kill_at = time + $grace;           kill "TERM", -$pid;         }         select undef, undef, undef, 0.05;       }      -- 21600 10 185128 185125 bash /tmp/fmtr-live.bb43yp/repo/bin/fm-test-run.sh --all
 185167  185167 /usr/bin/timeout -k 1 3600 bash -c      status_file=$1     shift     "$@"     command_rc=$?     printf "%s\n" "$command_rc" > "$status_file"     exit "$command_rc"    _ /tmp/fm-timeout-status.0zBPZg bash -c bash "$1" 2>&1 | tee "$2"; exit "${PIPESTATUS[0]}" _ tests/fm-live-hang.test.sh /tmp/fm-test-run.elFQcm/out.0
 185168  185167 bash -c      status_file=$1     shift     "$@"     command_rc=$?     printf "%s\n" "$command_rc" > "$status_file"     exit "$command_rc"    _ /tmp/fm-timeout-status.0zBPZg bash -c bash "$1" 2>&1 | tee "$2"; exit "${PIPESTATUS[0]}" _ tests/fm-live-hang.test.sh /tmp/fm-test-run.elFQcm/out.0
 185169  185167 bash -c bash "$1" 2>&1 | tee "$2"; exit "${PIPESTATUS[0]}" _ tests/fm-live-hang.test.sh /tmp/fm-test-run.elFQcm/out.0
 185170  185167 bash tests/fm-live-hang.test.sh
runner exit=143
FM_TEST_BEGIN 2026-11-03T19:44:52Z tests/fm-live-hang.test.sh family=unclassified expected_gate_skip=none
ok - fixture about to wedge
fm-test-run: FAIL: run interrupted by SIGTERM while running tests/fm-live-hang.test.sh; swept 7 leftover fixture process(es)
Evidence: Healthy real script under default bounds

Source: Healthy real script under default bounds

ok - fm_exec_timed rejects a zero, padded, non-numeric, or missing bound and a missing command
tests/fm-timeout-lib.test.sh: line 29: 187771 Killed                     ( . "$ROOT/bin/fm-timeout-lib.sh"; PATH=$path fm_exec_timed "$@" )
ok - fm_exec_timed's GNU timeout fallback kills a TERM-ignoring command once the grace has passed
ok - fm_timed_out accepts 124 and 137 and nothing else
FM_TEST_END 2026-11-03T19:45:14Z tests/fm-timeout-lib.test.sh exit=0 duration_ms=12432 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=12487
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=12432 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-timeout-lib.test.sh duration_ms=12432
EXIT=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-test-run.sh - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Review** - 1 info
  • ⚠️ bin/fm-test-run.sh:2451 - In run_under_supervisor, the trip and interrupt path deletes the run's temp tree before it sweeps the processes still using it, and it does so with set -e back on (re-enabled at :2431). The line is [ -z "$run_tmp" ] || rm -rf "$run_tmp". When a whole-run bound trips, or the runner gets an INT/TERM/HUP, the perl watchdog kills only the inner runner's process group. Each fixture is still running under GNU timeout in a process group of its own, and some fixtures have escaped helpers. In -j runs those fixtures have TMPDIR set to $RUN_TMP/wN/tmp, so they keep creating files inside the tree that rm -rf is deleting. A concrete failing sequence: run bin/fm-test-run.sh -j 4 <scripts> and send TERM to the runner (or let --run-timeout-secs trip) while a fixture is writing temp files. rm -rf then fails with 'Directory not empty'. Because rm is the final command of an || list, set -e makes the parent exit 1 at once. It never reaches sweep_fixture_processes, never logs the FAIL line, and exits 1 instead of 124 or 128+n. The fixture and its helpers keep running for up to 3600s, and part of the tmp tree stays behind. That is the leak this change exists to close. Even when rm succeeds, deleting the tree before the sweep lets the still-live fixtures recreate files in it afterwards. Fix: call swept=$(sweep_fixture_processes ";$RUN_MARK/") before removing the phase file and run_tmp, and make the removal non-fatal (rm -rf "$run_tmp" 2>/dev/null || true).

🔧 Fix applied.
1 info still open:

  • ℹ️ tests/fm-test-run.test.sh:1749 - The round-1 fix changed the interrupt test's fixture name from a made-up name to the real tests/fm-brief.test.sh, apparently so that the new pid TERM --jobs 2 case is admitted to the parallel scheduler. Parallel admission needs a script in list_proven_isolated (bin/fm-test-run.sh:579). Only the parallel path puts the fixture's TMPDIR under $RUN_TMP/wN/tmp, which is what makes the rm -rf of the run's temp tree fail. If fm-brief is ever removed from that list or from the standalone family, --jobs 2 falls back to serial. The unremovable directory then lands in $tmp/t instead of the run's temp tree, and the case still passes without exercising the sweep-before-removal ordering it was added for. Suggested fix: add a comment explaining why the name was chosen, and assert that the case actually ran in parallel, for example by checking that $tmp/t/fm-test-run.*/w1 was left behind, since the unremovable directory makes that observable.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Running --all with no flags wraps each script in the 3600s per-script bound and the whole invocation in the 21600s bound ✅ pass live default-bounds-process-tree.txt (ps shows timeout -k 1 3600 around the fixture and the perl watchdog with 21600); test_default_per_script_bound_applies_in_every_mode
A hung script under --all trips the per-script bound: exit 1, FAIL line names the script, escaped setsid helper swept ✅ pass live bounds-trip-all-mode.txt (first block: exit=124 record, 'swept 1 leftover process(es)', run EXIT=1, both pids gone)
A run that outlives --run-timeout-secs is stopped with exit 124, names what it was running, and sweeps leftover processes ✅ pass live bounds-trip-all-mode.txt (second block: EXIT=124 after 4s, 'whole-run bound tripped ... swept 1'); test_run_timeout_bounds_the_whole_invocation
Adversarial: a real terminal Ctrl-C during --all, with the fixture in timeout's own process group, still kills the fixture and its escaped helper ✅ pass live ctrl-c-terminal-pane.txt (EXIT=130, 'run interrupted by SIGINT ... swept 7'); kill -0 showed both pids gone
Adversarial: a TERM sent to the runner's pid alone exits 143 and leaves no fixture process ✅ pass live default-bounds-process-tree.txt (runner exit=143, 'interrupted by SIGTERM ... swept 7'); test_interrupted_run_leaves_no_fixture_process also covers -j 2 with an unremovable temp dir
A healthy real repo script still passes with the default bounds on ✅ pass live healthy-real-script-default-bounds.txt (tests/fm-timeout-lib.test.sh exit=0)
  • Focused runner tests (only these four, from tests/fm-test-run.test.sh): test_default_per_script_bound_applies_in_every_mode, test_tripped_bound_sweeps_escaped_descendants, test_run_timeout_bounds_the_whole_invocation, test_interrupted_run_leaves_no_fixture_process
  • Real terminal Ctrl-C: bin/fm-test-run.sh --all typed into a tmux pane on a private socket, send-keys C-c while the fixture hung, then checked with kill -0 that the fixture and escaped pids were gone
  • bin/fm-test-run.sh --all --per-script-timeout-secs 3 against the hanging fixture
  • bin/fm-test-run.sh --all --per-script-timeout-secs 0 --run-timeout-secs 3 against the hanging fixture
  • bin/fm-test-run.sh --all with no bound flags: took a ps snapshot while the fixture ran, then sent TERM to the runner's pid
  • bin/fm-test-run.sh tests/fm-timeout-lib.test.sh in the worktree with default bounds
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: first look on head 8ad9deb2.

Contract-class: new-default — bin/fm-test-run.sh now applies a 1500s per-script bound in every selection mode (previously only --changed auto-armed it; default was 0) and adds a new whole-run --run-timeout-secs default of 21600s, plus a fixture-process sweep on trip/interrupt. Unconfigured runs therefore gain always-on hang bounds they did not have. The escaped-descendant sweep for an already-tripped bound is corrective, but the expanded defaults dominate the class.

VISION: aligns on scripts owning mechanics and field incident → coverage; the new always-on bounds are still a default-behavior change for the runner (Authority / "new capability as option" — captains who relied on unbounded --all / named selection need --per-script-timeout-secs 0 / --run-timeout-secs 0 to opt out).

Attestation: MATCH (8ad9deb2…). workflow-zero.

Security: none — test-runner only; marker-scoped /proc/ps -E sweep; no workflows.

Overlap: also pins LC_ALL=C on coverage-guard comm calls — same surface as open #7396 and #7391. If one of those lands first, the collation hunk here is redundant but harmless.

CI: approved fork runs CI 38877317407 + Require no-mistakes 38877317390. Stamping waiting-ci. When green: captain merge-or-leave (new-default); not auto-merge.

@babbarc

babbarc commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Sorry to poke - this pull request's CI and Require no-mistakes runs are still sitting at action_required on 98a7d1f7, and that approval is the only thing between it and its check results. Would you mind approving them when convenient?

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks for the nudge, @babbarc, and sorry these sat. I've approved both fork runs on head 98a7d1f7: CI 38895333102 (running now) and Require no-mistakes 38895332835.

What you need to do: PR must be raised via no-mistakes failed. The PR body attestation still names 8ad9deb2, but the head is now 98a7d1f7, because the 3600s widening commit was pushed after the no-mistakes run. Please re-run git push no-mistakes from this branch so the attestation binds to 98a7d1f7 (or to whatever the new head is). That re-raise should also refresh the live evidence for the 3600s default. Your current transcript is from the 1500s head.

Contract-class: new-default (unchanged). The new commit raises the every-mode per-script default from 1500s to 3600s, and the --changed auto-bound floor to 3600s with it. The new whole-run 21600s default stays. Unconfigured runs still get always-on bounds they didn't have before, so this is a captain merge-or-leave decision once it's green. It won't auto-merge. The narrower 3600s value looks like a sensible answer to the slow-runner trip you documented.

Security: none. Test runner only, no workflow changes.

@babbarc
babbarc force-pushed the fm/upstream-offer-test-run-hang-bounds branch from 98a7d1f to 6172428 Compare October 17, 2026 07:12
@babbarc babbarc changed the title fix(bin): bound every test run and sweep escaped fixture processes fix(bin): bound every test-run script and the whole run, and sweep leftover fixture processes Oct 17, 2026
@babbarc

babbarc commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Re-raise done: the branch now sits at 61724289 (rebuilt on current main) and the body attestation binds that head, so the "PR must be raised via no-mistakes" requirement should be satisfied. The fresh runs registered for this head are waiting on approval - no other changes.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks for the re-raise, @babbarc. On head 61724289 everything is green now: the no-mistakes attestation binds this head, PR must be raised via no-mistakes passes, and CI 39012801867 passes. On the first attempt, serial 2 hit the known 30-minute ceiling and serial 5 had an unrelated timing flake in tests/fm-remote-delta-read.test.sh. I re-ran those two jobs once and both passed. The PR is mergeable with no conflicts.

Contract-class: new-default. An unconfigured bin/fm-test-run.sh run now gets a 3600s per-script bound in every selection mode, where main defaults to 0 outside --changed, plus a new 21600s whole-run bound. Setting either to 0 still opts out. Because that changes default behavior, I can't auto-merge it.

This is now a captain decision, not waiting on you. I've passed it to Kun to merge or leave. You don't need to do anything else unless he asks for changes.

@babbarc

babbarc commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

The captain's word is to merge it. We do want this taken as default behaviour, the fleet already runs exactly this change on our own line, and we are happy for you to merge at 61724289.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @babbarc. It's good to know your fleet already runs this change at 61724289 and that you want it as the default.

One clarification. For this repo, the captain whose word can merge a default-behavior change is Kun, the maintainer. A "merge it" from your own home's captain is a strong signal and I've passed it along, but it doesn't authorize a merge here. This is still a captain-decision hold with Kun, not waiting on you.

Nothing has changed on my side. The head is still 61724289, it's mergeable/CLEAN, CI 39012801867 and the no-mistakes check are green, and the attestation matches. Contract-class: new-default. An unconfigured bin/fm-test-run.sh run now gets a 3600s per-script bound in every mode plus a new 21600s whole-run bound, where main has neither outside --changed. My VISION per-rule read is the same as before: authority is the captain's call, and every other rule aligns.

You don't need to do anything else unless Kun asks for changes. For context, #7457 (the fm-supervision-host.test.sh assertion failures) is a separate test-reliability issue, and this PR neither fixes nor causes it.

babbarc and others added 4 commits November 3, 2026 19:37
…ed fixture processes (#17)

A wedged fixture could hang a local run forever: only --changed got a
per-script bound by default, --max-wall-ms is judged after the run, and a
tripped bound signalled only the fixture's process group, so a private tmux
server or setsid helper outlived it holding its /tmp directory.

- Apply the 1500s per-script bound in every mode (0 still opts out).
- Add --run-timeout-secs (default 21600s), which re-runs the invocation
  under fm_exec_timed so selection, scheduling, fixtures, and finalization
  are all bounded, and exits 124 naming the fixtures or phase in flight.
- Mark each fixture's environment and, when a bound trips, TERM then KILL
  every process still carrying that mark, which reaches descendants that
  left the process group.
- Run comm under LC_ALL=C in the coverage guard and its test, matching the
  C-sorted inputs, so --check-coverage passes on UTF-8 hosts.
The 1500s default tripped tests/fm-supervision-host.test.sh on a slow
shared CI runner while it was still running. That script stayed under
1236s across eleven green main runs, so 3600s keeps roughly 2.9x headroom
over the slowest healthy measurement and 2.4x over that trip point while
still bounding a genuinely hung script.
@babbarc
babbarc force-pushed the fm/upstream-offer-test-run-hang-bounds branch from 6172428 to e4d7625 Compare November 3, 2026 19:46
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the unrelated-directory deletion finding is fixed.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): ci-2 (Greptile, cleanup..." · Reviewed by Greptile

Comment thread bin/fm-test-run.sh Resolved
…ctory) is fixed. Rule that was broken: the supervising parent must only ever `rm -rf` the temp directory its own run created. There is one reader of the `run-tmp` record and one removal site, both in `run_under_supervisor` in bin/fm-test-run.sh. The interrupt path and the whole-run-trip path both go through that one place. Changes in bin/fm-test-run.sh: - **Reading the record:** it now uses `sed -n 's/^run-tmp //p' | tail -n 1`, which keeps the whole rest of the line. Before, awk `$2` cut the path at the first space. - **Checking before removal:** the path must match exactly `"${TMPDIR:-/tmp}"/fm-test-run.` plus 6 characters that contain no `/`. That is the form the child creates with `mktemp -d`, and the parent checks it against its own TMPDIR. The path must also be a real directory and not a symlink. If any check fails, the removal is skipped and nothing is deleted. - **Unchanged:** the sweep still runs before the removal, and the removal is still non-fatal. No default bound, sweep algorithm, signal forwarding or workflow was changed. New regression test in tests/fm-test-run.test.sh, `test_tripped_run_cleanup_spares_a_spaced_tmpdir_sibling`: - It runs with `TMPDIR="$tmp/work files"` and a sibling `$tmp/work/keep`, then trips `--run-timeout-secs 3` on a hanging script. - It asserts exit 124, that the escaped helper was swept, that the sibling survives, and that the run's own temp tree was removed. - Against the previous runner it fails with "deleted an unrelated sibling". With the fix it passes. Local verification: - These tests all pass: the new test, the per-script bound, the default bound, the escaped-descendant sweep, the whole-run bound, the interrupted-run test, `--max-wall-ms`, and the jobs scheduler. - shellcheck warnings on bin/fm-test-run.sh are the same before and after (2 SC2034 warnings at 2834, which this change does not touch). - Two tests fail on this host for reasons this PR does not touch, so I made no change for them: - `test_jobs_admits_a_concurrent_safe_family` runs the real tests/fm-session-lock-ancestry.test.sh. That script also fails on its own here with "pty-host was not reparented to init", because this sandbox runs under a child subreaper. - `test_herdr_ci_family_run_has_a_step_timeout` needs ruby, which is not installed here. ci-1 (Full suite) was declined by the user as the outside-PR gate that needs a maintainer's full-ci label, so I made no change for it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants