You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bin): bound repeat stale alarms for live unknown-busy panes with progress - #7220
Stop the repeated false "waiting too long" alarms on a live worker whose busy state the monitor cannot read, without weakening real wedge detection.
What is happening: a Pokemodz reverse-engineering worker running long single turns raised a possible-wedge alarm roughly every 1 to 8 minutes for hours. The monitor cannot classify that worker runtime's busy state - the state reader reports unknown codex-unverified for that pane - and an unreadable-but-alive pane escalates immediately by design, so the idle-patience setting never applies to it. Each escalation closes the monitoring cycle with exit code 0 and reason actionable-stale and starts a successor, which the monitor's own lifecycle ledger shows as a long run of consecutive identical rows, so the interruptions became self-reinforcing rather than occasional noise. The worker was verifiably alive and advancing the whole time: its own status log stayed fresh and its task worktree kept receiving recovered source files.
The second, related gap is that watcher patience settings cannot be persisted in a home with no Relay pairing token. The only file the watcher arm sources them from is config/x-mode.env, and the startup routine deletes that file on every run when no Relay token is configured, so an applied patience value silently disappears at the next session start.
Both gaps are in firstmate's own monitoring and startup code, and the ask is to fix them there rather than work around them.
What Changed
bin/fm-watch.sh: new unknown_alive_stale_bound check in surface_nonterminal_stale. It applies only when there is no declared wait, the busy reader returns unknown, and the recovery-grade endpoint probe says the agent is alive. It also needs progress inside one FM_STALE_ESCALATE_SECS window: either the task's own status log or its own task worktree was written in that window. If all of that holds, repeat new-hash alarms wait for the FM_PAUSE_RESURFACE_SECS cadence. The first sighting still alarms. A pane with no progress still alarms on every new hash.
bin/fm-watch-arm.sh: now sources a new home-local config/watch.env before config/x-mode.env. Watcher tuning like FM_PAUSE_RESURFACE_SECS now survives in homes without Relay, because bootstrap never deletes this file. Relay's 30s cadence still wins when Relay is on.
Docs updated (docs/architecture.md, docs/configuration.md, operational-home-layout skill). Tests added in tests/fm-watch-triage.test.sh (the bound, plus the no-progress path) and tests/fm-x-mode.test.sh (watch.env loading and order).
✅ Low: The quiet-period rule only applies to panes whose busy state is unknown, whose agent is proven alive, and that show fresh progress, and it re-checks progress on every sighting. CONFIG is now set safely in the arm, the arm is the single place watch.env is loaded, and the round-3 test fix now matches what the code really does, with both directions covered.
Testing
The 4 targeted tests passed (2 triage, 2 x-mode). Then I drove the real watcher, the real wake drain, bootstrap, and the watcher arm in disposable marked lab homes on a private tmux socket. A live unknown-state pane with fresh worktree writes alarmed once in 150s on the new code, versus 9 alarms on the base code. A live unknown-state pane with no progress evidence kept alarming about every 10-20s on both. watch.env survived bootstrap in a home with no Relay token, and the arm-launched watcher had FM_PAUSE_RESURFACE_SECS=777 with no unbound-variable crash. Everything was torn down and the worktree is clean. The worker panes were simple stand-in processes with argv0 codex, not a real Codex session. The busy reader returns unknown codex-unverified for every Codex pane (codex harness gate), so the watcher saw the same unknown-but-alive state as in the incident. This is a terminal and watcher change, so it has no visual UI to screenshot.
Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario
Result
Live
Evidence
A live, unreadable-state worker that keeps writing recovered files to its worktree raises one stale alarm, then no repeats for the pause window
✅ pass
live
live-new-watcher.txt: lab:fm-prog shows stale once (03:36:37), then none through 03:38:33 even though its screen changed every 12s
Before/after: on the base code, the same worker repeats the false alarm every cycle
✅ pass
live
live-base-watcher.txt: lab:fm-prog gave 9 stale alarms in 150s with the base fm-watch.sh, matching the reported issue
Adversarial: a live, unreadable-state pane with no progress evidence (old status log, old worktree) keeps alarming on every new screen instead of going quiet
✅ pass
live
live-new-watcher.txt: lab:fm-noprog alarms in 11 of 13 cycles over 150s; both targeted triage tests pass
In a home with no Relay token, config/watch.env survives fm-bootstrap.sh
✅ pass
live
live-watch-env-arm.txt: watch.env is still present with FM_PAUSE_RESURFACE_SECS=777 after a real bootstrap
fm-watch-arm.sh with CONFIG unset loads watch.env without crashing, and the launched watcher gets the setting
✅ pass
live
live-watch-env-arm.txt: watcher: started pid=11708, and ps eww shows FM_PAUSE_RESURFACE_SECS=777 in that watcher; no unbound-variable error; --stop exits 0
Evidence: Live watcher run on the new code (progress pane alarms once, no-progress pane keeps alarming)
ok - an unknown-but-alive pane with progress evidence alarms once per bounded pause-resurface window
ok - an unknown-but-alive pane without progress evidence keeps surfacing every new hash
rc=0
ok - bootstrap preserves home-local watcher tuning and the arm hands it to the watcher
ok - bootstrap is inert without a non-empty .env token (non-X users unaffected)
rc=0
CI baseline evidence
The pipeline rebased this change from 6407052.
On pristine default-branch main at 1f3e7696 with a clean tree, PATH="/Users/Ian/.bun/install/global/node_modules/typescript/bin:$PATH" bash tests/fm-pi-primary-types.test.sh fails identically against Pi 1.2.0: TS2339 reports that BeforeAgentStartEvent has no prompt property in fm-primary-pi-watch.ts and fm-branch-supervision.ts.
The same two tracked extension lines fail locally on this task branch, and neither line is changed by this pull request.
The red Behavior check is therefore pre-existing Pi type drift on pristine main, not a watcher-alarm or persisted-state regression; all other reported checks are green.
🚨 bin/fm-watch-arm.sh:129 - fm-watch-arm.sh runs under set -u but never defines CONFIG (only STATE is set via fm-wake-lib.sh; fm-path-lib/fm-gate-refuse-lib do not set CONFIG, and no caller exports it — fm-claude-stop-autoarm.sh:140, fm-turnend-guard-cursor.sh, the Pi/OMP extensions and agent-run arms all invoke it without CONFIG in env). The new [ -f "$CONFIG/watch.env" ] therefore aborts with CONFIG: unbound variable (reproduced with set -u; . bin/fm-wake-lib.sh; [ -f "$CONFIG/watch.env" ]), so every watcher arm/--restart/--stop/--take-over exits before doing anything: supervision breaks entirely. Same unbound use at bin/fm-watch-arm.sh:131. Fix: define CONFIG="${FM_CONFIG_OVERRIDE:-$FM_HOME/config}" (matching the other bin scripts) before sourcing.
⚠️bin/fm-watch.sh:1978 - unknown_alive_stale_bound absorbs every new-hash stale sighting for PAUSE_RESURFACE_SECS (default 4h) on any pane whose busy verdict is unknown and whose endpoint is alive, without checking any progress evidence (fresh status log, task-worktree writes). A genuinely wedged Codex pane that still animates (spinner/timer churns hash) and has a live process now alarms once and then is silent for 4h, and the comment confirms such unknown panes never reach wedge_timer_check. Intent requires 'without weakening real wedge detection' and cites status-log freshness and worktree writes as the proof of liveness; consider gating the bound on that progress evidence instead of process liveness alone. Remedy changes detection policy, so needs author decision.
ℹ️ tests/fm-x-mode.test.sh:980 - test_bootstrap_preserves_nonrelay_watcher_tuning would pass before this change (bootstrap never touched config/watch.env) and its 'inherited' check only sources the file it just wrote, so it does not prove a watcher loader picks the value up. No test exercises fm-watch-arm.sh with a config/watch.env present, which is why the unbound-CONFIG crash is unguarded; a behavioral test arming with watch.env and asserting the watcher sees FM_PAUSE_RESURFACE_SECS would cover the intent's second gap.
🚨 bin/fm-watch-arm.sh:129 - fm-watch-arm.sh runs under set -u but never defines CONFIG (only STATE is set via fm-wake-lib.sh; fm-path-lib/fm-gate-refuse-lib do not set CONFIG, and no caller exports it — fm-claude-stop-autoarm.sh:140, fm-turnend-guard-cursor.sh, the Pi/OMP extensions and agent-run arms all invoke it without CONFIG in env). The new [ -f "$CONFIG/watch.env" ] therefore aborts with CONFIG: unbound variable (reproduced with set -u; . bin/fm-wake-lib.sh; [ -f "$CONFIG/watch.env" ]), so every watcher arm/--restart/--stop/--take-over exits before doing anything: supervision breaks entirely. Same unbound use at bin/fm-watch-arm.sh:131. Fix: define CONFIG="${FM_CONFIG_OVERRIDE:-$FM_HOME/config}" (matching the other bin scripts) before sourcing.
⚠️bin/fm-watch-arm.sh:128 - Fix round 1 made bin/fm-watch-arm.sh source config/watch.env and then config/x-mode.env itself. Every arm path goes through this script, so the caller-side copies added in the original commit no longer do anything: bin/fm-claude-stop-autoarm.sh:326-328, bin/fm-turnend-guard-cursor.sh:298-300, and the watch.env clause in .pi/extensions/fm-primary-pi-watch.ts:1075. They are parallel copies of one loading rule, and the intent only needs one loader. They also make docs/configuration.md:1593 ('every current watcher loader sources it') misleading: the OMP (.omp/extensions/fm-primary-omp-watch.ts:972) and OpenCode (.opencode/plugins/fm-primary-watch-arm.js:428) loaders were not changed and only get watch.env through the arm. Recommended fix: remove the three caller-side watch.env additions, keep the single load inside fm-watch-arm.sh, and reword the doc to say the watcher arm loads it.
🔧 Fix applied.
1 warning still open:
⚠️tests/fm-watch-triage.test.sh:1183 - Fix round 1 added the worktree case of unknown_alive_stale_case, and it seems to expect behavior the code does not have. Trace: at the first sight, the status log is aged 1000s and the worktree holds only src/old.c, also aged 1000s. So unknown_alive_progressing (bin/fm-watch.sh:2004) returns 1. unknown_alive_stale_bound then returns before it sets STALE_WAIT_DECLARATION (bin/fm-watch.sh:1998). The first wake fires, but stale_wait_record writes no .paused-resurfaced-<key> marker (bin/fm-watch.sh:1868). Before the second sight, the test writes wt/src/recovered.c. Progress now passes and the declaration gets set, but stale_wait_throttled finds no marker. It returns 1, the elif [ -n "$STALE_WAIT_DECLARATION" ] branch runs, throttled stays 1, and the successor alarms and exits. The test asserts the opposite ('a bounded unknown-but-alive successor exited' / 'printed a stale wake'), so it should fail. The status case passes only because its status log is fresh at the first sight. The code's behavior is defensible: the bound only starts at an alarm that already had progress evidence, so it costs at most one extra alarm when evidence first shows up. Smallest fix: in the worktree case, create the fresh worktree write before the first sight (so first sight → alarm + marker, second sight → absorbed), and assert that the evidence was present at the first alarm.
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario
Result
Live
Evidence
A live, unreadable-state worker that keeps writing recovered files to its worktree raises one stale alarm, then no repeats for the pause window
✅ pass
live
live-new-watcher.txt: lab:fm-prog shows stale once (03:36:37), then none through 03:38:33 even though its screen changed every 12s
Before/after: on the base code, the same worker repeats the false alarm every cycle
✅ pass
live
live-base-watcher.txt: lab:fm-prog gave 9 stale alarms in 150s with the base fm-watch.sh, matching the reported issue
Adversarial: a live, unreadable-state pane with no progress evidence (old status log, old worktree) keeps alarming on every new screen instead of going quiet
✅ pass
live
live-new-watcher.txt: lab:fm-noprog alarms in 11 of 13 cycles over 150s; both targeted triage tests pass
In a home with no Relay token, config/watch.env survives fm-bootstrap.sh
✅ pass
live
live-watch-env-arm.txt: watch.env is still present with FM_PAUSE_RESURFACE_SECS=777 after a real bootstrap
fm-watch-arm.sh with CONFIG unset loads watch.env without crashing, and the launched watcher gets the setting
✅ pass
live
live-watch-env-arm.txt: watcher: started pid=11708, and ps eww shows FM_PAUSE_RESURFACE_SECS=777 in that watcher; no unbound-variable error; --stop exits 0
bash tests/fm-watch-triage.test.sh limited to test_unknown_alive_stale_is_bounded_after_its_first_alarm and test_unknown_alive_stale_without_progress_keeps_surfacing (temp filtered copy, removed after)
bash tests/fm-x-mode.test.sh limited to test_bootstrap_preserves_nonrelay_watcher_tuning and test_bootstrap_inert_without_token (temp filtered copy, removed after)
live-drive.sh $PWD/bin NEW 150: marked lab home from bin/fm-lab-home.sh create, private tmux -L fm-lab socket, two windows running a process with argv0 codex (alive, busy=unknown codex-unverified). fm-prog's worktree gets a new source file every 10s; fm-noprog only has 1000s-old files. Real bin/fm-watch.sh was re-armed for 150s, and each wake was acked with the real bin/fm-wake-drain.sh
live-drive.sh <base-bin> BASE 150: the same lab, using fm-watch.sh and fm-watch-arm.sh from base commit 6407052
live-watch-env-arm.sh <lab>: wrote config/watch.env (FM_PAUSE_RESURFACE_SECS=777) in a marked lab home with no Relay token, ran the real bin/fm-bootstrap.sh, then ran the real bin/fm-watch-arm.sh with CONFIG and FM_PAUSE_RESURFACE_SECS unset, read the launched watcher's environment with ps eww, then ran fm-watch-arm.sh --stop
Teardown: tmux kill-server, background writer killed, rm -rf of lab homes and the temp base bin; worktree git status is clean
Speaking as Kun's firstmate: thank you @zestysoft — bounding the unknown-but-alive false alarms (while keeping the first sight and the no-progress path loud) is exactly the kind of watcher calm the fleet needs.
VISION (each rule):
One captain, one interface: aligns (cuts spam without hiding a real wedge).
Authority is explicit: aligns (no new autonomy; first alarm still surfaces).
Scripts own the mechanics: aligns (bash bound on progress evidence).
A restart is a non-event: aligns (config/watch.env is durable, LOCAL, opt-in).
Delegation with a spine: neutral.
The fleet outlives any vendor: aligns (recovery-grade alive + progress, not harness-specific busy class).
Scope: aligns. Token: none on the hot path.
Contract-class: restore. The unconfigured watcher already promised progress-based deferral (declared waits, worktree-write probes, FM_PAUSE_RESURFACE_SECS). Unknown-alive panes with status/worktree progress inside FM_STALE_ESCALATE_SECS were incorrectly re-alarming on every new hash; this restores the existing bound after the first sight. Absent progress, every new hash still surfaces. config/watch.env is opt-in (absent = no change).
Where it stands: attestation MATCH eb4c2f3d, live go 5/5. CI on this tip: Behavior portable parallel 1 failed only on main's known Pi 1.2 type drift (BeforeAgentStartEvent.prompt / fm-pi-primary-types) — not your change. Serial 2 hit the known 30-min cancel. Everything else green. Main itself is red on those same shards, so nothing merges this wake. No action needed from you; once main is green this is in the auto-merge lane (corrective restore).
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
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
Stop the repeated false "waiting too long" alarms on a live worker whose busy state the monitor cannot read, without weakening real wedge detection.
What is happening: a Pokemodz reverse-engineering worker running long single turns raised a possible-wedge alarm roughly every 1 to 8 minutes for hours. The monitor cannot classify that worker runtime's busy state - the state reader reports
unknown codex-unverifiedfor that pane - and an unreadable-but-alive pane escalates immediately by design, so the idle-patience setting never applies to it. Each escalation closes the monitoring cycle with exit code 0 and reasonactionable-staleand starts a successor, which the monitor's own lifecycle ledger shows as a long run of consecutive identical rows, so the interruptions became self-reinforcing rather than occasional noise. The worker was verifiably alive and advancing the whole time: its own status log stayed fresh and its task worktree kept receiving recovered source files.The second, related gap is that watcher patience settings cannot be persisted in a home with no Relay pairing token. The only file the watcher arm sources them from is
config/x-mode.env, and the startup routine deletes that file on every run when no Relay token is configured, so an applied patience value silently disappears at the next session start.Both gaps are in firstmate's own monitoring and startup code, and the ask is to fix them there rather than work around them.
What Changed
bin/fm-watch.sh: newunknown_alive_stale_boundcheck insurface_nonterminal_stale. It applies only when there is no declared wait, the busy reader returnsunknown, and the recovery-grade endpoint probe says the agent isalive. It also needs progress inside oneFM_STALE_ESCALATE_SECSwindow: either the task's own status log or its own task worktree was written in that window. If all of that holds, repeat new-hash alarms wait for theFM_PAUSE_RESURFACE_SECScadence. The first sighting still alarms. A pane with no progress still alarms on every new hash.bin/fm-watch-arm.sh: now sources a new home-localconfig/watch.envbeforeconfig/x-mode.env. Watcher tuning likeFM_PAUSE_RESURFACE_SECSnow survives in homes without Relay, because bootstrap never deletes this file. Relay's 30s cadence still wins when Relay is on.docs/architecture.md,docs/configuration.md, operational-home-layout skill). Tests added intests/fm-watch-triage.test.sh(the bound, plus the no-progress path) andtests/fm-x-mode.test.sh(watch.envloading and order).🤖 Generated with Claude Code
Risk Assessment
✅ Low: The quiet-period rule only applies to panes whose busy state is unknown, whose agent is proven alive, and that show fresh progress, and it re-checks progress on every sighting. CONFIG is now set safely in the arm, the arm is the single place watch.env is loaded, and the round-3 test fix now matches what the code really does, with both directions covered.
Testing
The 4 targeted tests passed (2 triage, 2 x-mode). Then I drove the real watcher, the real wake drain, bootstrap, and the watcher arm in disposable marked lab homes on a private tmux socket. A live unknown-state pane with fresh worktree writes alarmed once in 150s on the new code, versus 9 alarms on the base code. A live unknown-state pane with no progress evidence kept alarming about every 10-20s on both. watch.env survived bootstrap in a home with no Relay token, and the arm-launched watcher had FM_PAUSE_RESURFACE_SECS=777 with no unbound-variable crash. Everything was torn down and the worktree is clean. The worker panes were simple stand-in processes with argv0
codex, not a real Codex session. The busy reader returnsunknown codex-unverifiedfor every Codex pane (codex harness gate), so the watcher saw the same unknown-but-alive state as in the incident. This is a terminal and watcher change, so it has no visual UI to screenshot.staleonce (03:36:37), then none through 03:38:33 even though its screen changed every 12sstalealarms in 150s with the base fm-watch.sh, matching the reported issuewatcher: started pid=11708, andps ewwshows FM_PAUSE_RESURFACE_SECS=777 in that watcher; no unbound-variable error;--stopexits 0Evidence: Live watcher run on the new code (progress pane alarms once, no-progress pane keeps alarming)
Source: Live watcher run on the new code (progress pane alarms once, no-progress pane keeps alarming)
Evidence: Live watcher run on the base code (progress pane alarms ~every 13s)
Source: Live watcher run on the base code (progress pane alarms ~every 13s)
Evidence: Bootstrap keeps watch.env; arm hands FM_PAUSE_RESURFACE_SECS=777 to the real watcher
Source: Bootstrap keeps watch.env; arm hands FM_PAUSE_RESURFACE_SECS=777 to the real watcher
Evidence: Lab driver script for the watcher scenarios
Source: Lab driver script for the watcher scenarios
Evidence: Lab driver script for the watch.env scenario
Source: Lab driver script for the watch.env scenario
Evidence: Targeted triage tests
Source: Targeted triage tests
Evidence: Targeted x-mode tests
Source: Targeted x-mode tests
CI baseline evidence
The pipeline rebased this change from
6407052.On pristine default-branch
mainat1f3e7696with a clean tree,PATH="/Users/Ian/.bun/install/global/node_modules/typescript/bin:$PATH" bash tests/fm-pi-primary-types.test.shfails identically against Pi1.2.0: TS2339 reports thatBeforeAgentStartEventhas nopromptproperty infm-primary-pi-watch.tsandfm-branch-supervision.ts.The same two tracked extension lines fail locally on this task branch, and neither line is changed by this pull request.
The red Behavior check is therefore pre-existing Pi type drift on pristine main, not a watcher-alarm or persisted-state regression; all other reported checks are green.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (3) ✅
bin/fm-watch-arm.sh:129- fm-watch-arm.sh runs underset -ubut never defines CONFIG (only STATE is set via fm-wake-lib.sh; fm-path-lib/fm-gate-refuse-lib do not set CONFIG, and no caller exports it — fm-claude-stop-autoarm.sh:140, fm-turnend-guard-cursor.sh, the Pi/OMP extensions and agent-run arms all invoke it without CONFIG in env). The new[ -f "$CONFIG/watch.env" ]therefore aborts withCONFIG: unbound variable(reproduced withset -u; . bin/fm-wake-lib.sh; [ -f "$CONFIG/watch.env" ]), so every watcher arm/--restart/--stop/--take-over exits before doing anything: supervision breaks entirely. Same unbound use at bin/fm-watch-arm.sh:131. Fix: defineCONFIG="${FM_CONFIG_OVERRIDE:-$FM_HOME/config}"(matching the other bin scripts) before sourcing.bin/fm-watch.sh:1978- unknown_alive_stale_bound absorbs every new-hash stale sighting for PAUSE_RESURFACE_SECS (default 4h) on any pane whose busy verdict isunknownand whose endpoint is alive, without checking any progress evidence (fresh status log, task-worktree writes). A genuinely wedged Codex pane that still animates (spinner/timer churns hash) and has a live process now alarms once and then is silent for 4h, and the comment confirms such unknown panes never reach wedge_timer_check. Intent requires 'without weakening real wedge detection' and cites status-log freshness and worktree writes as the proof of liveness; consider gating the bound on that progress evidence instead of process liveness alone. Remedy changes detection policy, so needs author decision.tests/fm-x-mode.test.sh:980- test_bootstrap_preserves_nonrelay_watcher_tuning would pass before this change (bootstrap never touched config/watch.env) and its 'inherited' check only sources the file it just wrote, so it does not prove a watcher loader picks the value up. No test exercises fm-watch-arm.sh with a config/watch.env present, which is why the unbound-CONFIG crash is unguarded; a behavioral test arming with watch.env and asserting the watcher sees FM_PAUSE_RESURFACE_SECS would cover the intent's second gap.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
bin/fm-watch-arm.sh:129- fm-watch-arm.sh runs underset -ubut never defines CONFIG (only STATE is set via fm-wake-lib.sh; fm-path-lib/fm-gate-refuse-lib do not set CONFIG, and no caller exports it — fm-claude-stop-autoarm.sh:140, fm-turnend-guard-cursor.sh, the Pi/OMP extensions and agent-run arms all invoke it without CONFIG in env). The new[ -f "$CONFIG/watch.env" ]therefore aborts withCONFIG: unbound variable(reproduced withset -u; . bin/fm-wake-lib.sh; [ -f "$CONFIG/watch.env" ]), so every watcher arm/--restart/--stop/--take-over exits before doing anything: supervision breaks entirely. Same unbound use at bin/fm-watch-arm.sh:131. Fix: defineCONFIG="${FM_CONFIG_OVERRIDE:-$FM_HOME/config}"(matching the other bin scripts) before sourcing.bin/fm-watch-arm.sh:128- Fix round 1 made bin/fm-watch-arm.sh source config/watch.env and then config/x-mode.env itself. Every arm path goes through this script, so the caller-side copies added in the original commit no longer do anything: bin/fm-claude-stop-autoarm.sh:326-328, bin/fm-turnend-guard-cursor.sh:298-300, and the watch.env clause in .pi/extensions/fm-primary-pi-watch.ts:1075. They are parallel copies of one loading rule, and the intent only needs one loader. They also make docs/configuration.md:1593 ('every current watcher loader sources it') misleading: the OMP (.omp/extensions/fm-primary-omp-watch.ts:972) and OpenCode (.opencode/plugins/fm-primary-watch-arm.js:428) loaders were not changed and only get watch.env through the arm. Recommended fix: remove the three caller-side watch.env additions, keep the single load inside fm-watch-arm.sh, and reword the doc to say the watcher arm loads it.🔧 Fix applied.
1 warning still open:
tests/fm-watch-triage.test.sh:1183- Fix round 1 added theworktreecase of unknown_alive_stale_case, and it seems to expect behavior the code does not have. Trace: at the first sight, the status log is aged 1000s and the worktree holds onlysrc/old.c, also aged 1000s. So unknown_alive_progressing (bin/fm-watch.sh:2004) returns 1. unknown_alive_stale_bound then returns before it sets STALE_WAIT_DECLARATION (bin/fm-watch.sh:1998). The first wake fires, but stale_wait_record writes no.paused-resurfaced-<key>marker (bin/fm-watch.sh:1868). Before the second sight, the test writeswt/src/recovered.c. Progress now passes and the declaration gets set, but stale_wait_throttled finds no marker. It returns 1, theelif [ -n "$STALE_WAIT_DECLARATION" ]branch runs, throttled stays 1, and the successor alarms and exits. The test asserts the opposite ('a bounded unknown-but-alive successor exited' / 'printed a stale wake'), so it should fail. Thestatuscase passes only because its status log is fresh at the first sight. The code's behavior is defensible: the bound only starts at an alarm that already had progress evidence, so it costs at most one extra alarm when evidence first shows up. Smallest fix: in the worktree case, create the fresh worktree write before the first sight (so first sight → alarm + marker, second sight → absorbed), and assert that the evidence was present at the first alarm.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
staleonce (03:36:37), then none through 03:38:33 even though its screen changed every 12sstalealarms in 150s with the base fm-watch.sh, matching the reported issuewatcher: started pid=11708, andps ewwshows FM_PAUSE_RESURFACE_SECS=777 in that watcher; no unbound-variable error;--stopexits 0bash tests/fm-watch-triage.test.shlimited to test_unknown_alive_stale_is_bounded_after_its_first_alarm and test_unknown_alive_stale_without_progress_keeps_surfacing (temp filtered copy, removed after)bash tests/fm-x-mode.test.shlimited to test_bootstrap_preserves_nonrelay_watcher_tuning and test_bootstrap_inert_without_token (temp filtered copy, removed after)live-drive.sh $PWD/bin NEW 150: marked lab home frombin/fm-lab-home.sh create, privatetmux -L fm-labsocket, two windows running a process with argv0codex(alive, busy=unknown codex-unverified). fm-prog's worktree gets a new source file every 10s; fm-noprog only has 1000s-old files. Realbin/fm-watch.shwas re-armed for 150s, and each wake was acked with the realbin/fm-wake-drain.shlive-drive.sh <base-bin> BASE 150: the same lab, using fm-watch.sh and fm-watch-arm.sh from base commit 6407052live-watch-env-arm.sh <lab>: wrote config/watch.env (FM_PAUSE_RESURFACE_SECS=777) in a marked lab home with no Relay token, ran the realbin/fm-bootstrap.sh, then ran the realbin/fm-watch-arm.shwith CONFIG and FM_PAUSE_RESURFACE_SECS unset, read the launched watcher's environment withps eww, then ranfm-watch-arm.sh --stopTeardown: tmux kill-server, background writer killed,rm -rfof lab homes and the temp base bin; worktree git status is clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.