Skip to content

test: fix three CI test races and aggregate the Herdr timing JSON - #7068

Open
jroethel wants to merge 2 commits into
kunchenguid:mainfrom
jroethel:fm/upstream-race-fixes
Open

jroethel wants to merge 2 commits into
kunchenguid:mainfrom
jroethel:fm/upstream-race-fixes

Conversation

@jroethel

@jroethel jroethel commented Oct 11, 2026 •

Copy link
Copy Markdown

Intent

Captain picked this to start now from the Bearings board (2026-10-10): offer the fork's CI race fixes to upstream kunchenguid/firstmate.

Recorded plan for this item: jroethel/firstmate PR 13 (Herdr recovery lock wait and focus-flash sampler race, d0ad4f8) and PR 14 (supervision-host per-case teardown, 4aea099); upstream main also flakes (2 of its last 20 runs failed); kunchenguid requires PRs raised via the no-mistakes pipeline; bundle merge-multi-waiver (aa08e3b) and ci-aggregate-herdr-glob (1dc669c) since both are done.
Known since: the fork took upstream's own resume lock-wait default (#6649) over PR 13's lock-wait change, and tests/fm-backend-herdr-focus-flash-e2e.test.sh no longer differs from upstream main.

The captain has approved offering this branch upstream (Bearings board, 2026-10-11).

What Changed

  • tests/fm-supervision-host.test.sh: each case now runs through a new run_case wrapper that calls stop_registered_homes right after the case finishes. That stops each home's parked host, watcher cycle, and fake main session, then clears the homes file. Before, they kept polling until suite exit and competed for CPU with later cases, so on two-core runners those cases woke too late for their waits.
  • Herdr e2e tests:
    • In fm-backend-herdr-focus-flash-e2e.test.sh, on a stealing release the stubbed CLI now pauses briefly after pane close (up to about 5s). It waits until the focus sampler records a non-anchor sample, so the non-vacuity check no longer depends on how the sampler and the close interleave.
    • In fm-backend-herdr-presentation-e2e.test.sh, both concurrent-recovery spawns now pass --herdr-resume-lock-wait, so the second one waits for the session lock instead of being refused after the short default wait.
    • The same file's cleanup runs chmod -R u+w before rm -rf, so the read-only git-hooks strip directories that spawn leaves behind can be deleted.
  • .github/workflows/ci.yml: the timing-aggregate step turns on globstar and matches **/fm-test-timing-*.json. The Herdr lane's timing JSON sits in a nested fm-test/ directory after the merged artifact download, and the old pattern missed it.

Risk Assessment

✅ Low: The change touches only tests and CI: all 75 supervision-host cases are wrapped in run_case with none missed, both concurrent resumes opt in to the documented --herdr-resume-lock-wait flag, the focus-flash hold is bounded and still requires a real non-anchor sample, and the globstar glob matches both the flat and nested timing JSON without duplicates.

Testing

