Skip to content

fix(watch): require two quiet signals before a wedge escalation - #107

Merged
EvanAgee merged 8 commits into
mainfrom
fm/fm-wedge-false-alarms
Sep 9, 2026
Merged

EvanAgee merged 8 commits into
mainfrom
fm/fm-wedge-false-alarms

Conversation

@EvanAgee

@EvanAgee EvanAgee commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

Intent

Fix the watcher's false wedge alarms in bin/fm-watch.sh, which flags a worker as 'possible wedge' and escalates (1, 2, 3, then demand-deep-inspection) whenever its terminal pane is idle for the stale window. Workers doing real work inside a no-mistakes pipeline run are idle in the pane by design, and workers firstmate deliberately stopped on a green PR are idle by design too. Each false alarm costs firstmate a full handling turn. On 2026-09-09 three deliberately stopped workers (fm-control exit, PR green, awaiting the serial merge queue) escalated to level 3 even though their status log ended in a 'paused: [key=await-merge] ...' line; on 2026-09-01 five mid-run workers were flagged the same way while their pipelines were active.

REQUIRED BEHAVIOR - escalation must require BOTH signals quiet, never the pane alone:

  1. A declared 'paused:' or captain-held last status line wins over a done/failed/unknown classification from the run-step or pane source whenever the agent is dead or the pane is idle; that case classifies as paused and follows the existing long-cadence re-surface, not the wedge ladder.
  2. Before any wedge escalation of a pane-idle worker, read the task's pipeline activity ('no-mistakes axi status' in the recorded worktree, bounded by the existing FM_CHECK_TIMEOUT style timeout, and cheap: skip when the task has no mode= in its meta) and treat a run whose last activity is inside the stale window as working. Only a worker whose pane AND pipeline are both quiet past the window escalates.
  3. A worker whose agent is dead AND whose last status line is 'done: PR ...' with an armed PR watch (state/.check.sh present) is a finished worker awaiting merge, not a wedge: classify it paused with a reason that says so.
  4. Keep the genuinely dead case working: agent dead, no declared pause, no armed PR watch, no pipeline activity still escalates exactly as today.

DELIBERATE DECISIONS MADE WHILE IMPLEMENTING, all verified against the live fleet and the installed binary on 2026-09-09 - a reviewer reading only the diff would not know these:

(a) The report's stated cause was wrong and the code reflects the measured one. The report said fm-crew-state returned 'done' for those three tasks. Reading the live fleet, all three actually reported 'state: working / source: run-step / validating (running)', because a no-mistakes run keeps its ci step running for as long as the PR stays open. pause_state_class honored that 'working' verdict ahead of the declared pause and absorbed the pane as provably-working, which STARTS THE WEDGE TIMER - that timer is what escalated them. So the fix also had to stop a stale 'working' verdict from beating a declared pause. crew_absorb_class only ever prints working/paused/none, so a 'done' run-step already flattens to 'none'; handling literal done/failed/unknown there would have been dead code.

(b) Pipeline activity is read from the active_steps table's last_activity column, NOT the run's top-level status and not an updated_at field (there is no updated_at in real axi status output). Verified on the installed binary: a worker stopped on a green PR reports 'status: running' after 15h29m with last activity 'quiet 51m55s ago'. Reading top-level status would mark every stopped green-PR worker permanently active and suppress its escalation forever, the opposite of the intended rule.

(c) A 'working' verdict proves a run EXISTS, not that it is MOVING, so it now outranks a declared pause only while that run's own last activity is fresh. This preserves the pre-existing contract that an actively-running pipeline behind a declared pause resumes wedge tracking so a genuinely FROZEN run still escalates (tests/fm-watch-triage.test.sh's test_nonterminal_paused_rechecks_authoritative_state).

(d) The activity probe is three-state on purpose. Exit 2 means 'no answer available' (no worktree, no no-mistakes installed, no active_steps table at all) and a caller holding positive run evidence keeps trusting it, rather than reading an unanswerable probe as proof the run stopped. Only a real negative (an answer with no running/fixing step, or a stale last_activity) overrides. pipeline_recently_active keeps the cheap mode= skip for the escalation gate; pipeline_activity_fresh omits it for callers that already know a run exists, because skipping on a thin meta record would answer 'not moving' for a pipeline that is in fact moving.

(e) The declared-pause gate previously required a confidently 'dead' agent, which no unverified backend (zellij, orca, cmux) and no unreadable meta can ever report - both map to 'unknown' via fm_backend_agent_state. Those workers could never reach paused. The gate now overrides a declared pause only on a confidently 'alive' agent, since only a live agent could still be silencing a decision gate. The secondmate branch keeps its previous behavior via an 'alive' default, because secondmates get no agent read there.

CONSTRAINTS HONORED: never started, stopped, or signaled the live home's watcher, and never ran bin/fm-watch-arm.sh or killed any fm-watch process; all live testing went through a throwaway FM_HOME pointed at a scratch copy of state/, plus the sanctioned bin/fm-watch-checkpoint.sh. Wake queue formats and the ack protocol are unchanged.

