Repository navigation
fix(bin): bound each test script and the remote job stdin capture - #254
Merged
Merged
Conversation
…l interpreters Two open defects made the suite unreliable in ways that cost verdicts. Issue 178 (tests/fm-on.test.sh can deadlock and stall the entire test sweep): the entrypoint captured caller stdin via head -c and would block indefinitely whenever the caller's stdin was an open pipe with no data, deadlocking the test (parent do_wait over grandchild pipe_read) for the rest of the sweep. Adopt upstream's fix (PR 3210): fm-on.sh now redirects ssh's stdin from /dev/null by default and only forwards caller stdin when --stdin is passed. Update fm-on.test.sh to use --stdin for the explicit stdin test and add a default-closed assertion. Upstream left --per-script-timeout-secs off by default outside --changed, which still allows an indefinite hang in the non-changed path; apply 900s as the default for every standard-mode sweep so a hung script becomes an ordinary red instead of stalling the shard. Update tests/fm-test-run.test.sh to copy fm-timeout-lib.sh alongside the runner under test. Issue 220 (tests/fm-test-run.test.sh hard-fails when ruby is absent): bin/fm-bootstrap.sh does not install ruby, so a host without system ruby reported a hard failure on a YAML parse that nothing in the suite depends on. Replace the fail with a visible TAP skip naming the missing precondition and the reason. Audit the standard suite for the same shape (optional external interpreter treated as mandatory) and convert the matching python3 check in tests/fm-bootstrap-network-parallel.test.sh to the same skip pattern. Reproduction of the deadlock (before the fix, with stdin from an open pipe that never writes): bash tests/fm-on.test.sh in do_wait over bash bin/fm-on.sh ios fm-probe-two.sh in do_wait over bash fm-remote-entrypoint.sh in pipe_read, deadlocking past six minutes. After the fix the same scenario completes in ~5s. Stress: 5/5 runs of the test under a hanging-stdin pipe all complete and pass without a per-script timeout, and a simulated deadlock test exits 124 within the configured bound under --per-script-timeout-secs 5.
The serial shard sizing evidence quoted a 129-script lane totalling 2819209 ms and a 6.8-minute balanced shard. The lane is now 152 scripts: 124 carry a measured hint (2871221 ms) and 28 carry the default weight, so the estimated total is 3431221 ms and a balanced shard is about 7.1 minutes. Refresh the provenance sentence, the per-shard estimate table, the four-shard comparison, and the timeout margin, and correct the per-script bound rationale comment in bin/fm-test-run.sh, which quoted the same stale 363s shard wall.
added 6 commits
September 3, 2026 18:33
Resolve the merge against origin/main (a90370c) onto PR 254 head fc448ab to close both the fm-on.test.sh stdin deadlock (#178) and the fm-test-run.test.sh ruby-dependency hard-fail (#220). Conflict resolutions: * CONTRIBUTING.md: take upstream's runner overview. * bin/fm-on.sh: take upstream's usage() line range (sed '2,25p') per the handoff rule for hunks where upstream's version already carries the same change. * bin/fm-remote-entrypoint.sh: take upstream's JOB_ID pattern (JOB_ID=$(fm_remote_job_stage ...)) so the disconnect probe (FM_REMOTE_JOB_DISCONNECT_PROBE=entrypoint_caller_connected) and abandonment cancellation wire into the same upstream lane machinery that drove upstream PR 3210. * bin/fm-remote-job-lib.sh: take upstream's advance_seq_hint/next_seq/ cancelled/cancel functions and add the sourceable FM_REMOTE_JOB_ID plus the time-bounded FM_REMOTE_JOB_STDIN_TIMEOUT capture (fork's fm_remote_job_capture_stdin) on top, since the worker already calls fm_remote_job_cancelled and the bounded stdin capture is the durable half of issue #178's fix for a --stdin caller that never closes its stream. * bin/fm-test-run.sh: take upstream's --jobs admission and --max-wall-ms budget, keep the fork's 480s DEFAULT_PER_SCRIPT_TIMEOUT_SECS default for non-changed modes (the guard for issue #178) along with run_bound_outcome_note, run_forward_signal signal relay, and the run_script_bounded PGID/started marker chain that lets exit 124 and exit 125 be told apart. Skip the 480s default when MODE=changed or --max-wall-ms is set so upstream's CHANGED_DEFAULT_TIMEOUT_SECS=900 applies unchanged on --changed and --max-wall-ms does not require the timeout helper. Set PER_SCRIPT_TIMEOUT_SET on every explicit --per-script-timeout-secs so an opt-out 0 is treated as such. * tests/fm-test-run.test.sh: keep fork's skip_without helper so a host without ruby or python3 still reaches a verdict, with the affected cases skipped rather than the whole file failing (the same shape as issue #220's ruby precondition). Closes #178 Closes #220
…ck needs no code change. "Behavior portable serial 6" was failing on tests/fm-secondmate-reconcile.test.sh, which carries two wall-clock races (the same job also failed one run earlier on main, on the other of the two): 1. test_busy_lifecycle_locks_never_hold_up_the_digest ("not ok - a busy meta lock blocked the reconcile path", this PR's head). It asserted the backgrounded run_notify had already exited after a fixed `sleep 0.2`. Under CPU contention a correct non-blocking run legitimately needs longer, so the test reported "blocked" when nothing was blocked. Replaced the fixed budget with the actual property under test: wait for the child to exit while the lock holder still owns the lock, bounded at 60s so a genuinely blocking path still reports instead of hanging. 2. test_the_window_is_four_hours ("the window was shorter than four hours", main's run of the same shard). It seeded the cooldown stamp at now-14399 against the 14400s window - a one-second margin. bin/fm-secondmate-reconcile.sh:251 reads its own clock later, so >=1s of elapsed wall time pushes the age to 14400 and the ask is sent. Widened to a +/-60s bracket (14340 / 14460). Only tests/fm-secondmate-reconcile.test.sh changed (17 insertions, 5 deletions). No production code touched. Verification (24-core host, so both races only surface under contention; pinned to 2 loaded CPUs to mimic the runner): - Reproduced both CI failures verbatim on unmodified code under that load. - After the fix both cases and the full file pass under identical load; the file also passes through the real lane runner bin/fm-test-run.sh (exit 0, 39.3s). - Mutation-checked that the loosened assertions still discriminate: cooldown windows of 14300 or 14500 (only 100s off four hours) still fail the bracket, and swapping fm_lock_try_acquire for fm_lock_acquire_wait on the meta lock still fails the lock case. The temporarily mutated bin/fm-secondmate-reconcile.sh was restored (git diff clean). - bin/fm-lint.sh passes; bin/fm-test-run.sh --check-coverage passes. "PR must be raised via no-mistakes": not caused by this change. The action ran on a synchronize event with empty PR_BODY/PR_HEAD_SHA; the PR body currently does contain the required "Updates from [git push no-mistakes]" attestation, and the same check passed on the opened event for this branch. This is the attestation-check-after-a-pipeline-push case, external to the code, so no edit was made for it
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.
Intent
Reconcile the fm-test-suite-robustness branch with origin/main to deliver the
fixes for two open test-suite defects so a sweep no longer costs verdicts.
Issue 178 - tests/fm-on.test.sh can deadlock and stall the ENTIRE test sweep
with no verdict. The deadlock is a caller-open stdin crossing the SSH
transport into bin/fm-remote-entrypoint.sh, where fm_remote_job_stage captures
stdin via head -c and reads until EOF. The fix adopts upstream PR 3210 /
commit 1fd7ea2 (byte-identical shape): bin/fm-on.sh now exec ssh with stdin
from /dev/null by default and only forwards the caller's stream when --stdin
is passed. Upstream ships this through main as of a90370c
(fm/fm-upstream-sync-2026-09-02-round-2). The fork adds a defense-in-depth
bounded stdin capture (FM_REMOTE_JOB_STDIN_TIMEOUT + fm_remote_job_capture_stdin)
on top: a --stdin caller with a hung stream is refused within
FM_REMOTE_JOB_STDIN_TIMEOUT (default 360s) with FM_REMOTE_JOB_ERROR naming
the unclosed stream as the cause.
Issue 220 - tests/fm-test-run.test.sh hard-fails when ruby is absent instead
of skipping. The fix is a per-case skip_without
helper that emits a TAP # skip line naming the missing precondition instead
of failing the run, so the suite reaches a verdict with a visible skip on any
host that lacks an optional interpreter. Applied to the same shape in three
places (Herdr YAML parse, empty selection summary, timing markers) so any
absent optional interpreter reports as skipped, not failed.
This PR also adds bin/fm-test-run.sh DEFAULT_PER_SCRIPT_TIMEOUT_SECS=480
applied to every standard-mode sweep unless MODE=changed or --max-wall-ms is
set, so a hung script becomes an ordinary red (exit 124) rather than stalling
the suite. --changed uses upstream's CHANGED_DEFAULT_TIMEOUT_SECS=900
unchanged, and --max-wall-ms does not require the timeout helper. Per-script
exit 124 and exit 125 are distinguished by run_bound_outcome_note against
the started marker and elapsed time.
Standing constraints firstmate already decided: the authorship rewrite of
the 8 commits authored as Test test@example.com stays DECLINED (firstmate
composes the squash body at merge); a review finding whose remedy is a
TIMING CONSTANT is decided in favor of applying it; same reconciliation
choices are settled by taking upstream where the change arrived twice.
This is a merge commit (6f4e822) with two parents: fc448ab (PR 254 head)
and a90370c (origin/main). The merge base was the previous headless branch
where the previous worker's reconcile lived.
What Changed
bin/fm-test-run.shnow armsDEFAULT_PER_SCRIPT_TIMEOUT_SECS=480on every standard-mode sweep (skipped when--per-script-timeout-secsis given, in--changedmode, or when--max-wall-msis set), so a hung script becomes an ordinaryexit=124red instead of a sweep with no verdict;0is a real opt-out, a newrun_bound_outcome_noteseparates a bound kill from a script's ownexit 124/125using elapsed time and a started marker, andINT/TERMtraps relay the signal into each bounded script's process group (exiting 130/143) using the group idbin/fm-timeout-lib.shnow publishes throughFM_TIMEOUT_PGID_FILE.bin/fm-remote-job-lib.shaddsfm_remote_job_capture_stdin, which reads staged stdin underFM_REMOTE_JOB_STDIN_TIMEOUT(default 360s, range-checked infm_remote_job_validate_settings) and refuses a caller stream that never reaches EOF with an explanatoryFM_REMOTE_JOB_ERRORrather than blocking; the queue deadline is stamped after that capture so a slow-but-complete stream no longer spends the worker's admission budget,bin/fm-timeout-lib.shbecomes a required source rather than an optional one, andbin/fm-remote-entrypoint.shtakes the job id fromFM_REMOTE_JOB_ID.skip_without <interpreter> <title>TAP skip intests/fm-test-run.test.shand whole-script gate skips in the kimi-harness, no-mistakes-required, and bootstrap-network-parallel tests - alongside new cases covering the per-script bound, its opt-out, the 124/125 distinction, the signal relay, and every arm of the bounded stdin capture; docs and CI comments are refreshed for the current lane (154 scripts, ~7.2 min balanced shards), anddocs/fork-divergence.mdrecords both fork-only bounds.Behavior portable serial 6red that hit both this branch and main. Two wall-clock races intests/fm-secondmate-reconcile.test.shproduced two different assertions from one underlying cause under slow CI runners:test_busy_lifecycle_locks_never_hold_up_the_digestasserted the backgroundedrun_notifyhad already exited after a fixedsleep 0.2(replaced with a 60s deadline wait for the child exit while the lock holder still owns the lock - the actual property under test, not a wall-clock proxy), andtest_the_window_is_four_hoursseeded the cooldown stamp atnow-14399against the14400swindow (widened to a+/-60sbracket sincebin/fm-secondmate-reconcile.sh:251reads its own clock later and>=1sof elapsed wall time pushes the age to 14400). Mutation-checked: cooldown windows of 14300 or 14500 still fail the bracket, and swappingfm_lock_try_acquireforfm_lock_acquire_waiton the meta lock still fails the lock case. Onlytests/fm-secondmate-reconcile.test.shchanged (17 insertions, 5 deletions in commit6d2304c0); no production code touched. This change fixes the red on MAIN as well as on this branch since main's failure was the other race in the same file.PR must be raised via no-mistakes) is NOT introduced by this change. The check emits"python interpreter not found; cannot parse pipeline attestation"- the checker never evaluated anything because python is not installed on the runner. Filed separately as fork issue 258 with the failing-run evidence; no code change was made for the check itself.Risk Assessment
Testing
Ran the four directly-affected contract suites plus the fixture-copy siblings through the real runner (
tests/fm-test-run.test.sh,tests/fm-remote-job.test.sh,tests/fm-on.test.sh,tests/fm-remote-entrypoint.test.sh,tests/fm-remote-job-orphan-reap.test.sh,tests/fm-remote-job-worker-leak.test.sh,tests/fm-kimi-harness.test.sh,tests/fm-bootstrap-network-parallel.test.sh,tests/fm-remote-backlog-handoff.test.sh) - all green - and then reproduced each defect and its fix as an operator-level CLI transcript against the base commit: fm-on.sh with a never-closing stdin (blocks at base, bounded refusal naming the unclosed stream at the target), the ruby-less and python3-less skip paths (red at base, visible TAP skip with a verdict at the target), and a hung script inside a sweep (no verdict at base, exit=124 red at the target) including the 124-self-inflicted and unarmable-125 annotations. Also recomputed the refreshed portable-serial figures from the runner's own lane listing and hint table and confirmed they match the doc, the CI workflow comment and the bound rationale exactly. No screenshots: this change is entirely shell CLI and test-runner behavior with no rendered surface, so the CLI transcripts are the actual end-user surface.Evidence: Issue 178 end-to-end: caller-open stdin over the SSH transport, base vs intermediate vs target
############ BEFORE - base a90370c9 (upstream fm-on fix only, no bounded capture) $ fm-on.sh --stdin ios fm-probe-one.sh < <caller stream that never closes> [NO VERDICT: still blocked when the harness gave up after 60s] ############ INTERMEDIATE a78f2def (bound present, diagnostic still lost in a command substitution) $ fm-on.sh --stdin ios fm-probe-one.sh < <caller stream that never closes> error: cannot stage remote job [exit 70 after 5s] ############ AFTER - target e76dd59b (this change) $ fm-on.sh ios fm-probe-one.sh < <caller stream that never closes> remote command ran on the secondmate [exit 0 after 1s] $ fm-on.sh --stdin ios fm-probe-one.sh < <caller stream that never closes> error: remote job stdin never reached EOF within 5s; the caller must close the stream it hands over [exit 70 after 5s] $ printf 'payload one\npayload two\n' | fm-on.sh --stdin ios fm-probe-one.sh remote command ran on the secondmate stdin: payload one stdin: payload two [exit 0]Evidence: Issue 220 end-to-end: tests/fm-test-run.test.sh on a host that genuinely lacks ruby
host: Linux 6.14.11-4-pve; ruby: not installed; python3: /usr/bin/python3 ############ BEFORE - base a90370c9 (same host, same command) not ok - ruby is required to parse .github/workflows/ci.yml as YAML FM_TEST_END tests/fm-test-run.test.sh exit=1 duration_ms=98163 gate_skip=false FM_TEST_SUMMARY total=1 failed=1 skipped_gate=0 ############ AFTER - target e76dd59b (this change), same host, same command ok - Herdr CI family-run step times out at 20 min under a 75 min job backstop # skip ruby not found (optional interpreter, not installed by bin/fm-bootstrap.sh) FM_TEST_END tests/fm-test-run.test.sh exit=0 duration_ms=106655 gate_skip=false FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0Evidence: Per-script bound end-to-end: a hung script inside an ordinary sweep, plus the 124/125 discrimination
############ BASE a90370c9 (no default per-script bound) $ bin/fm-test-run.sh tests/fm-brief.test.sh tests/fm-doctor.test.sh tests/fm-status.test.sh FM_TEST_BEGIN tests/fm-doctor.test.sh ... ok - the hung script started [NO VERDICT: still inside tests/fm-doctor.test.sh when the operator's 45s budget ran out; no FM_TEST_END, no FM_TEST_SUMMARY] ############ TARGET e76dd59b (bound shortened to 5s for the demo) ok - the hung script started not ok - tests/fm-doctor.test.sh exceeded the per-script bound of 5s and was terminated FM_TEST_END tests/fm-doctor.test.sh exit=124 duration_ms=5020 gate_skip=false ok - the sweep still reaches the scripts after the hung one FM_TEST_SUMMARY total=3 failed=1 skipped_gate=0 duration_ms=5103 [sweep exit 1 after 5s - an ordinary red verdict, not a stalled sweep] ### self-inflicted shapes not ok - tests/fm-brief.test.sh exited 124 on its own after 0s; the 30s per-script bound did not fire not ok - tests/fm-brief.test.sh was not run: the 30s per-script bound could not be armed ### default arms with no flag $ bin/fm-test-run.sh tests/fm-brief.test.sh # bin/fm-timeout-lib.sh removed fm-test-run: per-script timeout helper not found: bin/fm-timeout-lib.shEvidence: Issue 220 whole-file gates: the same three scripts on a host without python3
BEFORE (base a90370c9): not ok - test needs python3 / not ok - python3 is required to exercise the pinned shared action / not ok - python3 is required to decode the fm-on.sh argv payload -> FM_TEST_SUMMARY total=3 failed=3 skipped_gate=0, exit 1 AFTER (target e76dd59b): skip: python3 not found (optional interpreter, not installed by bin/fm-bootstrap.sh) x2 and skip: python3 not found (optional decoder for the fm-on.sh argv payload) -> three FM_TEST_END lines with exit=0 gate_skip=true, FM_TEST_SUMMARY total=3 failed=0 skipped_gate=3, exit 0Evidence: Refreshed shard figures recomputed from the runner itself (matches docs, ci.yml and the bound rationale)
$ bin/fm-test-run.sh --list --lane portable-serial | wc -l 154 portable-serial-1of8 17 scripts 433890 ms (~433.9 s) portable-serial-2of8 19 scripts 433922 ms (~433.9 s) portable-serial-3of8 19 scripts 433897 ms (~433.9 s) portable-serial-4of8 19 scripts 433900 ms (~433.9 s) portable-serial-5of8 20 scripts 433900 ms (~433.9 s) portable-serial-6of8 20 scripts 433895 ms (~433.9 s) portable-serial-7of8 20 scripts 433908 ms (~433.9 s) portable-serial-8of8 20 scripts 433909 ms (~433.9 s) lane total 3471221 ms (~57.9 min); balanced shard ~433.9 s (~7.2 min) hints applying to the lane: 124 of 154 scripts, 2871221 ms unmeasured: 30 scripts at 20000 ms eachEvidence: TAP output: remote transport and job suites (fm-remote-job, fm-on, fm-remote-entrypoint, orphan-reap, worker-leak)
Evidence: TAP output: bin/fm-test-run.sh contract suite on the target
Evidence: TAP output: interpreter-skip sibling suites (kimi-harness, bootstrap-network-parallel, remote-backlog-handoff)
Evidence: Manual E2E harnesses used to produce the transcripts above (reproducible, kept out of the worktree)
Pipeline
Updates from git push no-mistakes
... (12 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)
Concrete path: .github/workflows/ci.yml:296 runs
bin/fm-test-run.sh --family real-herdr-gated, which is standard mode, so line 1901 now arms the 480s default (MODE != changed, no --max-wall-ms). A 341s Herdr E2E running 1.41x slower than its measured time under CI load is terminated at 480s and reportednot ok - ... exceeded the per-script bound of 480swith exit=124 on a required lane - a slow-but-healthy run turned into a red that reads as a hang. The margin there is 480/341 = 1.41x, not the impossibility the comment claims, and it is materially thinner than the 2x+ margin the same comment cites for the portable lanes.The 480s value itself is settled and I am not asking for it to change. What needs a decision is whether the honest 1.41x margin on a required lane is acceptable: if yes, the remedy is comment-only (state the measured margin the way the serial-lane margin is already stated at lines 158-171, and drop the "hard constraint" claim); if no, any wider margin or family exemption is a behavior change that needs authorization.
docs/fm-test-portable-shards.md:124- This change recomputed the portable-serial arithmetic to "about 7.2 minutes, leaving roughly 2.1x hang-tripwire margin" (and ~58 min across 154 scripts at line 77), and mirrored it into bin/fm-test-run.sh:159. I verified those numbers against the runner and they are exact. The sibling comment describing the same lane in .github/workflows/ci.yml:132-135 still reads "Measured whole remainder is ~47 min of serial work; the balanced shards are ~6.2 min each. Cap is a hang tripwire with roughly 2.4x margin" and was not refreshed.So the repo now states two different margins for the same 15-minute cap, and the stale one is the more comfortable of the two: a maintainer sizing the shard matrix from the ci.yml comment believes there is 2.4x of headroom where there is 2.1x, on the one lane the new per-script bound's own arithmetic (bin/fm-test-run.sh:161-164) already describes as "thin but still inside". The drift predates this branch, but this branch is what made the correct figures authoritative and quoted them in two other files.
Remedy is mechanical: update the three numbers in that ci.yml comment (~47 min -> ~58 min, ~6.2 min -> ~7.2 min, 2.4x -> 2.1x) so the workflow, the doc, and the runner comment quote one measurement. No workflow behavior changes.
CONTRIBUTING.md:93- The command cheat-sheet marksbin/fm-test-run.sh --changedas the invocation that comes "with automatic bounded concurrency and a per-script bound", while the four neighbouring standard-mode lines (91 one script, 92 --family, 97 --lane, 100 --all) carry no such note. That was accurate before this change; it is not now. As of bin/fm-test-run.sh:1901 every one of those standard-mode invocations arms the 480s default, and--changedis in fact the mode the default block skips.A contributor reading line 93 concludes that
bin/fm-test-run.sh --allruns unbounded, then sees a legitimately slow script reportedexit=124with no flag passed and no documented bound to look for. The same file is the one the change already edited (line 125) to document the new interpreter-skip shape, and docs/fm-test-portable-shards.md:130 already points operators at--helpfor the bound - CONTRIBUTING is the remaining surface that contradicts it.Remedy is a docs-only correction: state that a per-script bound applies to every standard-mode sweep and that
--changed's distinguishing feature in that line is the automatic bounded concurrency, pointing at--helpfor the value and the0opt-out.tests/fm-test-run.test.sh:1128-test_per_script_timeout_bounds_a_hung_script(lines 1128-1170) re-proves what the pre-existingtest_per_script_timeout_bounds_a_hang(line 839) already proves, against the same code path. Both build a fixture thatsleep 600, run the runner with a small--per-script-timeout-secs, and assert the identical three facts: a non-zero run status,FM_TEST_END ... exit=124, andFM_TEST_SUMMARY total=1 failed=1. The older test additionally proves the harder property - that the terminated script's SIGTERM-ignoring grandchild is reaped - and that a non-numeric bound is refused.The only assertion unique to the new case is that the recorded
duration_msis under 60000, i.e. that the script was terminated rather than waited out. That is worth keeping; the other ~35 lines are a second copy, including a second bounded 600-second fixture in a file that already runs ~21s in a 10-minute parallel lane.Suggested remedy: move the
duration_ms < 60000assertion intotest_per_script_timeout_bounds_a_hangand droptest_per_script_timeout_bounds_a_hung_scriptand its registration at line 1701. Flagging as ask-user rather than auto-fix because deleting a case is a coverage judgement, not a mechanical edit - the sibling cases added in the same rounds (..._under_jobs, the 124/125 discrimination cases,..._default_arms_for_standard_modes) each cover something the older test does not and should stay.🔧 Fix: refresh stale CI shard figures and CONTRIBUTING bound note
2 issues (1 warning, 1 info) still open:
bin/fm-remote-entrypoint.sh:178- The headline diagnostic this change adds is unreachable on the only production path.fm_remote_job_stagenow reports the new bounded-capture outcomes throughFM_REMOTE_JOB_ERROR(bin/fm-remote-job-lib.sh:686 "remote job stdin never reached EOF within ${FM_REMOTE_JOB_STDIN_TIMEOUT}s; the caller must close the stream it hands over", and :691 for the unarmable-bound case), but the entrypoint calls staging inside a command substitution, so the assignment happens in a subshell and is discarded beforediereads it.Concrete trace:
fm-on.sh --stdin <route> fm-foo.shfrom a producer that never closes its stream. sshd runs bin/fm-remote-entrypoint.sh, which reaches line 178if ! JOB_ID=$(fm_remote_job_stage ...). Staging blocks infm_remote_job_capture_stdinfor 360s,fm_run_timedreturns 124, the library sets the specific message and returns 1. Back in the parent,FM_REMOTE_JOB_ERRORis still the empty stringfm_remote_job_ensure_workerreset at its own entry (bin/fm-remote-job-lib.sh, first statement of that function), so line 180 expands the:-fallback and the operator seescannot stage remote jobwith exit 70 after six minutes, with nothing naming stdin. Verified the shell semantics directly against this library: the substitution shape prints the fallback, the direct shape prints the specific cause. The sibling calls at lines 176 (fm_remote_job_ensure_worker) and 184 (fm_remote_job_wait) are direct calls and do surface their messages, so line 178 is the one asymmetric site.The library already anticipates this shape: it sets
FM_REMOTE_JOB_ID=$idwith the comment "Sourceable API consumed by callers that do not use command substitution." Earliest supported boundary is that API - callfm_remote_job_stage ... >/dev/nulldirectly,dieon failure soFM_REMOTE_JOB_ERRORis still in scope, then takeJOB_ID=$FM_REMOTE_JOB_ID. Non-substitution staging is already exercised by tests/fm-remote-job.test.sh, and the new arm-coverage loop pins both shapes, so the behavior is covered.User intent states the refusal comes "with FM_REMOTE_JOB_ERROR naming the unclosed stream as the cause"; the variable is set, but no caller can read it. Flagging as a source defect rather than an intent contradiction because the remedy corrects plumbing rather than changing the promised behavior.
bin/fm-test-run.sh:167- The new bound-rationale comment states "portable-parallel is tighter still: a ~1 min measured shard wall plus 480s plus that lane's setup steps sits at or just over its 600s cap". The measurement it reasons from is owned by docs/fm-test-portable-shards.md, which recordsportable-parallel-1at 134295 ms (~134.3 s) andportable-parallel-2at 126020 ms (~126.0 s) - about 2.2 minutes, not one.The "~1 min" figure would only hold if the lane ran concurrently, and it does not:
JOBS=1is the default (bin/fm-test-run.sh:142),--lane portable-parallel-Nonly callsadd_script(bin/fm-test-run.sh:760-772) and never raises JOBS, and .github/workflows/ci.yml:76 and :113 invoke the lane with--jsononly. So the shard wall in CI is the serial sum, ~134 s.The conclusion is unaffected - redoing the comment's own replacement arithmetic with the real number gives 134 s less the ~12 s mean slot plus 480 s = ~602 s against the 600 s cap, which is still "at or just over" and if anything more certain than the comment claims. Only the premise is wrong. Remedy is the three-number correction the rest of this branch already applied to the serial lane: state ~134 s (~2.2 min) as the measured shard wall and ~602 s against the 600 s cap, so the runner comment and docs/fm-test-portable-shards.md quote one measurement. No behavior change.
🔧 Fix: surface stdin bound diagnostic; correct lane margin figures
3 infos still open:
bin/fm-test-run.sh:1900- The arming-site rationale still carries the claim the branch's later round deliberately removed, so the file now asserts both sides of the same fact. Lines 1899-1902 say "480s sits above the real-Herdr family wall that caps any one script in it at ~420s and better than 2x over the 210s portable worst case, so this only ever fires on a script that is genuinely stuck." Lines 152-160, rewritten in commit e76dd59, say the opposite: "That wall is a measurement, not a ceiling: the only bound that lane enforces is the family-run step's 1200s, and the family's slowest measured script is the 341s presentation E2E. So 480s is 1.41x over that script ... and a Herdr E2E running 1.41x slower than measured turns red as exit=124 on a required lane." Verified against the tree: .github/workflows/ci.yml enforces only timeout-minutes: 20 on the family-run step, and the ~420s figure is 7 min / 12 scripts, a mean, not a cap.The same overstatement survives in user-visible --help at bin/fm-test-run.sh:67-68 ("No real script approaches either automatic bound, so it only converts a HUNG script into a bounded failure"), where 341s against 480s is 71% of the bound. Round 4's fix instruction asked for exactly this correction ("drop the 'hard constraint rather than a statistical one' claim ... State the measured margin the way the serial-lane margin is already stated"); it landed at lines 151-171 and was not carried to the other two copies.
Remedy is the correction already approved, not a new decision: replace the duplicated arithmetic at 1899-1902 with a pointer to the DEFAULT_PER_SCRIPT_TIMEOUT_SECS rationale that owns it, and restate the --help sentence as the measured margin (1.41x on real-Herdr, 2.3x on the portable lanes) instead of "no real script approaches". No behavior change.
bin/fm-remote-entrypoint.sh:178- The direct-call staging shape is restored but nothing in the tree now protects it, and this exact reversion has already happened once on this branch.PR 254 head (fc448ab:140-146) carried the shape with a load-bearing comment: "Staged through the sourceable FM_REMOTE_JOB_ID API rather than a command substitution: a subshell would discard FM_REMOTE_JOB_ERROR and reduce every staging failure to the bare fallback below." Merge 6f4e822 reverted the code to
JOB_ID=$(fm_remote_job_stage ...), which silently re-broke the headline diagnostic; round 4 rediscovered it and round 5 (e76dd59) restored the direct call but not the comment. The current lines 178-182 are the corrected shape with no explanation of why it must not be a command substitution.No test pins it either: tests/fm-remote-entrypoint.test.sh only asserts symlink SCRIPT_DIR resolution, and tests/fm-on.test.sh drives the real entrypoint through a fake ssh but never exercises a staging failure, so no case observes the operator-visible diagnostic. The new coverage in tests/fm-remote-job.test.sh:869-887 pins both call shapes at the library level, which is precisely why the entrypoint-level regression passed CI unnoticed the first time.
Smallest honest remedy is mechanical: restore the three-line comment above line 178. Flagging the absent entrypoint-level regression case as the reason it matters rather than as the remedy, since adding one would extend this change.
bin/fm-test-run.sh:2148-run_script_boundedstamps its ownbegan(line 2148) andelapsed(line 2164) around the bounded call, butrun_one_serialalready brackets that same call withbegin_ms/end_msand computesdurationfrom them (lines 2178-2192). The two intervals differ only by theprintf FM_TEST_BEGINand theset +e, so the second measurement adds nothing the caller does not already have.now_msshells out topython3 -c 'import time; ...'(bin/fm-test-run.sh:114-120), so this is two extra interpreter spawns per script. That path is no longer rare: the new DEFAULT_PER_SCRIPT_TIMEOUT_SECS arms it for every standard-mode sweep, so a portable-serial shard now pays roughly 2 x 20 extra spawns, and--allpays 2 x 154, on a lane the same comment block describes as sitting ~891s inside a 900s cap.The parallel path already derives the note's seconds from the single measurement it keeps:
run_bound_outcome_note "$script" "$rc" "$((duration / 1000))" ...(line 2308). Doing the same inrun_one_serial- move therun_bound_outcome_note | tee -a "$out"call out ofrun_script_boundedand feed it$((duration / 1000))- removes the duplicate stamps and makes both paths quote one number. The discrimination stays correct:run_one_serial's interval strictly containsrun_script_bounded's, soelapsed >= boundcan still never under-report a real bound kill. Only ordering shifts, and it shifts toward what the parallel path already does.✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh tests/fm-test-run.test.sh- green on this ruby-less host, withok - Herdr CI family-run step... # skip ruby not foundvisible in the TAPbin/fm-test-run.sh tests/fm-remote-job.test.sh tests/fm-on.test.sh tests/fm-remote-entrypoint.test.sh tests/fm-remote-job-orphan-reap.test.sh tests/fm-remote-job-worker-leak.test.sh- 5/5 green (bounded stdin capture, transport stdin default, staging diagnostic, timeout-lib fixture copies)bin/fm-test-run.sh tests/fm-kimi-harness.test.sh tests/fm-bootstrap-network-parallel.test.sh tests/fm-remote-backlog-handoff.test.sh- 3/3 green (the whole-file skip refactor still runs normally when python3 is present)Manual E2E for issue 178: realbin/fm-on.shover the fake-ssh transport into the realbin/fm-remote-entrypoint.sh, caller stdin on a fifo held open,FM_REMOTE_JOB_STDIN_TIMEOUT=5, run against basea90370c9, intermediatea78f2defand the target - seefm178-e2e.shin the evidence dirManual E2E for issue 220 (before): reconstructed the basea90370c9tree as a git repo in temp and ranbin/fm-test-run.sh tests/fm-test-run.test.shon the same ruby-less host -not ok - ruby is required to parse .github/workflows/ci.yml as YAML, exit=1Manual E2E for issue 220 (whole-file gates):PATH=<no python3> bin/fm-test-run.sh tests/fm-kimi-harness.test.sh tests/fm-no-mistakes-required.test.sh tests/fm-bootstrap-network-parallel.test.shon both trees - failed=3 at base, skipped_gate=3 exit 0 at the targetManual E2E for the per-script bound: three-script fixture sweep with a hung middle script, no flag against base (NO VERDICTafter the operator's budget) and--per-script-timeout-secs 5against the target (exit=124,not ok - ... exceeded the per-script bound of 5s and was terminated, sweep continues) - seefm-bound-before.sh/fm-bound-demo.shManual E2E for the 124/125 discrimination: a script that exits 124 itself and a stand-infm_run_timedreturning 125 - seefm-bound-124-125.shDefault-arming and opt-out check:bin/fm-test-run.sh tests/fm-brief.test.shwithbin/fm-timeout-lib.shremoved refuses (per-script timeout helper not found), and--per-script-timeout-secs 0runs unbounded and greenDoc-figure verification:bin/fm-test-run.sh --list --lane portable-serial | wc -land each--lane portable-serial-<k>of8, plus a recomputation of shard weights fromportable_serial_weight_hints+PORTABLE_SERIAL_DEFAULT_WEIGHT_MSbin/fm-test-run.sh:552- Follow-up, not resolvable in a documentation phase: the portable-serial weight hints are drifting data rather than stale prose. 30 of the lane's 154 scripts carry no measurement and ride PORTABLE_SERIAL_DEFAULT_WEIGHT_MS (600000 ms of the 3471221 ms estimate is guessed), and one hint names tests/fm-cursor-agy-adapter.test.sh, a script the lane no longer contains. The doc now states both facts honestly, so nothing is inaccurate, and the coverage guard keeps the partition complete regardless; but the balance the 15-minute cap's 2.1x margin is computed from rests partly on guesses. Refreshing needs per-shard timing artifacts from a green CI run via the procedure docs/fm-test-portable-shards.md:94 already owns, then re-deriving the shard table and the runner's ~434s figure from the new totals.docs/fork-divergence.md:115- Scope judgment worth visibility: I added two entries to the fork divergence ledger (bounded remote job stdin capture, default per-script test bound) because both are fork-local behavior added inside upstream-owned files by this reconcile PR, and the ledger's own maintenance rule requires a sync PR that creates a divergence to update it in the same round. The alternative reading is that the ledger records only divergences with a demonstrated collision surface, in which case these would wait until an upstream round actually collides with them. I judged recording them now to be right on this page's stated contract and on its own precedent of flagging entries that went unrecorded from introduction, but the placement call is the reviewer's to confirm.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.