I ran all four changed areas against the real code: focus-flash e2e on herdr 0.9.3 (3 runs) and on an isolated copy of the CI-pinned 0.7.4 (5 runs plus 40 stress runs, all passing); the full presentation e2e on 0.7.4 (25/25 ok in 555s, test temp dir removed, live default session untouched); a supervision-host comparison where leftover processes grow from 5 to 17 on base but drop back to 0-2 after each case on target; and the real CI aggregate step, which skips the nested Herdr timing JSON on base (lanes=1) and includes it on target (lanes=2). The focus-flash and lock-wait races did not reproduce on base locally, so those two are covered only by target passing. Per the earlier decision, I did not re-run the full supervision-host suite. This change has no UI, so there are no screenshots. All temp labs, servers, and drivers were torn down, and the worktree is clean.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
CI timing aggregate: the Herdr lane's timing JSON, nested under fm-test/ after the merged artifact download, is included in the aggregate summary ✅ pass live ci-timing-aggregate-step.log: the real ci.yml step run block on a fake merged-download layout gives base lanes=1 (Herdr skipped) and target lanes=2 (Herdr included)
Supervision host: each case's parked host, successor watcher and fake main session are stopped when the case ends instead of piling up until suite exit ✅ pass live supervision-host-per-case-teardown.log: leftover fixture processes after each case go 5/8/9/11/17 on base and 0/2/0/1/0 on target; all cases pass on both; 0 survivors after exit
Supervision host: stopping a case's processes and clearing its home list does not break the following cases (no reused pid signalled, later cases still pass) ✅ pass live supervision-host-per-case-teardown.log: the target driver runs 5 loop cases back to back, ending with the latch case, and exits 0
Presentation e2e: two homes recovering at the same time with --herdr-resume-lock-wait both succeed under the shared session lock with no focus drift ✅ pass live presentation-e2e-herdr074.log: 'concurrent cross-home recoveries replace exact husks under one session lock with no focus drift', 25/25 ok on isolated herdr 0.7.4
Presentation e2e cleanup: the read-only git-hooks strip folders left by spawn no longer stop TMP_ROOT from being deleted ✅ pass live After the presentation e2e run, the isolated TMPDIR held only the empty fm-herdr-lab state dir; no fm-herdr-presentation.* folder was left behind
Focus-flash Part C on a Herdr release that steals focus (CI pin 0.7.4): the test holds after the close until the sampler records the wrong-focus sample, and the non-vacuity check passes ✅ pass live focus-flash-e2e-herdr074-target.log 5/5 with steal_live=1; plus 40 more target runs under CPU load, including on 2 pinned cores, all passing
Focus-flash on a Herdr release that keeps focus (0.9.3): the hold stays off and the test is unchanged ✅ pass live focus-flash-e2e-3runs.log: 3/3 pass with steal_live=0, about 2-4 s each
Adversarial: show the focus-flash and lock-wait races fail on base locally ⏸️ untested no The prior payload did not establish a live failing result on base: base focus-flash passed 40/40 under CPU load (focus-flash-stress-base-vs-target.log, focus-flash-stress-2core.log), because the race…
Evidence: CI timing aggregate step, base vs target, on the merged-download layout

Source: CI timing aggregate step, base vs target, on the merged-download layout

base: FM_TEST_AGGREGATE lanes=1 total=1 (nested fm-test/fm-test-timing-herdr.json skipped) target: FM_TEST_AGGREGATE lanes=2 total=2 (Herdr lane included)

=== base step (merged download: flat parallel-1 + nested fm-test/fm-test-timing-herdr.json)
FM_TEST_AGGREGATE lanes=1 total=1 failed=0 skipped_gate=0 critical_path_duration_ms=12697
exit 0
aggregate inputs/scripts: ['tests/fm-timeout-lib.test.sh']
=== target step (merged download: flat parallel-1 + nested fm-test/fm-test-timing-herdr.json)
FM_TEST_AGGREGATE lanes=2 total=2 failed=0 skipped_gate=0 critical_path_duration_ms=12697
exit 0
aggregate inputs/scripts: ['tests/fm-timeout-lib.test.sh', 'tests/fm-trace-context-lib.test.sh']
Evidence: Supervision-host leftover fixture processes after each case, base vs target

Source: Supervision-host leftover fixture processes after each case, base vs target

base: 5 -> 8 -> 9 -> 11 -> 17 live fixture processes (accumulating) target: 0 -> 2 -> 0 -> 1 -> 0 live fixture processes all 5 cases pass on both; 0 survivors after suite exit

=== base 09:50:20
ok - host: an attended wake the branch may take is handled on the engine, and its routine outcome never wakes main
probe: after test_attended_routine_wake_is_handled_on_the_engine_and_stays_off_main -> 5 live fixture processes
ok - host: a main-only pass-through leaves the successor watcher running and the close undelivered for main
probe: after test_main_only_pass_through_leaves_the_successor_watcher_running -> 8 live fixture processes
ok - host: an away wake is handled on the engine through the branch contract and never reaches main
probe: after test_away_wake_is_handled_on_the_engine_and_never_reaches_main -> 9 live fixture processes
ok - host+hook: the next park takes over the cycle a main-only pass-through left, so one arm owns it
probe: after test_next_park_takes_over_the_cycle_a_pass_through_left_for_main -> 11 live fixture processes
ok - host: two engine errors latch the session, main keeps every away wake in the cooldown, a failed probe doubles it up to its cap, and a report recovers it silently
probe: after test_latch_trips_after_two_engine_errors_then_probes_and_recovers -> 17 live fixture processes
=== base exit 0 in 56s
=== target 09:51:16
ok - host: an attended wake the branch may take is handled on the engine, and its routine outcome never wakes main
probe: after test_attended_routine_wake_is_handled_on_the_engine_and_stays_off_main -> 0 live fixture processes
ok - host: a main-only pass-through leaves the successor watcher running and the close undelivered for main
probe: after test_main_only_pass_through_leaves_the_successor_watcher_running -> 2 live fixture processes
ok - host: an away wake is handled on the engine through the branch contract and never reaches main
probe: after test_away_wake_is_handled_on_the_engine_and_never_reaches_main -> 0 live fixture processes
ok - host+hook: the next park takes over the cycle a main-only pass-through left, so one arm owns it
probe: after test_next_park_takes_over_the_cycle_a_pass_through_left_for_main -> 1 live fixture processes
ok - host: two engine errors latch the session, main keeps every away wake in the cooldown, a failed probe doubles it up to its cap, and a report recovers it silently
probe: after test_latch_trips_after_two_engine_errors_then_probes_and_recovers -> 0 live fixture processes
=== target exit 0 in 56s
Evidence: Presentation e2e on isolated herdr 0.7.4