TESTS: tests/fm-watch-wedge-two-signal.test.sh is a new colocated table test with 10 cases driving the real sourced watcher through pause_state_class, pipeline_recently_active, and wedge_timer_check (fm-watch.sh's BASH_SOURCE guard returns before the lock and loop). Fixtures use real captured axi status output. Each case was verified NON-VACUOUS by running the suite against the unmodified HEAD watcher: 5 cases fail there and pass after. Two weak cases were deliberately hardened after that check - the declared-pause case now uses backend=zellij so the agent reads 'unknown' (a 'dead' fixture passed before the fix and proved nothing), and the no-mode case asserts a positive control with mode= present so a 'quiet' verdict cannot come from a missing function. Existing tests/fm-watch-triage.test.sh stays green (verified repeatedly, including 3 consecutive clean runs).

DOCS: docs/architecture.md gains the two-signal rule and its corrected liveness and activity wording.

LIVE PROOF (for the PR's 'What I walked' section): running the same live fleet records through the old and new classifier side by side, aos-3475-foreign-chat-toast went from 'working' (which starts the wedge timer) to 'paused', aos-3592-model-pick-race went from 'none' (wedge ladder) to 'paused', and the live-agent worker aos-3379-retry-nested-answers stayed 'none' unchanged. A real throwaway watcher polling those records then produced .paused-rechecked markers for both stopped workers, zero .wedge-escalations files, and only a routine heartbeat in the wake queue.

What Changed

  • bin/fm-watch.sh now requires two quiet signals before it escalates a wedge. A declared paused: or captain-held last status line beats a working/terminal verdict from the run-step or pane source unless the agent is confidently alive, and a working verdict only outranks a declared pause while that run's own active_steps last_activity is still fresh. At the escalation threshold the watcher makes a bounded no-mistakes axi status read (new pipeline_recently_active, pipeline_activity_fresh, pipeline_run_is_this_task, pipeline_age_secs) and treats a run with activity inside the stale window as working; the probe skips tasks with no mode= in their meta and returns a distinct "no answer" exit so a missing worktree or missing no-mistakes never reads as a stopped run.
  • A dead-agent worker whose last status line announces a PR URL and whose merge watch is genuinely armed now classifies as paused with a "finished worker awaiting merge" reason (finished_awaiting_merge), and absorbed_awaiting_merge keeps that pause state across watcher restarts so the long re-surface throttle is not rebuilt each poll. Two new knobs, FM_PIPELINE_ACTIVE_SECS and FM_PIPELINE_CHECK_TIMEOUT, are documented in docs/configuration.md alongside the FM_FAKE_AXI_STATUS test override.
  • The PR-URL scan that bin/fm-pr-autoarm.sh used inline moved to fm_pr_announced_url in bin/fm-pr-lib.sh so the autoarm sweep and the watcher's awaiting-merge check share one owner, and bin/fm-classify-lib.sh splits crew_absorb_class into crew_state_line plus crew_absorb_class_of_line so a caller needing both the class and the line's fields shells out once. docs/architecture.md records the two-signal rule and the corrected liveness and activity wording; tests/fm-watch-wedge-two-signal.test.sh adds a 10-case table test over the real sourced watcher using captured axi status fixtures.

Risk Assessment

✅ Low: The change is well-bounded to the watcher's stale-triage path, every required intent behavior is implemented and independently verified in source, the earlier rounds' fixes are genuinely present rather than merely claimed, and the new logic fails conservatively (an unreadable probe returns "no answer" and preserves the prior verdict rather than inventing one).

Testing

Ran the two targeted suites and both pass in full: the new tests/fm-watch-wedge-two-signal.test.sh (24 cases) and the existing tests/fm-watch-triage.test.sh (54 cases). Because unit passes alone are not evidence, I also built a before/after transcript that drives the real bin/fm-watch.sh over four identical fixtures shaped from the two incidents in the report, once against the base watcher and once against the branch watcher. That transcript shows each required behavior as an operator would see it: a worker stopped on a green PR flips from none (wedge ladder) to paused (long cadence); a mid-run worker whose pipeline moved 12s ago is now read as active where the base watcher had no pipeline probe at all; a finished worker with an armed PR poll is absorbed into a wake that names the awaiting-merge reason with 2 pause markers and 0 wedge escalations, where the base watcher emitted a bare stale: wake; and a genuinely wedged worker with no pause, no PR watch, and a pipeline quiet for 51m55s still classifies none on both, confirming the escalation path is intact. Two tests failed on the first combined run and both proved non-actionable: the triage failure reproduces on the base commit a0c5f4c so it predates this change, and the new resurface case passed 3/3 in isolation, making it a timing-sensitive test squeezed under full-suite load rather than a product defect. I removed the temporary driver script and both scratch worktrees; the working tree is clean.

Evidence: Before/after: same fixtures through the old and new watcher

Source: Before/after: same fixtures through the old and new watcher

OLD NEW A worker stopped on a green PR, status log ends paused: [key=...] none (wedge ladder) paused (long cadence) B worker mid-run, pipeline last activity 12s ago no pipeline read pipeline ACTIVE at all (the -> escalation function does blocked not exist) C finished worker, green PR, armed merge watch, agent gone bare "stale:" wake absorbed with the surfaced, 0 pause awaiting-merge markers reason, 2 pause markers, 0 wedge escalations D genuinely wedged: no pause, no PR watch, pipeline quiet 51m55s none none (UNCHANGED - still escalates)

BEFORE / AFTER: the same fixtures through the OLD and NEW watcher
=================================================================
Old watcher: a0c5f4c (base commit)     New watcher: 7058bab (this branch)
Both runs drive the REAL bin/fm-watch.sh over identical hermetic fixtures
built from the two incident shapes named in the bug report.

SUMMARY OF THE CHANGE IN OBSERVED BEHAVIOR
------------------------------------------
                                          OLD                 NEW
A  worker stopped on a green PR,
   status log ends `paused: [key=...]`    none  (wedge ladder) paused (long cadence)

B  worker mid-run, pipeline last
   activity 12s ago                       no pipeline read     pipeline ACTIVE
                                          at all (the          -> escalation
                                          function does        blocked
                                          not exist)

C  finished worker, green PR, armed
   merge watch, agent gone                bare "stale:" wake   absorbed with the
                                          surfaced, 0 pause    awaiting-merge
                                          markers              reason, 2 pause
                                                               markers,
                                                               0 wedge escalations

D  genuinely wedged: no pause, no PR
   watch, pipeline quiet 51m55s           none                 none  (UNCHANGED -
                                                               still escalates)

A, B and C are the false alarms this change removes. D is the regression guard:
a truly stuck worker still reaches the wedge ladder exactly as before.

================= FULL OLD-WATCHER TRANSCRIPT (a0c5f4c) =================

========================================================
SCENARIO A - worker deliberately stopped on a green PR (2026-09-09 incident)
========================================================
Worker status log (what the operator sees):
  paused: [key=await-merge] PR green, waiting on the serial merge queue

Watcher verdict: none
Meaning: "paused" = long re-surface cadence, NOT the 1/2/3 wedge ladder.

========================================================
SCENARIO B - worker mid-run inside an active no-mistakes pipeline (2026-09-01 incident)
========================================================
Pipeline the worker is inside (real axi status shape):
run:
  id: "01RUN"
  branch: fm/wedge-fixture
  status: running
  head: "00033b89bef527eddb13b37d046b7bd2a101668c"
  active_steps[1]{step,status,active_for,last_activity,agent_pid,round}:
    ci,running,33m1s,"12s ago: log: building the new body","77305",starting

tests/.evidence.test.sh: line 92: pipeline_recently_active: command not found
Watcher verdict: pipeline quiet -> would escalate

========================================================
SCENARIO C - finished worker awaiting merge, driven through the REAL watcher poll
========================================================
Worker status log:
  done: PR https://github.com/EvanAgee/firstmate/pull/13 checks green
Armed PR merge watch: 2 pr-poll artifacts present

What firstmate actually received in the wake queue:
  1788972687	1	stale	fmtest:fm-am	stale: fmtest:fm-am

Wedge escalation files created: 0 (0 = never treated as a wedge)
Pause markers created: 0

========================================================
SCENARIO D - genuinely wedged worker: no pause, no PR watch, no pipeline
========================================================
Worker status log:
  working: still going
Pipeline: run still `running`, but last activity was 51m55s ago (quiet)

tests/.evidence.test.sh: line 92: pipeline_recently_active: command not found
Watcher verdict: pipeline QUIET -> escalation proceeds, exactly as before
Classification: none (none = eligible for the wedge ladder)


================= FULL NEW-WATCHER TRANSCRIPT (7058bab) =================

========================================================
SCENARIO A - worker deliberately stopped on a green PR (2026-09-09 incident)
========================================================
Worker status log (what the operator sees):
  paused: [key=await-merge] PR green, waiting on the serial merge queue

Watcher verdict: paused
Meaning: "paused" = long re-surface cadence, NOT the 1/2/3 wedge ladder.

========================================================
SCENARIO B - worker mid-run inside an active no-mistakes pipeline (2026-09-01 incident)
========================================================
Pipeline the worker is inside (real axi status shape):
run:
  id: "01RUN"
  branch: fm/wedge-fixture
  status: running
  head: "926dceca264f35d74b4bcc05fd9cefd2c2132776"
  active_steps[1]{step,status,active_for,last_activity,agent_pid,round}:
    ci,running,33m1s,"12s ago: log: building the new body","77305",starting

Watcher verdict: pipeline ACTIVE -> no wedge escalation

========================================================
SCENARIO C - finished worker awaiting merge, driven through the REAL watcher poll
========================================================
Worker status log:
  done: PR https://github.com/EvanAgee/firstmate/pull/13 checks green
Armed PR merge watch: 2 pr-poll artifacts present

What firstmate actually received in the wake queue:
  1788972657	1	stale	fmtest:fm-am	stale: fmtest:fm-am (paused 211114257s, awaiting external - finished worker awaiting merge - PR is green and its merge watch is armed, rechecked on a long cadence not a wedge; confirm the wait still holds)

Wedge escalation files created: 0 (0 = never treated as a wedge)
Pause markers created: 2

========================================================
SCENARIO D - genuinely wedged worker: no pause, no PR watch, no pipeline
========================================================
Worker status log:
  working: still going
Pipeline: run still `running`, but last activity was 51m55s ago (quiet)

Watcher verdict: pipeline QUIET -> escalation proceeds, exactly as before
Classification: none (none = eligible for the wedge ladder)
Evidence: New-watcher behavior transcript (all four required behaviors)

Source: New-watcher behavior transcript (all four required behaviors)

SCENARIO A - worker deliberately stopped on a green PR (2026-09-09 incident) Worker status log: paused: [key=await-merge] PR green, waiting on the serial merge queue Watcher verdict: paused SCENARIO B - worker mid-run inside an active no-mistakes pipeline (2026-09-01 incident) active_steps[1]{step,status,active_for,last_activity,agent_pid,round}: ci,running,33m1s,"12s ago: log: building the new body","77305",starting Watcher verdict: pipeline ACTIVE -> no wedge escalation SCENARIO C - finished worker awaiting merge, driven through the REAL watcher poll What firstmate actually received in the wake queue: 1788972657 1 stale fmtest:fm-am stale: fmtest:fm-am (paused 211114257s, awaiting external - finished worker awaiting merge - PR is green and its merge watch is armed, rechecked on a long cadence not a wedge; confirm the wait still holds) Wedge escalation files created: 0 (0 = never treated as a wedge) Pause markers created: 2 SCENARIO D - genuinely wedged worker: no pause, no PR watch, no pipeline Watcher verdict: pipeline QUIET -> escalation proceeds, exactly as before Classification: none (none = eligible for the wedge ladder)

Watcher two-signal wedge rule: end-to-end behavior transcript
branch: fm/fm-wedge-false-alarms   target: 7058bab
Produced by driving the REAL bin/fm-watch.sh (sourced classifiers and a live poll)
over hermetic fixtures built from the incident shapes in the bug report.


========================================================
SCENARIO A - worker deliberately stopped on a green PR (2026-09-09 incident)
========================================================
Worker status log (what the operator sees):
  paused: [key=await-merge] PR green, waiting on the serial merge queue

Watcher verdict: paused
Meaning: "paused" = long re-surface cadence, NOT the 1/2/3 wedge ladder.

========================================================
SCENARIO B - worker mid-run inside an active no-mistakes pipeline (2026-09-01 incident)
========================================================
Pipeline the worker is inside (real axi status shape):
run:
  id: "01RUN"
  branch: fm/wedge-fixture
  status: running
  head: "926dceca264f35d74b4bcc05fd9cefd2c2132776"
  active_steps[1]{step,status,active_for,last_activity,agent_pid,round}:
    ci,running,33m1s,"12s ago: log: building the new body","77305",starting

Watcher verdict: pipeline ACTIVE -> no wedge escalation

========================================================
SCENARIO C - finished worker awaiting merge, driven through the REAL watcher poll
========================================================
Worker status log:
  done: PR https://github.com/EvanAgee/firstmate/pull/13 checks green
Armed PR merge watch: 2 pr-poll artifacts present

What firstmate actually received in the wake queue:
  1788972657	1	stale	fmtest:fm-am	stale: fmtest:fm-am (paused 211114257s, awaiting external - finished worker awaiting merge - PR is green and its merge watch is armed, rechecked on a long cadence not a wedge; confirm the wait still holds)

Wedge escalation files created: 0 (0 = never treated as a wedge)
Pause markers created: 2

========================================================
SCENARIO D - genuinely wedged worker: no pause, no PR watch, no pipeline
========================================================
Worker status log:
  working: still going
Pipeline: run still `running`, but last activity was 51m55s ago (quiet)

Watcher verdict: pipeline QUIET -> escalation proceeds, exactly as before
Classification: none (none = eligible for the wedge ladder)
Evidence: Targeted suite results (both suites green)
$ bin/fm-test-run.sh tests/fm-watch-wedge-two-signal.test.sh
ok - a declared pause outranks a run-step 'done' when the agent is not alive
ok - a live agent still overrides a declared pause, exactly as before
ok - a run whose last activity is inside the stale window reads as active
ok - a quiet pipeline plus an idle pane still escalates as a possible wedge
ok - an active pipeline resets the wedge timer instead of escalating
ok - a gone agent with no pause, no watch, and no pipeline still surfaces
ok - a green PR with an armed merge watch is absorbed by the real stale dispatch
ok - a done: PR line with no armed watch still surfaces as it did before
ok - an unrelated custom check is not an armed merge watch, so the worker surfaces
ok - an absorbed green-PR worker re-surfaces at most once per pause window
ok - an absorbed green-PR worker still re-surfaces once its window elapses
... (24/24)
FM_TEST_END tests/fm-watch-wedge-two-signal.test.sh exit=0

$ bin/fm-test-run.sh tests/fm-watch-triage.test.sh
... (54/54)
FM_TEST_END tests/fm-watch-triage.test.sh exit=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 5 issues found → auto-fixed (5) ✅
  • 🚨 bin/fm-watch.sh:627 - Secondmate windows lost their fail-open and are now absorbed as paused instead of surfacing. Intent (e) states: "The secondmate branch keeps its previous behavior via an 'alive' default." No such default exists in the code. The if [ "$(window_kind "$win")" != secondmate ] guard at line 625 skips the fm_backend_agent_alive read, so agent_alive remains unset; ${agent_alive:-unknown} at line 628 evaluates to unknown, which is not alive, so control falls to the unconditional printf 'paused' at line 645. The old code instead ran [ "$class" = none ] && [ "${agent_alive:-unknown}" = dead ] && class=paused, which for an unset agent_alive left class untouched and printed it. Verified by probe against a0c5f4c: a kind=secondmate task with status paused: [key=await-answer] waiting on captain and crew state state: unknown · source: none · no current-state source available classified none on the old watcher and paused on the new one. At the secondmate call site (bin/fm-watch.sh:1372) none runs clear_pause_tracking while paused runs handle_paused_stale, so this secondmate is now absorbed on the PAUSE_RESURFACE_SECS cadence rather than having its pause tracking cleared. Fix: set agent_alive=alive in an else branch of the secondmate guard, matching the intent's stated design.
  • ⚠️ bin/fm-watch.sh:486 - The pipeline-activity gate suppresses the busy-pane wedge escalation, which the intent scopes only to pane-idle workers. Required behavior 2 reads: "Before any wedge escalation of a pane-idle worker, read the task's pipeline activity." The pipeline_recently_active check was added inside wedge_timer_check, which is shared by the busy path: bin/fm-watch.sh:1472 and bin/fm-watch.sh:1484 call it with label busy (no completed turn) after busy_turn_over_age confirms a genuinely BUSY pane has gone past BUSY_TURN_MAX_SECS with no completed turn. For any mode=no-mistakes task the pipeline is active by definition during validation, so this path can no longer escalate at all. Verified by probe against a0c5f4c: a kind=ship, mode=no-mistakes task with a since-file 99999s old and an active_steps row reading ci,running,33m1s,"12s ago: ..." queued one possible wedge wake on the old watcher and zero on the new one via the busy (no completed turn) label. A worker whose agent is truly spinning inside a live pipeline now never escalates on that path. Fix: gate on the label or pass an explicit flag so only the pane-idle call sites consult the pipeline.
  • ⚠️ bin/fm-watch.sh:616 - A working verdict sourced from a busy PANE is now gated on no-mistakes pipeline freshness, which is an unrelated signal. crew_absorb_class (bin/fm-classify-lib.sh:1297) prints working for source run-step OR source pane; the intent's rationale (c) is about run-step only ("A 'working' verdict proves a run EXISTS, not that it is MOVING"), but the condition [ "$class" = working ] && [ "$activity_verdict" -ne 1 ] applies to both. A pane that fm-crew-state reports as exactly busy is direct positive evidence of a rendering agent and does not depend on a no-mistakes run. Verified by probe against a0c5f4c: a mode=no-mistakes ship with status paused: [key=await-x] waiting, a live agent (window present, pane_current_command=claude), crew state state: working · source: pane · busy pane, and a quiet pipeline (ci,running,15h29m,"quiet 51m55s ago: ...") classified working on the old watcher and none on the new one, so the wake now surfaces to firstmate instead of being absorbed. Fix: apply the freshness gate only when the verdict's source is run-step.
  • ℹ️ bin/fm-watch.sh:426 - The comment above the active_steps[ guard contradicts the code beneath it. It reads "An answer with no active step is a real negative: a terminal, parked, or not-yet-started run cannot be the reason a pane is legitimately quiet", but line 428 returns 2, which the function's own header (lines 410-413) defines as "no answer available" and which callers holding positive run evidence deliberately ignore. The real-negative return is 1 at line 430, for an answer that HAS an active_steps table but no running/fixing row. Behavior matches intent (d); only the comment is wrong, and it sits directly above the line it misdescribes.
  • ℹ️ bin/fm-watch.sh:350 - meta_field is byte-for-byte the body of fm_meta_get (bin/fm-backend.sh:337), which fm-watch.sh already sources: both are grep "^$key=" "$meta" | tail -1 | cut -d= -f2-. The two call sites can use fm_meta_get "$STATE/$task.meta" mode and fm_meta_get "$STATE/$task.meta" worktree directly, dropping the wrapper. fm_meta_get also adds a [ -f "$meta" ] guard the new copy lacks.

🔧 Fix: scope wedge pipeline gate and restore secondmate fail-open
4 issues (1 error, 3 warnings) still open:

  • 🚨 bin/fm-watch.sh:583 - Required behavior 3 is implemented but unreachable for the workers it targets. finished_awaiting_merge is called only from pause_state_class, inside the ! status_is_paused_or_captain_held branch. But a done: PR &lt;url&gt; ... line IS captain-relevant (verified: status_is_captain_relevant returns true, status_is_paused_or_captain_held returns false), so the watcher's stale dispatch routes such a worker to the stale_is_terminal branch at line 1404, which never calls pause_state_class. The other three pause_state_class call sites are all gated: line 1458/1475 sit inside the else of stale_is_terminal (so the last line is not captain-relevant there), and lines 1475/1511 are additionally guarded by status_is_paused_or_captain_held. Only line 1393 (kind = secondmate) reaches it, and a secondmate is not the green-PR ship worker the criterion describes. Proven by probe: for a ship with done: PR ... green, f.check.sh present, and a dead agent, finished_awaiting_merge returns YES and pause_state_class returns paused, yet stale_is_terminal also returns YES so the watcher takes that branch instead. Intent requires: "A worker whose agent is dead AND whose last status line is 'done: PR <url> ...' with an armed PR watch (state/<id>.check.sh present) is a finished worker awaiting merge, not a wedge: classify it paused with a reason that says so." To make it hold, the check must run at the stale_is_terminal dispatch (before or inside that branch), not only inside pause_state_class.
  • ⚠️ bin/fm-watch.sh:602 - pause_state_class now invokes the expensive crew-state reader twice per call. Line 602 spawns &#34;$FM_CREW_STATE_BIN&#34; &#34;$task&#34; to get the source field, then line 603's crew_absorb_class &#34;$task&#34; spawns &#34;$FM_CREW_STATE_BIN&#34; again internally (bin/fm-classify-lib.sh:1300). fm-crew-state.sh is not a cheap read: it shells out to a bounded no-mistakes axi status (bin/fm-crew-state.sh:394) and can make a second axi logs call via nm_ci_checks_state. Measured with a counting wrapper around the fake reader: base commit a0c5f4c makes 1 invocation, current HEAD makes 2, for an ordinary ship with a declared pause. This doubles the per-poll subprocess cost on the hot pause path and directly contradicts the prior round's instruction ("read it from the fm-crew-state line the same way crew_absorb_class does, without adding a second fm-crew-state call"). Fix: derive both class and crew_source from the single crew_line already captured at line 602, inlining crew_absorb_class's mapping, or have the helper return both.
  • ⚠️ bin/fm-watch.sh:641 - The new secondmate fail-open branch deletes the recheck marker where the pre-change code wrote it, permanently disabling the cheap pause-cadence short-circuit for paused secondmates. Old code (a0c5f4c) fell through to case &#34;$class&#34; in paused) date +%s &gt; &#34;$recheck_file&#34; for a secondmate whose crew_absorb_class returns paused. New code at line 641-645 returns early with rm -f &#34;$recheck_file&#34;. Verified side by side: with kind=secondmate, a paused: status line, .paused-&lt;key&gt; present, and FM_FAKE_CREW_STATE=&#39;state: paused ...&#39;, the base commit leaves .paused-rechecked-fmtest_fm-sm on disk while HEAD does not; both print paused. Consequence: the short-circuit at line 589 ([ -e .paused-$key ] &amp;&amp; age_of(recheck_file) &lt; STALE_ESCALATE_SECS) can never fire again for that key, because age_of on a missing file returns 999999. Every subsequent poll re-runs the full path, which per the finding above now costs two crew-state subprocesses instead of the intended zero. The verdict stays paused, so no false alarm results, but the once-per-window cost bound is lost. Fix: in the secondmate branch, preserve the old marker bookkeeping (write the marker when $class is paused, remove it otherwise) rather than unconditionally removing it.
  • ⚠️ bin/fm-watch.sh:425 - The active-step row scan can match a row belonging to a different TOON table, reporting a stopped pipeline as active and suppressing a legitimate wedge escalation. grep -A&#34;${PIPELINE_ROWS_MAX:-20}&#34; returns 20 lines after the active_steps[ header regardless of that table's declared row count, and the follow-up grep -E &#39;^[[:space:]]*[a-z_]+,(running|fixing),&#39; is not anchored to the active_steps table. Concrete reproduction: with output active_steps[0]{step,status,active_for,last_activity,agent_pid,round}: followed by gates[2]{gate,status,active_for,last_activity}: and a row review,running,5m,&#34;3s ago: reviewing&#34;, the pipeline returns the review,running row and pipeline_activity_fresh answers 0 (active) even though active_steps[0] declares zero active steps. Real axi status output does carry sibling tables (fm-crew-state.sh:187 parses a findings[N]{...} table from the same output, and fm-crew-state.sh:191 scans unanchored rows from it). This is the failure direction the change most needs to avoid: a genuinely wedged worker whose pipeline has stopped gets its escalation reset forever. Fix: bound the scan by the row count in the active_steps[N] header, or stop at the first subsequent line matching another &lt;name&gt;[&lt;n&gt;]{ table header.

🔧 Fix: reach awaiting-merge case, dedupe crew-state read, bound step scan
4 issues (2 errors, 2 warnings) still open:

  • 🚨 bin/fm-watch.sh:418 - pipeline_activity_fresh trusts no-mistakes axi status output without verifying the run belongs to this task's branch, so an unrelated crew's active run suppresses a real wedge escalation and re-breaks the case the change targets. no-mistakes axi status --help documents it as "Show the active (or most recent) run" - it is not scoped to the invoking worktree's branch. bin/fm-crew-state.sh:307-313 states this explicitly for the same command: "no-mistakes axi status (bare) reports the active-or-most-recent run for the CURRENT branch when one exists, else falls back to some other branch's run purely as informational display... A crew whose branch genuinely has no run yet therefore sees another branch's answer here." Both other consumers of this command guard against it: fm-crew-state.sh:396-397 requires run_branch = CREW_BRANCH plus nm_run_head_matches_worktree before setting HAVE_RUN=1, and fm-teardown.sh:1228-1231 requires the same branch and fm_nm_head_matches_worktree before acting. bin/fm-watch.sh:418 calls fm_nm_run &#34;$wt&#34; &#34;$PIPELINE_CHECK_TIMEOUT&#34; axi status and parses the active_steps table with no branch:/head: check at all. Two concrete reachable failures. (a) Wedge suppression: a genuinely wedged worker W (mode=no-mistakes, its own run finished or never started) has its pane idle past STALE_ESCALATE_SECS, so wedge_timer_check runs with check_pipeline=1 (bin/fm-watch.sh:1465, 1509, 1514). Sibling crew X on the same underlying repo has a live run, so W's axi status returns X's TOON with ci,running,2m,&#34;3s ago: ...&#34;. pipeline_recently_active returns 0, and bin/fm-watch.sh:503-507 resets $since_file AND rm -f &#34;$escalation_file&#34;, discarding the accumulated escalation count. As long as any sibling run keeps moving, W never reaches escalation 1, let alone FM_WEDGE_DEMAND_INSPECT_COUNT - required behavior 4 ("agent dead, no declared pause, no armed PR watch, no pipeline activity still escalates exactly as today") silently fails. (b) The targeted false alarm returns: a deliberately stopped green-PR worker with a paused: [key=await-merge] line whose crew_absorb_class reads working/run-step reaches bin/fm-watch.sh:646. Its own ci step is quiet 51m55s, but the probe reads sibling X's fresh row, activity_verdict is 0 not 1, and pause_state_class returns working at line 650 instead of paused - which is precisely what "STARTS THE WEDGE TIMER" per the intent's decision (a). Fix at the shared boundary: extract the branch+head attribution guard already owned by bin/fm-nm-run-lib.sh (fm_nm_field ... branch compared to the worktree's symbolic-ref --short HEAD, plus fm_nm_head_matches_worktree) and require it in pipeline_activity_fresh before parsing active_steps; a non-matching run is "no answer available" (return 2), not evidence of activity.
  • 🚨 bin/fm-watch.sh:468 - finished_awaiting_merge's status match case &#34;$last&#34; in done:*PR*) is an unanchored glob over the whole line, so any done: line containing the substring "PR" anywhere qualifies as "announced a green PR", and a genuinely terminal worker is silently absorbed onto the pause cadence instead of being surfaced to the captain. Verified by running the exact case expression: done: PREPARED the migration but nothing shipped matches, done: refactored PROVIDER lookup matches, done: implemented; no PR yet matches, and done: PR closed without merge matches. The armed-watch precondition does not rescue these: [ -e &#34;$STATE/$task.check.sh&#34; ] is satisfied by ANY registered custom watcher check, not specifically a PR merge watch - bin/fm-check-register.sh registers arbitrary $STATE/$ID.check.sh bytes, and bin/fm-bootstrap.sh:908 arms x-watch.check.sh as a plain relay-poll shim. Concrete failure at the dispatch: a worker with meta kind=ship, a registered &lt;id&gt;.check.sh, a dead agent, and last status line done: refactored PROVIDER lookup and stopped goes stale. status_is_captain_relevant returns 0 for verb done (bin/fm-classify-lib.sh:128), so the poll enters the stale_is_terminal branch, finished_awaiting_merge at bin/fm-watch.sh:1439 returns 0, and handle_paused_stale absorbs it with the reason "finished worker awaiting merge - PR is green and its merge watch is armed". That worker is not awaiting a merge and has no PR; it is a finished worker that needed the captain, and it now re-surfaces only every PAUSE_RESURFACE_SECS with a reason that is factually wrong. The test at tests/fm-watch-wedge-two-signal.test.sh:225 uses done: PR https://example.invalid/pull/7 checks green and its negative at :256 differs only by the armed watch, so neither case can catch this. Fix: anchor the match to a PR announcement rather than a bare substring, e.g. require the token PR at a word boundary followed by a URL (case &#34;$last&#34; in done:*[[:space:]]PR[[:space:]]*http*)) or reuse the existing status-line parsing helpers, so PREPARED/PROVIDER and a PR-less done: line cannot qualify.
  • ⚠️ bin/fm-watch.sh:431 - The awk row-count bound in pipeline_activity_fresh decrements left for every line inside the table region, not only for data rows, so a blank line or any interleaved non-row line exhausts the budget and hides a genuinely running step - reporting a moving pipeline as quiet and letting a mid-run worker escalate as a wedge, the exact 2026-09-01 false alarm this change targets. Verified by running the awk program standalone. Input active_steps[2]{step,status}: / lint,done,1m,&#34;1s ago: x&#34; / (blank line) / ci,running,2m,&#34;3s ago: go&#34; returns NO row: the blank line consumes the second of two slots before the running row is reached. Input active_steps[1]{step,status,active_for,last_activity}: / branch: fm/x / ci,running,2m,&#34;3s ago: go&#34; likewise returns nothing, because the scalar line eats the single slot. The same program correctly returns the row when the data rows immediately follow the header with no interleaving, which is why the suite's fixtures (tests/fm-watch-wedge-two-signal.test.sh:186, 209, 361, 380, 409, 458, 509, 534 - all tightly packed single-row tables) all pass and none exercise this shape. Consequence at the call site: pipeline_activity_fresh returns 1 (a hard negative, not the 2 "no answer" state), so wedge_timer_check at bin/fm-watch.sh:503 does not absorb and the worker escalates, and pause_state_class at bin/fm-watch.sh:646-651 treats the run as stopped. Fix: only decrement left on lines that actually look like table rows (or drop the counter and rely solely on the existing next-table-header terminator at line 437, which already handles the sibling-table case the counter was added for).
  • ⚠️ bin/fm-watch.sh:446 - pipeline_activity_fresh returns 1 (a hard "pipeline stopped") rather than 2 ("no answer available") when a running step's last_activity column is present but not in the &lt;age&gt; ago shape, contradicting the three-state contract the function's own header documents and turning an unreadable field into positive evidence that the run halted. The header at bin/fm-watch.sh:405-408 states: "Exit 2 (not 1) means 'no answer available'... A caller that already holds positive run evidence keeps trusting it rather than reading an unanswerable probe as proof the run stopped." But once a running row IS found, every parse failure downstream falls to return 1: an empty activity field (line 443), a value with no ago (line 447), and an age string with no recognized unit (line 449). Verified by running the extraction logic on plausible rows: ci,running,2m,&#34;just now&#34;,1,1 returns 1, ci,running,2m,&#34;&#34;,1,1 returns 1, ci,running,2m,&#34;starting&#34;,1,1 returns 1, and ci,running,2m,-,1,1 returns 1. Each of those is a row that positively proves a step is running - the strongest available evidence the pipeline exists - yet the probe answers "stopped". Consequence: at bin/fm-watch.sh:646-651 a declared-pause worker whose ci step just started (no elapsed activity to render yet) gets activity_verdict = 1, so pause_state_class falls through to the paused branch; and more damagingly at bin/fm-watch.sh:503 a mid-run worker whose step reports an unrecognized activity format escalates as a wedge despite a visibly running step. pipeline_age_secs is also loose in the other direction: 1ms parses as 60 and 2mo as 120, because only the first character of the unit is read. Fix: when a running/fixing row is found but its activity cannot be parsed, return 2 (unanswerable) rather than 1, so the documented "keeps trusting positive run evidence" rule actually holds; and either reject multi-character units in pipeline_age_secs or document that axi never emits them.

🔧 Fix: attribute pipeline runs, require real PR URL, fix table scan
2 warnings still open:

  • ⚠️ bin/fm-watch.sh:633 - The finished_awaiting_merge block inside pause_state_class is dead code in production, and the unit test covering it asserts a path the real poll never takes. pause_state_class reaches line 633 only when status_is_paused_or_captain_held is false, and finished_awaiting_merge additionally requires the last status line to begin with done:. Verified by running the real classifier on done: PR https://github.com/o/r/pull/1 checks green: status_is_captain_relevant returns 0 (bin/fm-classify-lib.sh:128) while status_is_paused_or_captain_held returns 1. So for any ship worker with a done: PR &lt;url&gt; line, stale_is_terminal (bin/fm-classify-lib.sh:1396-1400) is true and the poll dispatches to bin/fm-watch.sh:1456, where the working duplicate at line 1472 handles it. The non-terminal call sites at bin/fm-watch.sh:1520 and :1537 sit in the else of that same stale_is_terminal test, so a done: line cannot arrive there. The call site at :1573 is guarded by status_is_paused_or_captain_held, which excludes done:. The secondmate call site at :1445 is unreachable too: line 1420 continues any secondmate whose last line is not paused:, and fm_pr_autoarm_announce (bin/fm-pr-autoarm.sh:348) skips kind=secondmate so no secondmate ever gets an armed watch. Confirmed empirically: deleting lines 633-636 and running tests/fm-watch-wedge-two-signal.test.sh leaves test_green_pr_awaiting_merge_is_absorbed_by_the_real_poll (the real-poll case, tests/fm-watch-wedge-two-signal.test.sh:253) passing, and only test_green_pr_with_armed_watch_is_paused (tests/fm-watch-wedge-two-signal.test.sh:557, which calls pause_state_class directly) fails. Consequence: that unit test gives false confidence it guards required behavior 3, when the production guarantee rests entirely on bin/fm-watch.sh:1472. Fix: remove the block at :633-636, and drop or retarget the unit test at tests/fm-watch-wedge-two-signal.test.sh:557, keeping the real-poll case as the proof.
  • ⚠️ bin/fm-watch.sh:496 - finished_awaiting_merge treats the presence of any state/&lt;id&gt;.check.sh as an armed PR merge watch, so an unrelated registered custom check plus a done-line that happens to carry exactly one PR URL absorbs a genuinely terminal worker onto the long pause cadence with a factually wrong reason. state/&lt;id&gt;.check.sh is the generic custom-watcher-check path, not a PR-watch marker: bin/fm-check-register.sh registers arbitrary bytes under that name for any valid task id, and the watcher's own sweep at bin/fm-watch.sh:1266-1289 explicitly distinguishes the two by calling fm_pr_poll_snapshot_capture and setting is_pr_poll, falling back to a plain custom check when that fails. An actually-armed PR watch writes the &lt;id&gt;.pr-poll and &lt;id&gt;.pr-poll-registration sidecars plus the pr= meta field (bin/fm-pr-check.sh:105-183), and bin/fm-pr-lib.sh:677 already owns the exact predicate fm_pr_poll_artifacts_valid &lt;state&gt; &lt;id&gt; &lt;template&gt;, used by bin/fm-pr-check.sh:156 and bin/fm-pr-check-migrate.sh:93. Concrete failure: a ship worker registers a non-PR custom check (a deploy probe, a fixture watcher) via bin/fm-check-register.sh, later finishes and appends done: work complete, superseding https://github.com/o/r/pull/12 - needs a captain call, and its agent exits. Running fm_pr_announced_url on that line returns the single URL successfully (verified), the -e test passes on the unrelated check file, finished_awaiting_merge returns 0, and bin/fm-watch.sh:1472 routes the worker into handle_paused_stale with the reason "finished worker awaiting merge - PR is green and its merge watch is armed". That worker has no armed merge watch and needed the captain, but now re-surfaces only once per PAUSE_RESURFACE_SECS behind a wrong reason - a worse failure than the false alarm this change fixes. Fix: replace [ -e &#34;$STATE/$task.check.sh&#34; ] with the existing shared owner fm_pr_poll_artifacts_valid &#34;$STATE&#34; &#34;$task&#34; &#34;$SCRIPT_DIR/fm-pr-poll.sh&#34; so only a real armed PR poll qualifies. Note the user intent spells this precondition as "state/<id>.check.sh present", so the narrowing is a correctness refinement of the author's stated rule rather than a contradiction of it.

🔧 Fix: require genuine PR poll, drop unreachable merge branch
1 error still open:

  • 🚨 bin/fm-watch.sh:1415 - The new finished-awaiting-merge absorb re-surfaces a wake on EVERY poll instead of once per PAUSE_RESURFACE_SECS, because the poll loop's pause-tracking reset at bin/fm-watch.sh:1415 deletes the throttle marker handle_paused_stale depends on.

Mechanism: this worker's last status line is done: PR &lt;url&gt; checks green, so status_is_paused_or_captain_held is FALSE for it (verified: bin/fm-classify-lib.sh:150-156 matches only paused: or the captain-held verb). Line 1415 therefore fires on every poll once .paused-&lt;key&gt; exists, and clear_pause_tracking -> clear_pause_state (bin/fm-watch.sh:617-623, 608-614) removes .paused-&lt;key&gt; AND .paused-resurfaced-&lt;key&gt;. Line 1472's finished_awaiting_merge then returns 0 and handle_paused_stale at line 1479 recomputes rf_age via age_of on the now-missing marker, which returns 999999, so the [ &#34;$rf_age&#34; -ge &#34;$PAUSE_RESURFACE_SECS&#34; ] guard at line 599 passes again and fm_wake_append + wake fire again.

Evidence (real code, no mocked classifier):

  1. Ran the actual sourced watcher's line-1415 guard, finished_awaiting_merge, and handle_paused_stale in sequence for three polls against a fixture with a genuinely armed PR poll (arm_pr_poll), a dead agent, and an old status file: 3 wakes fired, with "clear_pause_tracking RAN" logged before polls 2 and 3.
  2. The identical three-poll sequence with an ordinary paused: [key=await-merge] ... last line fired exactly 1 wake, confirming the throttle works there and is defeated only for the new done:-line path.
  3. Independently, running the real bin/fm-watch.sh over a seeded state dir and sampling stat -f &#39;%i %m&#39; on .paused-&lt;key&gt; showed the inode changing on every poll cycle (MISSING -> inode A -> MISSING -> inode B -> ...), proving clear_pause_tracking deletes and handle_paused_stale recreates it each pass.

Impact: the change's stated purpose is to stop each false alarm costing firstmate a full handling turn. For this case it produces one wake per FM_POLL interval, a strictly higher rate than the level-1/2/3 wedge ladder it replaced.

Test gap: neither new test can catch this. test_green_pr_awaiting_merge_is_absorbed_by_the_real_poll (tests/fm-watch-wedge-two-signal.test.sh:309) and test_green_pr_awaiting_merge_absorbed_on_a_repeat_hash (:522) both stop the watcher the moment .paused-&lt;key&gt; appears, and both leave the status file fresh so age &lt; PAUSE_RESURFACE_SECS and no wake is ever attempted. They assert the absorb happens, never that it stays throttled.

Recommended fix at the earliest shared boundary: make the line-1415 guard skip a window that finished_awaiting_merge covers, so .paused-resurfaced-&lt;key&gt; survives and handle_paused_stale remains the single owner of the re-surface cadence. Add a regression test that polls the same stale hash twice with a status file older than PAUSE_RESURFACE_SECS and asserts exactly one queued stale wake.

🔧 Fix: keep awaiting-merge pause state across watcher restarts
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bin/fm-test-run.sh tests/fm-watch-wedge-two-signal.test.sh - all 24 cases pass
  • bin/fm-test-run.sh tests/fm-watch-triage.test.sh - all 54 existing cases pass
  • Before/after behavior transcript: drove the real bin/fm-watch.sh over four identical hermetic fixtures under both the base watcher (a0c5f4c) and the branch watcher (7058bab), comparing pause_state_class, pipeline_recently_active, and a live 14s watcher poll
  • Required behavior 1: pause_state_class fmtest:fm-pm pm on a paused: [key=await-merge] line with a non-alive agent returns paused (base returns none)
  • Required behavior 2: pipeline_recently_active against real-shape active_steps[1]{...} rows with last_activity 12s ago returns active; the function does not exist on the base commit
  • Required behavior 3: live watcher poll over a seeded stale pane with an armed PR poll (arm_pr_poll writing real pr-poll + pr-poll-registration sidecars) produced a wake reading awaiting external - finished worker awaiting merge - PR is green and its merge watch is armed, 2 pause markers, 0 wedge-escalation files
  • Required behavior 4 (regression guard): a worker with no pause, no armed PR watch, and a pipeline quiet 51m55s classifies none and pipeline_recently_active returns quiet, matching base behavior exactly
  • Flake triage: ran test_awaiting_merge_absorb_resurfaces_once_the_window_elapses in isolation 3 consecutive times (3/3 pass) after it failed once in the full suite
  • Pre-existing-failure check: ran bin/fm-test-run.sh tests/fm-watch-triage.test.sh in a worktree at base commit a0c5f4c and reproduced the same stale suppressor not advanced on absorb failure there
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: scope shellcheck PATH disables, drop unused test helper
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

What I walked

This change has no user interface, so there is nothing to screenshot. The walk below is the equivalent for a watcher script: the real fleet's own task records driven through the classifier, then a real watcher polling them.

Every step ran against a throwaway FM_HOME pointed at a scratch copy of state/, plus the sanctioned bin/fm-watch-checkpoint.sh. The live home's watcher was never started, stopped, or signaled, bin/fm-watch-arm.sh was never run, and no fm-watch process was killed. I confirmed the live watcher stayed healthy throughout (its heartbeat was current at each check).

The idle-on-green-PR workers, before and after

Both are real fleet tasks that were deliberately stopped with fm-control exit, had a green PR, and were waiting on the serial merge queue. Both are the exact 2026-09-09 shape. I ran the same records through the unmodified HEAD watcher and the changed one:

task last status line agent before after
aos-3475-foreign-chat-toast paused: [key=await-merge] PR .../3611 green; waiting for the serial merge queue gone working (starts the wedge timer) paused
aos-3592-model-pick-race paused: [key=await-merge] PR .../3616 green; waiting for the serial merge queue alive on recheck none (wedge ladder) paused
aos-3379-retry-nested-answers working: custody recovered ... alive none none (unchanged)

The third row is the control. A worker with a live agent must keep surfacing for inspection, and it does.

What the measured cause turned out to be

Reading bin/fm-crew-state.sh against the live fleet, all three escalated workers reported state: working · source: run-step · validating (running), not the done the report assumed. A no-mistakes run keeps its ci step running for as long as the PR stays open. pause_state_class honored that working verdict ahead of the worker's own declared pause and absorbed the pane as provably-working, which starts the wedge timer, and that timer is what escalated them.

I confirmed the same thing directly against the installed binary. aos-3475's run had been status: running for 15h29m with its last activity quiet 51m55s ago. That is why the activity signal here is the active_steps table's last_activity column and not the run's top-level status: reading the top-level status would mark every stopped green-PR worker permanently active and suppress its escalation forever, the opposite of the rule this PR adds.

A real watcher over the same records

I then pointed a throwaway watcher at those records through bin/fm-watch-checkpoint.sh, with a shortened stale window so several windows elapsed inside one run. After the run:

  • .paused-rechecked-firstmate_fm-aos-3475-foreign-chat-toast and .paused-rechecked-firstmate_fm-aos-3592-model-pick-race were both present, so both stopped workers were on the long pause recheck cadence.
  • No .wedge-escalations-* file existed for any task, so nothing escalated.
  • The wake queue held one routine heartbeat record and no stale ... possible wedge record.

An earlier 70-second run over the same records exited on a heartbeat rather than a wedge, with all three panes confirmed idle (busy=no) so the pane-idle condition really was exercised.

The secondmate and paused cases

  • Secondmate under a declared pause. A kind=secondmate window with a paused: line and an idle pane surfaces instead of being absorbed. Review caught that my first version had silently removed this fail-open, so it is now an explicit branch and a test.
  • Paused secondmate keeps its recheck marker. The pre-change code wrote .paused-rechecked-<key> for a secondmate whose crew state reads paused, and it still does. My first fix had deleted it, which would have disabled the cheap pause-cadence short-circuit permanently.
  • A genuinely frozen run still escalates. An actively-moving run behind a declared pause still resumes wedge tracking, which is what tests/fm-watch-triage.test.sh's test_nonterminal_paused_rechecks_authoritative_state pins. This is why a working verdict only outranks a declared pause while that run's own activity is fresh.
  • The genuinely dead case is untouched. Agent gone, no declared pause, no armed watch, no pipeline activity still escalates exactly as before.
  • A finished worker awaiting merge stays quiet between windows. It re-surfaces at most once per pause window and still re-surfaces once that window elapses, so it is neither noisy nor silently forgotten.

Tests

tests/fm-watch-wedge-two-signal.test.sh has 24 cases, all green, driving the real sourced watcher rather than asserting anything about implementation source text. I verified the original set was non-vacuous by running it against the unmodified HEAD watcher, where 5 cases fail and pass only with the change. Two cases that passed on base and therefore proved nothing were rewritten: the declared-pause case now uses an unverified backend so the agent reads unknown (the real-world shape), and the no-mode case asserts a positive control so a "quiet" verdict cannot come from a missing function.

tests/fm-watch-triage.test.sh is green, along with the wake-queue, inactive-reconcile, and classify-decision-key suites. bin/fm-lint.sh and bin/fm-doc-audience-check.sh both pass.

🤖 Generated with Claude Code

EvanAgee and others added 8 commits September 9, 2026 09:39
An idle terminal pane was treated as proof that a worker had wedged. It
is not. A worker doing its real work inside a no-mistakes run renders
nothing in its pane for the run's whole duration, and a worker firstmate
deliberately stopped on a green PR has no live agent at all. Both shapes
escalated through the wedge ladder, and each false alarm cost firstmate a
full handling turn: five mid-run workers on 2026-09-01, and three stopped
green-PR workers on 2026-09-09 that reached escalation level 3 with a
`paused: [key=await-merge]` line sitting at the end of each status log.

A pane-idle worker now escalates only when its second signal is quiet
too.

The measured cause of the 2026-09-09 batch differs from the one the
report assumed. Those workers did not read `done`. Reading the live fleet
through fm-crew-state.sh, all three reported `state: working · source:
run-step · validating (running)`, because a no-mistakes run keeps its ci
step running for as long as the PR stays open. pause_state_class honored
that verdict ahead of the worker's own declared pause and absorbed the
pane as provably-working, which starts the wedge timer.

So a `working` verdict now proves only that a run exists, never that it
is moving. It outranks a declared pause only while the run's own last
activity is still inside the stale window. That activity comes from the
active_steps table's last_activity column rather than the run's top-level
status: verified against the installed binary, a worker stopped on a
green PR reports `status: running` after 15h29m with its last activity
"quiet 51m55s ago", so reading the top-level status would mark every such
worker permanently active and suppress its escalation forever. An
unanswerable probe (no worktree, no no-mistakes, no active_steps table)
leaves existing run evidence trusted rather than reading silence as proof
the run stopped, which keeps a genuinely frozen run escalating.

Three further changes complete the rule:

- The declared-pause gate required a confidently `dead` agent, which no
  unverified backend and no unreadable record can report; both answer
  `unknown`. Those workers fell through to the wedge ladder despite their
  own `paused:` line. Only a live agent overrides a declared pause now,
  since only a live agent could still be silencing a decision gate.
- A gone agent whose last status announced a green PR and whose merge
  watch is armed is a finished worker awaiting its merge, not a wedge.
- wedge_timer_check reads pipeline activity at the escalation threshold
  and restarts the timer instead of escalating when a run is still
  moving. The read is bounded like every other watcher check, and a task
  with no delivery mode drives no pipeline and skips it entirely.

A genuinely dead worker with no pause, no armed watch, and no live
pipeline still escalates exactly as before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WKCybnU6Sk9XSapj4jsW9D
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2a69add8-0899-4bbe-b870-e18881e89586

📥 Commits

Reviewing files that changed from the base of the PR and between a0c5f4c and 7eba498.

📒 Files selected for processing (7)
  • bin/fm-classify-lib.sh
  • bin/fm-pr-autoarm.sh
  • bin/fm-pr-lib.sh
  • bin/fm-watch.sh
  • docs/architecture.md
  • docs/configuration.md
  • tests/fm-watch-wedge-two-signal.test.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EvanAgee EvanAgee added the agent-pr-watched An agent merge watch is armed on this PR label Sep 9, 2026
@EvanAgee
EvanAgee merged commit 87890f7 into main Sep 9, 2026
21 checks passed
EvanAgee added a commit that referenced this pull request Sep 22, 2026
Refs #1
Refs #42
Refs #60
Refs #65
Refs #73
Refs #74
Refs #107
Refs #109
Refs #117

## What I walked

In a throwaway `.scratch-c4-walk/home` and local Git repository:

```
$ FM_HOME=.scratch-c4-walk/home bin/fm-merge-local.sh walk-clean
merged fm/walk-clean into local main (aa84759 -> 1b9c678) in /Users/evanagee/.treehouse/firstmate-df5ff1/9/firstmate/.scratch-c4-walk/project
$ git -C .scratch-c4-walk/project log -1 --format=%s main
clean local landing
```

```
$ FM_HOME=.scratch-c4-walk/home FM_GH_BIN=.scratch-c4-walk/fake-gh bin/fm-flow.sh walk status
matched rulesets: main-protection=1 (rules: pull_request,required_status_checks) review=2 (rules: pull_request)
registry posture: [no-mistakes-prod-only +yolo]
main-protection ruleset 1 enforcement: active
main-protection ruleset gates: pull_request + required_status_checks present
review ruleset 2 enforcement: active
stored previous posture: <none>
verdict: full
```

```
$ FM_HOME=.scratch-c4-walk/home bin/fm-merge-local.sh walk-outage fm/walk-outage
error: task walk-outage is mode=no-mistakes; a PR-bound task lands locally only while GitHub is unreachable (state/.github-down present)
merge its PR with bin/fm-pr-merge.sh after approval
exit=1
```

The flow status used a local fake that returned read-only ruleset data. No GitHub request, PR, or push was made.

## Port record

The root already had guarded `fm-pr-merge.sh` and `fm-merge-local.sh`, canonical v2 PR poll registration and repair, GitLab merge verification, task control locks, leases, captain holds, and persisted merge authority. During the final rebase, the root also gained the outage landing skill unchanged.

I kept those root implementations. The port adds auto-arm, reviewer chase, review-thread gating, issue claims and post-merge closing, GitHub outage landing and return sync, and the project flow switch around them.

I dropped the fork's obsolete `captain-merge` token, `fm-pr-check-migrate.sh`, and C3 delivery timing, backfill, and token ledger changes. The root's captain-hold authority and repairable poll publication cover those seams.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr-watched An agent merge watch is armed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant