Skip to content

fix(bin): give slow watcher suites headroom under the changed-suite bound - #5516

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
karotkriss:fm/fm-up-3869-watch-triage-test-bound
Sep 26, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
karotkriss:fm/fm-up-3869-watch-triage-test-bound

Conversation

@karotkriss

Copy link
Copy Markdown
Contributor

Intent

Fixes #3869
Refs #3565

tests/fm-watch-triage.test.sh finishes in about 434 seconds alone and about 698 seconds under CI load, so the 900-second per-script bound the changed-suite runner applies produces a false timeout under ordinary concurrent validation, not a hang.
Raise the bound for that file, or its watcher-wake-lock family, so a slow but healthy script is not killed while a genuinely hung script still becomes a bounded failure.
This closes upstream issue #3869.

What Changed

  • Raised the automatic --changed per-script timeout in bin/fm-test-run.sh from 900s to 1500s, since tests/fm-watch-triage.test.sh runs ~434s alone and ~698s under CI load and was being falsely killed under concurrent validation; the new bound keeps every measured script under it (~2.1x headroom) while staying below the 30-minute CI tier so a genuinely hung script still fails as a bounded failure with its output.
  • Updated the comment and usage text documenting the derivation of the bound to reflect the watcher-wake-lock family as the slowest measured script.
  • Added test_changed_bound_gives_slow_watcher_suites_headroom in tests/fm-test-run.test.sh, which stubs the timeout library to capture the bound the runner hands it and asserts a healthy changed watcher script passes with a bound of at least 1500s; also bumped the existing bound-stub assertion from 900 to 1500.

Risk Assessment

✅ Low: A single well-justified timeout constant bump (900s→1500s) with a matching comment update, an updated stub assertion, and one behavioral regression test; the value is consistent with the referenced hint table and has no other copies to drift.

Testing

I exercised the raised changed-suite bound by driving the real bin/fm-test-run.sh through its own contract test end-to-end in a git fixture: the new test asserts a slow healthy changed watcher script passes and the emitted per-script bound is >= 1500s (passes on the fixed runner), and the same test fails on the base-commit runner reporting 900s, confirming the regression is real and fixed. The companion hang test confirms a genuinely stuck script is still converted to a bounded exit-124 failure. No screenshot applies; this is a shell test-runner constant with no rendered UI surface. Worktree left clean, temp artifacts removed.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A changed slow-but-healthy watcher script (fm-watch-triage) runs under the automatic --changed bound and is not killed; the bound handed to the timeout wrapper is >= 1500s ✅ pass live test_changed_bound_gives_slow_watcher_suites_headroom drives bin/fm-test-run.sh --changed --base HEAD in a real git fixture; healthy script passes and recorded bound >= 1500s (EXIT=0)
Fail-before-fix: the same scenario fails on the base runner because the bound is still 900s (regression reproduced) ✅ pass live New test run against d4f3b78 runner: 'not ok - ... must be at least 1500s, got 900s' EXIT=1
A genuinely hung script still becomes a bounded exit-124 failure under the per-script timeout (guard side of intent) ✅ pass live test_per_script_timeout_bounds_a_hang passes: '--per-script-timeout-secs turns a hung script into a bounded failure'
Evidence: Changed-bound regression transcript (before/after fix)

Source: Changed-bound regression transcript (before/after fix)