Source: Presentation e2e on isolated herdr 0.7.4

ok - real Herdr lab: concurrent cross-home recoveries replace exact husks under one session lock with no focus drift 25 ok, exit 0 in 555s; TMP_ROOT fully removed

ok - real Herdr lab: an opted-out spawn retains the Stage 1 Herdr command sequence with zero ordering calls
ok - real Herdr lab: a home that configured nothing falls back flat on below-floor herdr 0.7.4 with one naming warning
ok - real Herdr lab: every projected create, task-tab create, seeded prune, and move preserves active workspace and tab
ok - real Herdr lab: persisted-focused seeded prune proceeds when no live client is attached
ok - real Herdr lab: bounded lock contention warns and falls back flat without projection or focus drift
ok - real Herdr lab: concurrent primary workers form one stable contiguous block without active workspace/tab drift
ok - real Herdr lab: forced workspace.move failure leaves a successful worker in default order with a warning and no cleanup
ok - real Herdr lab: concurrent post-create abort cleanup stays serialized with exact focus restoration
ok - real Herdr lab: Treehouse commands and metadata shape are byte-identical except for endpoint IDs and spawn incarnation
ok - real Herdr lab: exact task-pane close removes the projected workspace with no unrestored wrong-focus interval
ok - real Herdr lab: concurrent projected cleanup is serialized and leaves active workspace/tab unchanged
ok - real Herdr lab: three repeated concurrent create/order/cleanup waves have zero active workspace or tab drift
ok - real Herdr lab: the primary presentation setting inherits into real secondmate homes
ok - real Herdr lab: primary and two secondmate homes each own a top-level contiguous child block
ok - real Herdr lab: concurrent primary/A/B spawns preserve parent order and exact focus
ok - real Herdr lab: session lock contention from a secondmate home falls back flat with no journal
ok - real Herdr lab: Hi Bit and Wheelhouse-style same-identity restarts reclaim one nested space with exact focus and idempotence
ok - real Herdr lab: secondmate restart binding and reclaim stay isolated to the exact child home and parent
ok - real Herdr lab: concurrent cross-home recoveries replace exact husks under one session lock with no focus drift
ok - real Herdr lab: default resumed identity refuses session lock contention
ok - real Herdr lab: --herdr-resume-lock-wait waits out session lock contention instead of refusing
ok - real Herdr lab: legacy projection labels and flat secondmate tabs are left unmigrated
ok - real Herdr lab: multi-home exact-pane teardowns restore captain focus without workspace close authority
warning: no exact herdr presentation token match for missing1; leaving any stale space untouched and spawning flat
warning: no exact herdr presentation token match for renamed1; leaving any stale space untouched and spawning flat
warning: 2 exact herdr presentation token matches for duplicate1 are quarantined; inspecting only for duplicate-agent risk
warning: quarantined herdr presentation for duplicate1 is dead or agent-free; exact bound reclaim may proceed, otherwise spawning flat
warning: 2 exact herdr presentation token matches for duplicate1 are quarantined; inspecting only for duplicate-agent risk
error: quarantined herdr presentation for duplicate1 has a stale-agent pane; refusing duplicate launch
ok - real Herdr lab: missing, renamed, and duplicate tokens trigger zero destructive or adoptive calls, and live duplicate risk refuses launch
ok - real Herdr lab validation completed on Herdr 0.7.4 with the default-session tripwire intact
exit 0 in 555s
Evidence: Focus-flash e2e on isolated herdr 0.7.4 (steal_live=1)

