Repository navigation
fix(test-run): bound every fixture and the whole run, and sweep escaped fixture processes - #17
Merged
Merged
Conversation
…ed fixture processes 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.
babbarc
added a commit
that referenced
this pull request
Nov 3, 2026
…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.
babbarc
pushed a commit
that referenced
this pull request
Nov 22, 2026
…ed (offer #8, final) Refreshed local patch carrying the final reviewed version of upstream offer #8 (kunchenguid#7382), squashed onto current upstream main. It replaces the two local variants this stack carried - 783c0ecc (the older home-resolution variant) and b9ece53e (explicit fm_home_correct calls in five entry points) - with the single mechanism upstream reviewed: - bin/fm-home-lib.sh corrects an inherited FM_HOME/FM_ROOT_OVERRIDE/FM_ROOT at source time when the checkout is a seeded second mate root, and 26 directly invoked bin entry points source it before deriving any home-scoped path, so a restored pane's own tool shell can no longer read or write the launcher's main home (backlog, state, checks). - bin/fm-supervision-lib.sh gains fm_supervision_home_verdict; bootstrap and the watcher tick re-judge alive second mate homes, report "alive but unsupervised" once via a check wake, and teardown clears the marker. - Test and tooling hardening the offer carries: the home-leak regression case, fixture list updates, lint source-directive count, and host-determinism fixes. Content is identical to the offer's final head 0190e10, minus the coverage-guard collation slice that offer #17 carries instead. Refreshed onto upstream bb3e690: the correction now also covers the entry points and the Pi read-repetition extension added upstream since the offer, and the cross-home verdict reads the session lock through the shared fm_session_pid_valid predicate, so a tagged win:<pid> holder is usable.
babbarc
added a commit
that referenced
this pull request
Nov 22, 2026
…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. Co-authored-by: yeti <yeti@alps>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The fork's Actions are off, so the local
bin/fm-test-run.shrun is the only gate for our own tooling.On 2026-09-19 a changed-file run wedged for about four days and left 21 fixture processes holding their /tmp fixture directories, with nothing failing or reporting.
What was actually missing (established by reading and by experiment)
--changed, and only when--jobswas not given; every other mode ran each fixture unbounded.--max-wall-msis judged after the run finishes, so it cannot stop a hang, and nothing bounded selection or finalization.fm_run_timeddoes signal the fixture's process group, and that does kill in-group children. But a descendant in a session or group of its own - a private tmux server and its pane, a setsid helper - survives it and keeps holding the fixture directory (shown below).Change
--per-script-timeout-secsnow defaults to 1500s in every mode;0still opts out. The default keeps its measured rationale (slowest loaded script about 1075s, so about 1.4x headroom, and under the 30-minute CI tier).--run-timeout-secs(default 21600s,0opts out). The runner re-runs itself under the existingfm_exec_timed, so selection, scheduling, every fixture, and finalization all fall under one bound. When it trips, the run exits 124 and names the fixtures or phase in flight.--max-wall-mskeeps its existing post-run result contract (its tests assert that a run past it still reports its complete summary), so the live bound gets its own flag instead of changing that one. The default is about 2x the measured complete serial suite (hint tables sum to about 167 min, plus about 20 min for unhinted scripts at the default weight).FM_TEST_RUN_FIXTURE_MARKS. Descendants inherit it whatever session or group they move to. When a bound trips, every process still carrying the marker gets TERM and then KILL (via/proc/*/environ, orps -Ewhere there is no/proc). Only a tripped bound sweeps; a fixture that exits on its own still owns its cleanup.--check-coverageand its test rancommunder the host locale on C-sorted inputs, so the coverage guard failed on this en_US.UTF-8 host. It now runscommunderLC_ALL=C.No second runner or timeout mechanism was added: the bounds use
fm_run_timedandfm_exec_timedfrombin/fm-timeout-lib.sh. Fixture assertions are unchanged. Test fixture setups that copied the runner with an empty, stubbed, or deleted timeout library now copy the real one, since the runner now always needs it.Proof
Reproduction fixture (
tests/fm-spawn-wedge.test.shin a throwaway copy of the runner): it starts a private tmux server running a fake agent, a setsid helper, and an in-group child, all with their cwd in a /tmp fixture directory, then waits forever for readiness.Hazard, before (base
72ada6f8)No flags (script-list mode, so no bound), killed from outside after 45s:
With the old
--per-script-timeout-secs 5, the run did fail at 5s, but the tmux server, its pane, and the setsid helper all survived:After (this branch)
Per-script bound:
Whole-run bound, with the per-script bound disabled:
I also checked both bounds with
fm_run_timedforced onto its perl mechanism (timeouthidden from PATH) and its bash mechanism (FM_TIMEOUT_MECHANISM_OVERRIDE=bash), with the same result: the run fails and no fixture process is left. A--changedrun whosegithangs fails withthis run exceeded --run-timeout-secs 4s during the selection phase, exit 124.The fixture's /tmp directory itself is not removed, because the wedged fixture never reached its own cleanup. Nothing holds it any more.
New regressions in
tests/fm-test-run.test.sh: the default bound in every mode, the sweep of a setsid descendant on a per-script trip, and the whole-run bound in a fixture and in selection.Commands and outcomes
bin/fm-lint.sh: exit 0.bin/fm-doc-audience-check.sh:ok surfaces=118 local_links=739.bin/fm-test-run.sh tests/fm-test-run.test.sh tests/fm-test-fixtures.test.sh tests/fm-test-isolation-proof.test.sh tests/fm-timeout-lib.test.sh tests/fm-ci-workflow.test.sh(ruby on PATH from nixpkgs):FM_TEST_SUMMARY total=5 failed=0 skipped_gate=0, exit 0.bin/fm-test-run.sh --changed --base origin/main(46 scripts, run through the new runner):FM_TEST_SUMMARY total=46 failed=1 skipped_gate=2, 523s. The one failure istests/fm-lint.test.sh(the fallback attempts lost per-root RSS reporting: unavailable). It fails the same way on the unchanged base because this host has no/usr/bin/time, so it is not caused by this change. The two gate skips are host capability (tsc, Pi package).tests/fm-live-gate.test.shfailsthe claude spawn must stage its launch commandthe same way on the unchanged base.tests/fm-test-run.test.shneedsruby, which this host lacks, so I supplied it from nixpkgs for these runs.Not covered
ps -Esweep path has not been run on macOS.env -i) escapes the sweep.