Scenario: automatic --changed bound gives the slow watcher suite headroom (#3869)
Driver: tests/fm-test-run.test.sh :: test_changed_bound_gives_slow_watcher_suites_headroom
It stands up a real git fixture repo, copies bin/fm-test-run.sh in, stubs
fm-timeout-lib to record the bound handed to fm_run_timed, changes
tests/fm-watch-triage.test.sh, then runs `bin/fm-test-run.sh --changed --base HEAD`
and asserts the healthy slow script passes AND the emitted bound is >= 1500s.

After fix (worktree runner, CHANGED_DEFAULT_TIMEOUT_SECS=1500):
  ok - --per-script-timeout-secs turns a hung script into a bounded failure
  ok - the automatic --changed bound gives the slow watcher suite at least 1500s
  EXIT=0

Before fix (base commit d4f3b78 runner, CHANGED_DEFAULT_TIMEOUT_SECS=900):
  not ok - automatic --changed bound for tests/fm-watch-triage.test.sh must be at least 1500s, got 900s
  EXIT=1

Both directions confirmed: the new test is a genuine regression that fails at 900s
and passes at 1500s, driving the real runner end-to-end. The companion hang test
(test_per_script_timeout_bounds_a_hang) still passes, so a genuinely hung script
is still converted to a bounded exit-124 failure.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A changed slow-but-healthy watcher script (fm-watch-triage) runs under the automatic --changed bound and is not killed; the bound handed to the timeout wrapper is >= 1500s ✅ pass live test_changed_bound_gives_slow_watcher_suites_headroom drives bin/fm-test-run.sh --changed --base HEAD in a real git fixture; healthy script passes and recorded bound >= 1500s (EXIT=0)
Fail-before-fix: the same scenario fails on the base runner because the bound is still 900s (regression reproduced) ✅ pass live New test run against d4f3b78 runner: 'not ok - ... must be at least 1500s, got 900s' EXIT=1
A genuinely hung script still becomes a bounded exit-124 failure under the per-script timeout (guard side of intent) ✅ pass live test_per_script_timeout_bounds_a_hang passes: '--per-script-timeout-secs turns a hung script into a bounded failure'
  • bash driver sourcing tests/fm-test-run.test.sh function defs then running test_per_script_timeout_bounds_a_hang and test_changed_bound_gives_slow_watcher_suites_headroom against the worktree runner (both ok, exit 0)
  • Same new test run against base-commit d4f3b78 runner via a temp copy at /tmp/baserun/fm-test-run.sh (fails: got 900s, exit 1) to confirm fail-before-fix
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…ound

tests/fm-watch-triage.test.sh finishes in about 434s alone and about 698s
under CI load, so the 900s bound the changed-suite runner applies produced
a false timeout under ordinary concurrent validation. Raise the automatic
bound to 1500s, which keeps every measured script under it while staying
below the 30-minute normal CI tier so a genuinely hung script still fails
here with its output before the job cap cancels the lane.

Fixes kunchenguid#3869
Refs kunchenguid#3565
@karotkriss karotkriss changed the title fix(bin): raise the changed-suite per-script bound so slow watcher tests survive fix(bin): give slow watcher suites headroom under the changed-suite bound Sep 24, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Verdict: Diff reviewed (CHANGED_DEFAULT_TIMEOUT_SECS 900→1500 + regression test). Author body Fixes #3869 verified against ready-for-pr #3869 (tests/fm-watch-triage.test.sh ~434s alone / ~698s under load falsely killed by 900s --changed bound). Tip vs main e789e52257a4: still CHANGED_DEFAULT_TIMEOUT_SECS=900 — still broken. contract-class: restore — corrective timeout headroom for a measured healthy suite; hung scripts still become exit-124; no new default-on captain surface.

VISION (per rule):

  • One captain, one interface — aligns (fewer false CI failures).
  • Authority is explicit — aligns (no new grant).
  • Scripts own the mechanics — aligns (deterministic runner bound).
  • A restart is a non-event — n/a / aligns.
  • Delegation with a spine — aligns (validation stays honest).
  • The fleet outlives any vendor — aligns.
  • Scope — aligns (test runner only; forge/merge policy untouched).

Aligns overall. Attestation MATCH. CI green / CLEAN after #5583. Auto-merging squash.

@kunchenguid
kunchenguid merged commit 9a4cfbb into kunchenguid:main Sep 26, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @karotkriss — really appreciate you taking the time on this.