Source: Focus-flash e2e on isolated herdr 0.7.4 (steal_live=1)

=== target run 1 09:37:09
ok - old path: the explicit last-pane close of a non-focused workspace stole focus (w3	w3:t1 -> w2	w2:t1)
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - mitigation: no explicit close and no corrective focus were needed on the defective release
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a defective release: a bounded wrong-focus window of 6 samples was fully restored to the anchor
ok - version floor: herdr 0.7.4 protocol 16 remains conservatively below the floor with steal_live=1
ok - version floor: an unconfigured home falls back flat on herdr 0.7.4 and the explicit opt-in still projects
evidence: herdr=0.7.4 protocol=16 steal_live=1 floor_verdict=1 default-session-tripwire=armed
=== exit 0 in 2s
=== target run 2 09:37:11
ok - old path: the explicit last-pane close of a non-focused workspace stole focus (w3	w3:t1 -> w2	w2:t1)
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - mitigation: no explicit close and no corrective focus were needed on the defective release
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a defective release: a bounded wrong-focus window of 6 samples was fully restored to the anchor
ok - version floor: herdr 0.7.4 protocol 16 remains conservatively below the floor with steal_live=1
ok - version floor: an unconfigured home falls back flat on herdr 0.7.4 and the explicit opt-in still projects
evidence: herdr=0.7.4 protocol=16 steal_live=1 floor_verdict=1 default-session-tripwire=armed
=== exit 0 in 2s
=== target run 3 09:37:13
ok - old path: the explicit last-pane close of a non-focused workspace stole focus (w3	w3:t1 -> w2	w2:t1)
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - mitigation: no explicit close and no corrective focus were needed on the defective release
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a defective release: a bounded wrong-focus window of 6 samples was fully restored to the anchor
ok - version floor: herdr 0.7.4 protocol 16 remains conservatively below the floor with steal_live=1
ok - version floor: an unconfigured home falls back flat on herdr 0.7.4 and the explicit opt-in still projects
evidence: herdr=0.7.4 protocol=16 steal_live=1 floor_verdict=1 default-session-tripwire=armed
=== exit 0 in 3s
=== target run 4 09:37:16
ok - old path: the explicit last-pane close of a non-focused workspace stole focus (w3	w3:t1 -> w2	w2:t1)
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - mitigation: no explicit close and no corrective focus were needed on the defective release
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a defective release: a bounded wrong-focus window of 6 samples was fully restored to the anchor
ok - version floor: herdr 0.7.4 protocol 16 remains conservatively below the floor with steal_live=1
ok - version floor: an unconfigured home falls back flat on herdr 0.7.4 and the explicit opt-in still projects
evidence: herdr=0.7.4 protocol=16 steal_live=1 floor_verdict=1 default-session-tripwire=armed
=== exit 0 in 2s
=== target run 5 09:37:18
ok - old path: the explicit last-pane close of a non-focused workspace stole focus (w3	w3:t1 -> w2	w2:t1)
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - mitigation: no explicit close and no corrective focus were needed on the defective release
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a defective release: a bounded wrong-focus window of 6 samples was fully restored to the anchor
ok - version floor: herdr 0.7.4 protocol 16 remains conservatively below the floor with steal_live=1
ok - version floor: an unconfigured home falls back flat on herdr 0.7.4 and the explicit opt-in still projects
evidence: herdr=0.7.4 protocol=16 steal_live=1 floor_verdict=1 default-session-tripwire=armed
=== exit 0 in 2s
Evidence: Focus-flash stress test, base vs target, 16 cores under load

Source: Focus-flash stress test, base vs target, 16 cores under load

focus-flash-base.test.sh: 20 pass, 0 fail of 20 (load procs=24, nproc=16)
focus-flash-target.test.sh: 20 pass, 0 fail of 20 (load procs=24, nproc=16)
Evidence: Focus-flash stress test, base vs target, 2 pinned cores under load

Source: Focus-flash stress test, base vs target, 2 pinned cores under load

focus-flash-base.test.sh: 20 pass, 0 fail of 20 (load procs=4, nproc=2)
focus-flash-target.test.sh: 20 pass, 0 fail of 20 (load procs=4, nproc=2)
Evidence: Focus-flash e2e on local herdr 0.9.3

Source: Focus-flash e2e on local herdr 0.9.3

=== run 1 09:35:54
ok - old path note: this Herdr release preserves focus across the explicit close; continuing with outcome-only assertions
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a focus-preserving release: the plain explicit close preserved exact focus throughout
ok - version floor: herdr 0.9.3 protocol 22 is at or above the floor and preserves focus
ok - version floor: an unconfigured home stays projected on herdr 0.9.3 and the explicit opt-in agrees
evidence: herdr=0.9.3 protocol=22 steal_live=0 floor_verdict=0 default-session-tripwire=armed
=== exit 0 in 2s
=== run 2 09:35:56
ok - old path note: this Herdr release preserves focus across the explicit close; continuing with outcome-only assertions
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a focus-preserving release: the plain explicit close preserved exact focus throughout
ok - version floor: herdr 0.9.3 protocol 22 is at or above the floor and preserves focus
ok - version floor: an unconfigured home stays projected on herdr 0.9.3 and the explicit opt-in agrees
evidence: herdr=0.9.3 protocol=22 steal_live=0 floor_verdict=0 default-session-tripwire=armed
=== exit 0 in 4s
=== run 3 09:36:00
ok - old path note: this Herdr release preserves focus across the explicit close; continuing with outcome-only assertions
ok - mitigation: every in-operation sample preserved exact focus while the doomed workspace was removed
ok - fallback: a doomed pane holding a persistent child exhausts the proof and takes the plain explicit close
ok - fallback on a focus-preserving release: the plain explicit close preserved exact focus throughout
ok - version floor: herdr 0.9.3 protocol 22 is at or above the floor and preserves focus
ok - version floor: an unconfigured home stays projected on herdr 0.9.3 and the explicit opt-in agrees
evidence: herdr=0.9.3 protocol=22 steal_live=0 floor_verdict=0 default-session-tripwire=armed
=== exit 0 in 3s

Evidence these are real failures, and how this relates to other PRs

  • Supervision-host suite: "Behavior portable serial 2" failed in tests/fm-supervision-host.test.sh on three PR runs within one day, each at a different case: run 37896148317 (hook write failure: the Stop hook did not finish), run 37940524033 (return-fail: the host did not hand the wake to main), and run 37993944190 (return: the host did not hand the late outcome to main).
    Pinned to two cores on a loaded host, unmodified main failed around case 34 (hook quiet: the Stop hook never closed) after 8m18s; with this change all 75 cases passed (27m20s).
  • Herdr presentation e2e: upstream main run 37386510031 (2026-10-05) failed with concurrent secondmate recovery failed ... could not acquire its session lock; refusing a concurrent resume, followed by rm: cannot remove ... .git-hooks/...: Permission denied from the test cleanup.
  • Timing aggregate: the real artifact from that run (id 11379112065) unpacks to fm-test/fm-test-timing-herdr.json, which the old flat glob misses and the globstar glob matches.
  • Focus-flash Part C: no failure of this script appears in recent upstream runs, so this hold rests on the fork CI failure ("observed no wrong-focus sample at all") and on the sampler/close interleaving; it is test-only and bounded to about 5 s.

Related open PRs:

Deliberately omitted: a repeatable --allow-red in bin/fm-pr-merge.sh.
It is a feature rather than a race fix, and open PRs #5224 and #5232 already propose it.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ tests/fm-backend-herdr-presentation-e2e.test.sh:308 - The cleanup now runs chmod -R u+w "$TMP_ROOT" before rm -rf. This is a cleanup hygiene fix, not one of the three race fixes. It matches the existing pattern in tests/fm-extension-binding.test.sh:126 and tests/fm-secondmate-busy-contract-live-e2e.test.sh:39, it is harmless (chmod -R does not follow symlinks), and the commit message discloses it. It is noted only because it goes slightly beyond the intent's 'CI race fixes' scope. Under the standing en-route-defect policy no action is needed.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 8 scenarios driven live against the product
Scenario Result Live Evidence
CI timing aggregate: the Herdr lane's timing JSON, nested under fm-test/ after the merged artifact download, is included in the aggregate summary ✅ pass live ci-timing-aggregate-step.log: the real ci.yml step run block on a fake merged-download layout gives base lanes=1 (Herdr skipped) and target lanes=2 (Herdr included)
Supervision host: each case's parked host, successor watcher and fake main session are stopped when the case ends instead of piling up until suite exit ✅ pass live supervision-host-per-case-teardown.log: leftover fixture processes after each case go 5/8/9/11/17 on base and 0/2/0/1/0 on target; all cases pass on both; 0 survivors after exit
Supervision host: stopping a case's processes and clearing its home list does not break the following cases (no reused pid signalled, later cases still pass) ✅ pass live supervision-host-per-case-teardown.log: the target driver runs 5 loop cases back to back, ending with the latch case, and exits 0
Presentation e2e: two homes recovering at the same time with --herdr-resume-lock-wait both succeed under the shared session lock with no focus drift ✅ pass live presentation-e2e-herdr074.log: 'concurrent cross-home recoveries replace exact husks under one session lock with no focus drift', 25/25 ok on isolated herdr 0.7.4
Presentation e2e cleanup: the read-only git-hooks strip folders left by spawn no longer stop TMP_ROOT from being deleted ✅ pass live After the presentation e2e run, the isolated TMPDIR held only the empty fm-herdr-lab state dir; no fm-herdr-presentation.* folder was left behind
Focus-flash Part C on a Herdr release that steals focus (CI pin 0.7.4): the test holds after the close until the sampler records the wrong-focus sample, and the non-vacuity check passes ✅ pass live focus-flash-e2e-herdr074-target.log 5/5 with steal_live=1; plus 40 more target runs under CPU load, including on 2 pinned cores, all passing
Focus-flash on a Herdr release that keeps focus (0.9.3): the hold stays off and the test is unchanged ✅ pass live focus-flash-e2e-3runs.log: 3/3 pass with steal_live=0, about 2-4 s each
Adversarial: show the focus-flash and lock-wait races fail on base locally ⏸️ untested no The prior payload did not establish a live failing result on base: base focus-flash passed 40/40 under CPU load (focus-flash-stress-base-vs-target.log, focus-flash-stress-2core.log), because the race…
  • bash tests/fm-backend-herdr-focus-flash-e2e.test.sh x3 against local herdr 0.9.3 (steal_live=0)
  • Installed the pinned herdr 0.7.4 with bin/fm-install-herdr.sh into a throwaway temp HOME/XDG/TMPDIR and started a throwaway default herdr server there, so the live default session at ~/.config/herdr was never touched
  • bash tests/fm-backend-herdr-focus-flash-e2e.test.sh x5 on isolated herdr 0.7.4 (steal_live=1, so Part C runs the new hold-after-close path)
  • Stress test: base vs target focus-flash, 20 runs each with 24 busy-loop CPU hogs on 16 cores, then 20 each pinned to 2 cores (taskset -c 0,1) with 4 hogs, on isolated 0.7.4
  • bash tests/fm-backend-herdr-presentation-e2e.test.sh on isolated herdr 0.7.4, then checked that the test's TMP_ROOT was fully removed and the live default session was unchanged
  • Supervision-host driver: the base and target copies of tests/fm-supervision-host.test.sh, cut down to 5 loop cases, with a probe after each case counting live processes whose FM_HOME is under the suite TMP_ROOT; both drivers were built outside the worktree
  • Pulled the real 'Build aggregate timing summary' run block out of base and target ci.yml with PyYAML and ran it with RUNNER_TEMP pointing at a fake merged-download folder (top-level lane JSON plus nested fm-test/fm-test-timing-herdr.json), using lane JSONs produced by bin/fm-test-run.sh --json
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Behavior portable serial 2: every case in tests/fm-supervision-host.test.sh
left its parked host, successor watcher, and fake main session running until
the suite's EXIT trap, so late cases competed with dozens of earlier polling
processes. run_case now stops and forgets each case's registered homes when
the case ends.

Behavior tests (Herdr), presentation e2e: the concurrent-recovery case resumed
two homes without --herdr-resume-lock-wait, so the loser refused after the
default 5 s wait whenever the winner's hold outlasted it. Both resumes now
opt in to the wait, which is what the case claims to prove. The test cleanup
also makes the read-only git-hooks strip directories writable before rm.

Behavior tests (Herdr), focus-flash Part C: the non-vacuity check needs the
concurrent sampler to land in the short wrong-focus window after the explicit
close. The test's CLI wrapper now holds the operation after the close until the
sampler has recorded a non-anchor sample, bounded to 5 s.

Behavior timing aggregate: the Herdr artifact uploads several paths, so its
timing JSON keeps a nested fm-test/ directory after the merged download and the
flat glob skipped it. The aggregate step now uses globstar.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @jroethel, this is a welcome one. Serial 2 timing out inside tests/fm-supervision-host.test.sh has been hitting main and several PRs, so per-case teardown is exactly the kind of fix we want.

What I checked (tip 09226255 vs main b675126a): run_case wraps every supervision-host case and stop_registered_homes clears the homes file so no reused pid gets signalled. Both concurrent Herdr resumes opt in to the existing --herdr-resume-lock-wait flag. The focus-flash hold is bounded (about 5s) and only runs on a stealing release. The ci.yml change only adds globstar to the timing-aggregate glob, and nothing else in the workflow moves.

CI: first-time fork run. I reviewed the diff (tests plus that one glob line, with no secret, network, or trigger change) and approved CI 38145664592 and Require no-mistakes 38145664579 / 38145829649.

Contract-class: restore. Tests and CI plumbing only, and no product default path changes. The aggregate step was already meant to cover every lane but missed the nested Herdr JSON.

VISION: aligns on all seven rules. It's test and CI infrastructure, which supports "field incidents become regression coverage" and adds no captain-facing surface, vendor coupling, or authority change.

Next step: waiting on CI. One note: this PR edits .github/workflows/ci.yml, and the token I merge with can't land workflow edits. So once it's green and mergeable, it goes to the captain to press merge. Nothing is waiting on you.

… write failure: the Stop hook did not finish` in tests/fm-supervision-host.test.sh. The suite stopped at test_claude_stop_hook_notifies_when_at_turn_downtime_write_fails. The cause is a timing race in bin/fm-supervision-host.sh, not this PR's run_case teardown. The failing case alone, with a fresh home each run on 2 cores, failed within two iterations. Invariant: the host's output contract says the first cycle's `watcher: started|attached` line reaches the owner on every exit. Every exit that isn't a death therefore has at least one line of output. The owner reads empty output as "host died". await_close only streamed that line while it polled a live arm (once per second). If the arm closed inside one poll window, the line stayed in ARM_TEXT, and only emit() would print it. The at-turn `pass-through downtime-unrestored` path exits 1 without calling emit(), so the output was empty. The Stop hook (bin/fm-claude-stop-autoarm.sh) then retried. A second host took over the successor and stayed parked, and the hook never returned the "auto-arm FAILED" notice the case expects. When the poll won the race, the line was printed and the case passed. Fix, at the one shared boundary every exit path reads through: await_close now calls stream_ready_line once more after the arm has exited, if the line is still pending. The existing code then drops it from ARM_TEXT, so the output bytes are the same in both orderings. The other exit paths (emit, exit_to_main, boundary_exit, stand_down) are unchanged. Verification: - With the fix, the failing case passed 10/10 in a loop on 2 cores (taskset -c 0,1). Before the fix it failed by the second iteration. - `shellcheck -x bin/fm-supervision-host.sh` is clean. - Every suite that drives the host passed: fm-supervision-host 75/75, fm-claude-stop-autoarm 59/59, fm-pi-watch-extension 60/60, fm-cursor-primary 30/30, fm-omp-harness 16/16, fm-supervision-instructions 12/12, fm-watch-checkpoint 8/8. I removed the scratch test file I used to reproduce the failure, and a stray bin/bin symlink one of my scratch runs created. The only change left is bin/fm-supervision-host.sh
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @jroethel. Head 021ab4c6 adds one guard in await_close in bin/fm-supervision-host.sh. If the arm closed between polls, the pending watcher: started|attached line is now streamed before the close text is read, so that status line is no longer dropped. That is the serial 2 hook failure no-mistakes caught. I reviewed the delta (three lines, no network or secret surface) and approved this head's CI (38148942098) and Require no-mistakes (38148942239).

Contract-class: restore (unchanged). The first-cycle status line is already specified output, and the rest is test and CI race fixes. VISION: all seven rules align.

Status: waiting on CI. Once CI and no-mistakes are green, this goes to Kun to merge directly. It edits .github/workflows/ci.yml, which our triage token can't merge, so the merge itself is Kun's. Nothing else is needed from you.

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.

3 participants