Skip to content

fix(bin): keep declared-wait pause cadence for live panes with unreadable state - #7997

Open
zestysoft wants to merge 7 commits into
kunchenguid:mainfrom
zestysoft:fm/firstmate-pause-marker-unverified-pane
Open

zestysoft wants to merge 7 commits into
kunchenguid:mainfrom
zestysoft:fm/firstmate-pause-marker-unverified-pane

Conversation

@zestysoft

@zestysoft zestysoft commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #8405

Intent

A worker that has correctly said "I am waiting for X" must stop being treated as stuck. Last night a lane stood down properly and recorded what it was waiting on, and the monitor still raised the same possible-stuck-worker alarm for it every few minutes, all night, because after any monitor restart that lane fell back onto the fast stuck-worker check. The alarm is only useful if a quiet worker that declared a wait does not keep re-triggering it.

What Changed

  • pause_state_class in bin/fm-watch.sh now keeps the paused class for a live ordinary crew when two things are both unknown: its crew state from fm-crew-state and its semantic busy verdict. So after a watcher restart, a worker that declared paused: or captain-held stays on the long PAUSE_RESURFACE_SECS cadence and does not fall back to the fast possible-wedge alarm. Live crews no longer skip this check through the recheck shortcut: their crew state is read again on every check, so a run that parks or starts later is still noticed. Crew-state lookup now uses a new helper, crew_absorb_line_class in bin/fm-classify-lib.sh. Busy-verdict lookup now uses a new helper, window_busy_verdict, shared by window_is_busy, unknown_alive_stale_bound and the new pause check.
  • A new helper, stale_wait_first_alarm_owed, makes sure a declaration that was quietly absorbed as unreadable still gets its one first-sight wake. That wake fires when a confirmed blocking dialog shows up, or when the crew state later becomes readable and the declaration is no longer admitted as paused. A paused: ... until <time> line, or a declaration whose alarm already fired, keeps its normal cadence. The pause handlers now pass the dialog name along, and declared-wait stale wakes name that dialog in their reason text.
  • docs/architecture.md and the code comments now describe this exception. tests/fm-watch-triage-pause.test.sh adds tests for the unreadable-pane case across watcher restarts and for the owed-first-alarm and dialog paths.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: I traced every recorded fix and found no new defect. Unreadable-pane recovery now requires both an unknown crew state and an unknown busy verdict (checked against the real fm-crew-state.sh, which prints unknown pane for an unknown busy verdict). The dialog and parks-later wakes go through stale_wait_first_alarm_owed, which leaves until lines and already-alarmed declarations on handle_paused_stale's cadence. The away-mode busy handoff names the dialog without writing pause bookkeeping. The tests run the real watcher across restarts and check the wake queue.

Testing

I ran the targeted pause test file (all 34 pass, including the 5 new tests). Then I drove the real watcher in a disposable lab with a private tmux server, a real idle Codex pane, and the real crew-state reader. A lane that declared a wait stayed silent across 6 restarts while its pane changed: no stale wakes, pause marker kept, no wedge timer. When the run parked at a readable gate, the watcher surfaced exactly once and then held. The base build, run the same way, raised its one first-sight stale wake and then stayed quiet. So the overnight every-few-minutes re-alarm was not reproduced in this short lab window. The lab was torn down. Logs are in the evidence dir. This is a CLI daemon with no UI, so there are no screenshots.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A Codex lane (real CLI idle in lab tmux, real crew state unknown codex-unverified) declares paused: waiting for CI; the real watcher is restarted 6 times and the pane content changes between resta… ✅ pass live lab-new-tick-watcher.log: only the initial status signal, then 5 restarts with no wake; .paused-<key> kept and no .stale-since-<key>
Adversarial: after the wait was silently absorbed, the lane's run parks at a readable ask-user gate (crew state stubbed to parked · run-step in the same live lab). Expected: one stale wake, then no… ✅ pass live lab-new-parked-watcher.log: start #1 printed stale: fmlab:codexlane, start #2 had no wake in 15s
Confirmed Claude blocking dialog (on first sight, later, or on a busy over-age pane with a far until) still surfaces once, or keeps the cadence ✅ pass live tests/fm-watch-triage-pause.test.sh: a confirmed blocking dialog gets one first-sight wake at both pause gates, a blocking dialog that appears after a silent first sight surfaces once, `a busy dia…
Evidence: New watcher: 6 restarts with a ticking real Codex pane, no stale wakes

Source: New watcher: 6 restarts with a ticking real Codex pane, no stale wakes

--- [new-tick] watcher start #1 at 08:47:33
signal: /var/folders/vm/y9zpsxps43q2cvqmbq1xpqd00000gn/T//fm-lab.VDptkI/state/lane.status
    (watcher exited with a wake)
--- [new-tick] watcher start #2 at 08:47:36
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › c)
--- [new-tick] watcher start #3 at 08:48:22
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › d)
--- [new-tick] watcher start #4 at 08:49:07
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › e)
--- [new-tick] watcher start #5 at 08:49:53
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › f)
--- [new-tick] watcher start #6 at 08:50:38
    (no wake in 20s; watcher stopped = restart)
Evidence: Base watcher: same lab run, for comparison (one first-sight stale wake)

Source: Base watcher: same lab run, for comparison (one first-sight stale wake)

--- [base-tick] watcher start #1 at 08:44:29
signal: /var/folders/vm/y9zpsxps43q2cvqmbq1xpqd00000gn/T//fm-lab.VDptkI/state/lane.status
    (watcher exited with a wake)
--- [base-tick] watcher start #2 at 08:44:33
stale: fmlab:codexlane
    (watcher exited with a wake)
    (pane ticked: composer now shows › c)
--- [base-tick] watcher start #3 at 08:44:42
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › d)
--- [base-tick] watcher start #4 at 08:45:23
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › e)
--- [base-tick] watcher start #5 at 08:46:03
    (no wake in 20s; watcher stopped = restart)
    (pane ticked: composer now shows › f)
--- [base-tick] watcher start #6 at 08:46:46
    (no wake in 20s; watcher stopped = restart)
Evidence: New watcher: crew state turns into a parked gate, one wake then silent

Source: New watcher: crew state turns into a parked gate, one wake then silent

--- [new-parked] watcher start #1 at 08:51:28
stale: fmlab:codexlane
    (watcher exited with a wake)
--- [new-parked] watcher start #2 at 08:51:31
    (no wake in 15s; watcher stopped = restart)
Evidence: Real Codex pane the watcher was watching

Source: Real Codex pane the watcher was watching

│ ✨ Update available! 0.166.0 -> 0.167.0         │
│ Run brew upgrade --cask codex to update.        │
│                                                 │
│ See full release notes:                         │
│ https://github.com/openai/codex/releases/latest │
╰─────────────────────────────────────────────────╯


  >_ OpenAI Codex (v0.166.0)
     /private/var/folders/vm/y9zpsxps43q2cvqmbq1xpqd00000gn/T/fm-lab.VDptkI/projects/lane

  To get started, describe a task or try one of these commands:

  /init - create an AGENTS.md file with instructions for Codex
  /status - show current session configuration
  /permissions - choose what Codex is allowed to do
  /model - choose what model and reasoning effort to use
  /review - review any changes and find issues


› f

  GPT-6.1-Sol medium · /private/var/folders/vm/y9zpsxps43q2cvqmbq1xpqd00000gn/T/fm-lab.VDptkI/projects/lane · Context 0% used
Evidence: Targeted pause test file output (34/34 ok)

Source: Targeted pause test file output (34/34 ok)

1..34
ok - all four required captain-hold tests fail when tasks-axi is unavailable
ok - a not-provably-working non-terminal stale is surfaced immediately (never left to wait out the timer)
ok - a declared pause is absorbed on first sight, then re-surfaced as a recheck past the threshold, never wedge-escalated
ok - exited declared-pause and captain-held panes use bounded pause cadence while a live decision gate still surfaces once
ok - own-work waits keep one first alert, then bounded rechecks without wedges; undeclared idle still alarms
ok - absorbed paused and captain-held replacements each start their own re-surface cadence
ok - a parked live worker surfaces once, absorbs pane churn for the whole re-surface window, then re-surfaces when it elapses
ok - an unverified Codex declared wait records and keeps the long pause cadence
ok - an unverified Codex wait surfaces once when its run parks, on first sight or a still pane
ok - a confirmed blocking dialog gets one first-sight wake at both pause gates
ok - a blocking dialog that appears after a silent first sight surfaces once
ok - a busy dialog pane with a far until still re-surfaces on the cadence
ok - a live paused worker stays absorbed until its declared time, then rechecks
ok - work under an open captain call surfaces once, absorbs pane churn, then re-surfaces when the window elapses
ok - a stale window with no open captain call keeps alarming on every new hash
ok - a wake that never reached the durable queue arms no re-surface throttle
ok - a released-then-re-held task is a distinct captain call whose first sight still alarms
ok - a declared paused secondmate re-surfaces on the bounded normal-mode cadence
ok - a captain-held secondmate re-surfaces on the bounded normal-mode cadence
ok - a non-paused secondmate retains normal stale suppression
ok - a resumed secondmate clears pause and stale tracking before stale exemption
ok - unchanged stale hashes reclassify when a crew enters or leaves pause
ok - a declared pause is periodically rechecked against authoritative active-run state
ok - a paused status overridden by authoritative working preserves its wedge timer, is rechecked rather than wedge-escalated while the declaration stands, and escalates once it is lifted
ok - a captain-held item is never rechecked while the away-posture record exists, and the recheck returns once the record is archived
ok - a live captain-held pane is absorbed on first sight while the away-posture record exists
ok - a delivery the captain already holds is never rechecked while the away-posture record exists
ok - the daemon-owned one-shot never hands off a captain-held pane while the away-posture record exists
ok - quiet mode's record silences no captain-held recheck, on the watcher's cadence or through a quiet daemon's one-shot
ok - a declared wait naming a near-future until time stays quiet until that time
ok - a wrong-year declared time cannot silence the watcher beyond the recheck cadence
ok - a declared wait whose until time has passed is rechecked at once, then held to the cadence
ok - without until, a worker paused on its own ended background job is not rechecked inside the cadence
ok - until set to a background job's timeout rechecks the worker paused on it once the job must have ended
FM_TEST_COMPLETE
bash tests/fm-watch-triage-pause.test.sh  111.70s user 174.06s system 49% cpu 9:32.69 total
Evidence: New watcher restart transcript
#1 signal: lane.status (wake)
#2 no wake in 20s -> restart
(pane ticked: › c) #3 no wake
(pane ticked: › d) #4 no wake
(pane ticked: › e) #5 no wake
(pane ticked: › f) #6 no wake
state: .paused-<key> present, no .stale-since-<key>

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (2) ✅
  • 🚨 bin/fm-watch.sh:2652 - In rounds 2 and 3 the user chose to fix this, but the current branch does not. pause_runtime_unreadable checks only the pane's busy verdict. It never checks the authoritative crew state. Then pause_state_class turns any crew_absorb_class none into paused (bin/fm-watch.sh:2711). crew_absorb_class (bin/fm-classify-lib.sh:2583) folds readable states into none: fm-crew-state's parked, failed, done, blocked. Concrete path: a codex worker writes paused: waiting for the pipeline, then its no-mistakes run parks at an ask-user gate. fm-crew-state prints state: parked · source: run-step, so crew_absorb_class says none. The codex busy verdict is always unknown codex-unverified, so pause_runtime_unreadable returns 0 at :2698 and the class becomes paused. handle_paused_stale then absorbs it silently until the status file is PAUSE_RESURFACE_SECS old (default 4h). The base code surfaced it once. Sibling sites with the same invariant: (1) the recheck-young gate at bin/fm-watch.sh:2681 never reads crew state, so a gate that parks after an absorbed first sight stays silent there; (2) the stable-hash *) handle_paused_stale arm at bin/fm-watch.sh:4481 absorbs a none whose first sight never alarmed (this was round 3's parks-later decision, also not in this branch). Fix, as already decided: admit the unreadable-pane recovery only when the fm-crew-state verdict is itself unknown. Read that line once in pause_state_class and pass it in, rather than relying on the busy verdict alone. Then make the :4481 arm surface once when the plain declaration never fired its first alarm. Keep handle_paused_stale for until lines and for an already-recorded declared:&lt;sig&gt; or declared:&lt;sig&gt;:due throttle, per the round-4 decision.
  • ⚠️ docs/architecture.md:118 - Line 117 still says the watcher 'first surfaces one stale wake'. Line 118 says 'Live or inconclusive liveness remains fail-open at that initial surface, so a worker genuinely waiting on a decision is never silenced.' After this change, a live crew with an unknown busy verdict is classified paused on first sight and absorbed with no wake, unless a Claude picker shows. The new test asserts exactly that. The surface_nonterminal_stale header comment has the same stale claim at bin/fm-watch.sh:2905-2908 ('pause_state_class deliberately answers none for a still-LIVE agent even under a declared wait ... routes every parked-but-live worker here'). Fix both texts so they say an unreadable-verdict live pane takes the pause cadence with no first-sight wake, except for a confirmed blocking dialog.
  • ℹ️ bin/fm-watch.sh:2531 - The new dialog branch in busy_turn_bound_check runs before the afk_present branch. So in away mode, a busy over-age pane with a declared wait and the Claude picker now goes through surface_nonterminal_stale. That function writes normal-mode pause bookkeeping (.paused-<key>, .paused-rechecked-<key>), which the afk branch's comment says must stay unwritten because the daemon owns it. It also keys .stale-<key> to the pane hash instead of the declaration, and re-wakes every PAUSE_RESURFACE_SECS instead of once per declaration. Small fix: gate the new branch on ! afk_present, and in the afk branch pass the dialog name through stale_reason_naming_dialog, the same way the idle away path does at :4350.

🔧 Fix applied.
6 issues (1 error, 2 warnings, 3 infos) still open:

  • 🚨 bin/fm-watch.sh:2652 - In rounds 2 and 3 the user chose to fix this, but the current branch does not. pause_runtime_unreadable checks only the pane's busy verdict. It never checks the authoritative crew state. Then pause_state_class turns any crew_absorb_class none into paused (bin/fm-watch.sh:2711). crew_absorb_class (bin/fm-classify-lib.sh:2583) folds readable states into none: fm-crew-state's parked, failed, done, blocked. Concrete path: a codex worker writes paused: waiting for the pipeline, then its no-mistakes run parks at an ask-user gate. fm-crew-state prints state: parked · source: run-step, so crew_absorb_class says none. The codex busy verdict is always unknown codex-unverified, so pause_runtime_unreadable returns 0 at :2698 and the class becomes paused. handle_paused_stale then absorbs it silently until the status file is PAUSE_RESURFACE_SECS old (default 4h). The base code surfaced it once. Sibling sites with the same invariant: (1) the recheck-young gate at bin/fm-watch.sh:2681 never reads crew state, so a gate that parks after an absorbed first sight stays silent there; (2) the stable-hash *) handle_paused_stale arm at bin/fm-watch.sh:4481 absorbs a none whose first sight never alarmed (this was round 3's parks-later decision, also not in this branch). Fix, as already decided: admit the unreadable-pane recovery only when the fm-crew-state verdict is itself unknown. Read that line once in pause_state_class and pass it in, rather than relying on the busy verdict alone. Then make the :4481 arm surface once when the plain declaration never fired its first alarm. Keep handle_paused_stale for until lines and for an already-recorded declared:&lt;sig&gt; or declared:&lt;sig&gt;:due throttle, per the round-4 decision.
  • ⚠️ docs/architecture.md:118 - Line 117 still says the watcher 'first surfaces one stale wake'. Line 118 says 'Live or inconclusive liveness remains fail-open at that initial surface, so a worker genuinely waiting on a decision is never silenced.' After this change, a live crew with an unknown busy verdict is classified paused on first sight and absorbed with no wake, unless a Claude picker shows. The new test asserts exactly that. The surface_nonterminal_stale header comment has the same stale claim at bin/fm-watch.sh:2905-2908 ('pause_state_class deliberately answers none for a still-LIVE agent even under a declared wait ... routes every parked-but-live worker here'). Fix both texts so they say an unreadable-verdict live pane takes the pause cadence with no first-sight wake, except for a confirmed blocking dialog.
  • ℹ️ bin/fm-watch.sh:2531 - The new dialog branch in busy_turn_bound_check runs before the afk_present branch. So in away mode, a busy over-age pane with a declared wait and the Claude picker now goes through surface_nonterminal_stale. That function writes normal-mode pause bookkeeping (.paused-<key>, .paused-rechecked-<key>), which the afk branch's comment says must stay unwritten because the daemon owns it. It also keys .stale-<key> to the pane hash instead of the declaration, and re-wakes every PAUSE_RESURFACE_SECS instead of once per declaration. Small fix: gate the new branch on ! afk_present, and in the afk branch pass the dialog name through stale_reason_naming_dialog, the same way the idle away path does at :4350.
  • ⚠️ bin/fm-watch.sh:2568 - The dialog branches added in aa4935a send any declared wait with a Claude picker to surface_nonterminal_stale without checking whether the first alarm is still owed or whether the line has an until time. They also miss a picker that shows up after the first sight. Round 1's fix (f1a5dd1) added stale_wait_first_alarm_owed for the none arm but left these sibling sites behind. Two concrete failures:
    (a) Busy path loses the until cadence (bin/fm-watch.sh:2568). A busy pane past its turn age writes paused: rate limit until &lt;a time 1 year away, e.g. a wrong year&gt; while the picker is on screen. Every over-age busy poll calls surface_nonterminal_stale. Its now &lt; until branch sets throttled=0 and records nothing, so it stays silent every time. handle_paused_stale is never reached, so its re-surface ('declared time beyond the recheck cadence', once the status is PAUSE_RESURFACE_SECS old) never fires. Result: a pane with a confirmed blocking dialog stays silent until the far-off time. Before this change, busy_turn_bound_check always went to handle_paused_stale. This is the same rule the round-4 decision protected (a far until cannot extend the cadence). The first-sight gate at :4479 has the same until blind spot, but its later stable polls go back to handle_paused_stale, so only the dialog wake is lost there.
    (b) A picker that appears after the first sight never surfaces. An unknown-verdict Claude lane (e.g. unknown claude-unverified, crew state unknown) has its first sight absorbed with no dialog. The picker opens later and the hash changes. The hash-change gate (:4546 paused) handle_paused_stale) absorbs it, then every stable poll hits the paused) arm at :4493, which never reads $dialog. The lane is never surfaced, which contradicts docs/architecture.md:118 ('a confirmed blocking dialog still surfaces once').
    Smallest fix: gate every dialog branch on the existing helper: [ -n &#34;$dialog&#34; ] &amp;&amp; stale_wait_first_alarm_owed &#34;$key&#34; &#34;$task&#34; → surface_nonterminal_stale, else handle_paused_stale. Sites: :2568 (busy), :4479 (first-sight paused)), and add the same branch to the stable paused) arm at :4493. That last one also covers the hash-change route, because :4546 leaves sf=h and the next poll lands in that arm. Until lines keep handle_paused_stale's cadence, and an already-alarmed declaration stays throttled, so the existing dialog test's silent second run still holds. Add a test where the picker appears on a later run, and a busy-path test with an until line.
  • ℹ️ bin/fm-watch.sh:521 - window_busy_verdict copies each classifier call into 'with tail40' and 'without tail40' branches. Both fm_busy_classify (tail40=${6-}, bin/fm-busy-lib.sh:1128) and fm_busy_classify_meta (tail40=${4-}, :1318) treat an empty argument the same as a missing one. So always passing "$tail40" gives the same behavior and removes two of the four branches.
  • ℹ️ docs/architecture.md:118 - The doc says that when an unreadable lane's crew state later becomes readable (e.g. a parked gate), 'that declaration's one first-sight wake is still owed and fires'. The code does not do this for a paused: ... until &lt;time&gt; line: stale_wait_first_alarm_owed returns 1 for until lines (bin/fm-watch.sh:2729), so handle_paused_stale keeps absorbing until the declared time or the cadence, as the round-4 decision intends. Add the until exception to the sentence.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
A Codex lane (real CLI idle in lab tmux, real crew state unknown codex-unverified) declares paused: waiting for CI; the real watcher is restarted 6 times and the pane content changes between resta… ✅ pass live lab-new-tick-watcher.log: only the initial status signal, then 5 restarts with no wake; .paused-<key> kept and no .stale-since-<key>
Adversarial: after the wait was silently absorbed, the lane's run parks at a readable ask-user gate (crew state stubbed to parked · run-step in the same live lab). Expected: one stale wake, then no… ✅ pass live lab-new-parked-watcher.log: start #1 printed stale: fmlab:codexlane, start #2 had no wake in 15s
Confirmed Claude blocking dialog (on first sight, later, or on a busy over-age pane with a far until) still surfaces once, or keeps the cadence ✅ pass live tests/fm-watch-triage-pause.test.sh: a confirmed blocking dialog gets one first-sight wake at both pause gates, a blocking dialog that appears after a silent first sight surfaces once, `a busy dia…
  • bash tests/fm-watch-triage-pause.test.sh (34/34 ok, including the 5 new tests: unverified-codex cadence, parks-later, dialog at both gates, later dialog, busy dialog with far until)
  • Lab: bin/fm-lab-home.sh create $LAB + TMUX_TMPDIR=$LAB/tmux tmux -L fm-lab new-session -d -s fmlab -n codexlane codex (real Codex CLI idle at prompt)
  • Lab: FM_HOME=$LAB bin/fm-crew-state.sh lane -> state: unknown · source: pane · harness state unavailable (unknown codex-unverified)
  • Lab: real bin/fm-watch.sh with FM_HOME=$LAB, FM_POLL=2, FM_STALE_ESCALATE_SECS=8, restarted 6 times with the pane changing between restarts, drained and acked with the real bin/fm-wake-drain.sh
  • Lab: same 6-restart run against base commit bf05a4fc bin/ (git archive into the lab) for comparison
  • Lab: 2 more watcher starts with FM_CREW_STATE_BIN stubbed to state: parked · source: run-step (adversarial parked gate)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the remaining concern about slow checks is non-blocking.

Reviews (4) · Last reviewed commit: "no-mistakes(ci): Root cause: tests/fm-wa..." · Reviewed by Greptile

@zestysoft

Copy link
Copy Markdown
Contributor Author

Live validation remains inconclusive because measuring the monitor timing on a live system would disturb the records being measured, while a copied state directory cannot reproduce the live worker-endpoint and pane reads the classification depends on.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @zestysoft. An alarm that fires all night for a lane that declared its wait correctly is noise the captain shouldn't get, and the before/after test on df81d816 shows the restart path clearly. This is my first look, at head a95453a7 vs main 4e984c71.

What I checked: pause_runtime_unreadable in bin/fm-watch.sh, its use in pause_state_class, the new test_unverified_codex_declared_wait_keeps_pause_cadence (first run plus two successor restarts, no fast stale wake), and the docs line. The diff is small and safe to run (watcher, test, docs only). The quick checks pass, Greptile is 5/5 with no open threads, and the no-mistakes attestation binds this head with no skipped steps.

Contract-class: new-default. docs/architecture.md on main says the pause classification "is recovered only when the backend confidently reports its agent dead". This PR adds a second case: any lane whose busy verdict is unknown (codex-unverified, and per your own review note also kimi, rovo, agy, cursor, muse and missing records) now keeps the slow pause cadence instead of the first-sight alarm. That's a reasonable change, but it relaxes a documented alarm rule for every unconfigured home, so once it's ready it goes to Kun as a merge-or-leave decision.

Waiting on you: live evidence. I take your point that timing the monitor on your own live system would disturb what you're measuring. A disposable lab avoids that: bin/fm-live-lab.sh gives you a real tmux server and a real worker. A Codex (or other unknown-verdict) worker that posts paused: waiting for ..., plus a couple of watcher restarts, would show the alarm staying quiet, with the base commit as the contrast. #7996's live labs are a good template. Please post that, or re-raise through git push no-mistakes with it driven live.

VISION: aligns on peace of mind (no repeat noise for a declared wait) and on scripts owning the mechanics. The open point is "the interface must stay honest under load": an unknown verdict now leans on the worker's own declaration. The guard tests that still alarm on a live decision gate and on undeclared stale panes are what keep that honest, and the live run is the evidence for it.

(The red "Full suite" check is our label gate for outside PRs, not something you need to fix.)

@zestysoft

Copy link
Copy Markdown
Contributor Author

Live evidence, from disposable labs with a real Claude worker and the lab's fm-watch.sh run directly at a one-second poll. Both labs were torn down after capture.

New head - declared wait stays quiet

Raw monitor output for the already-recorded 20-second run:

<no output>

Raw wake queue:

<empty>

Guard A - live decision gate still alarms

monitor_exit=0
--- monitor ---
signal: /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.status /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.turn-ended

--- wake-queue ---
1793386505	1	signal	lab148110ca976d-worker.status	needs-decision: /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.status /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.turn-ended
1793386505	2	signal	lab148110ca976d-worker.turn-ended	signal: /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.status /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.turn-ended
1793386505	3	signal	lab148110ca976d-worker.status	needs-decision: /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.status /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.turn-ended
1793386505	4	signal	lab148110ca976d-worker.turn-ended	signal: /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.status /tmp/fmlab.pause-marker-final/home/state/lab148110ca976d-worker.turn-ended

Guard B - no declared wait still raises the fast stale alarm

monitor_exit=0
--- monitor ---
stale: firstmate:fm-lab148110ca976d-worker

--- wake-queue ---
1793386577	7	stale	firstmate:fm-lab148110ca976d-worker	stale: firstmate:fm-lab148110ca976d-worker

Base df81d8166aab83f328aa3a05516cbe21882d5e23 - declared wait alarms

monitor_exit=0
--- monitor ---
stale: firstmate:fm-labb5b7b393ec71-worker

--- wake-queue ---
1793386630	5	stale	firstmate:fm-labb5b7b393ec71-worker	stale: firstmate:fm-labb5b7b393ec71-worker

@zestysoft

Copy link
Copy Markdown
Contributor Author

Follow-up live evidence with a genuine Codex worker.

The worker was launched by fm-spawn.sh with --harness codex, default Codex model, and a brief that required it to append paused: for its gate. Its pane remained a live Codex TUI and the worker's current-state result was unknown.

With FM_POLL=1, FM_STALE_ESCALATE_SECS=1, and FM_BUSY_TURN_MAX_SECS=1, the watcher's state contains both .paused-firstmate_fm-lab5e84c07f0507-codex and .paused-rechecked-firstmate_fm-lab5e84c07f0507-codex after the direct run. That is the exact marker path this patch adds for unreadable runtime state.

After the initial status wake was drained, two direct watcher restarts produced no stale: row for the Codex worker. The lab also retained an earlier deliberately-invalid Codex launch, which was the only stale source in the raw output:

Restart 1:

monitor_exit=0
--- monitor ---
stale: firstmate:fm-lab5e84c07f0507-worker

--- wake-queue ---
1793866727	7	stale	firstmate:fm-lab5e84c07f0507-worker	stale: firstmate:fm-lab5e84c07f0507-worker

Restart 2:

monitor_exit=0
--- monitor ---
stale: firstmate:fm-lab5e84c07f0507-worker (idle 2s, possible wedge, escalation 1)

--- wake-queue ---
1793866750	8	stale	firstmate:fm-lab5e84c07f0507-worker	stale: firstmate:fm-lab5e84c07f0507-worker (idle 2s, possible wedge, escalation 1)

Neither restart emitted or queued stale: firstmate:fm-lab5e84c07f0507-codex; the declared Codex wait remained on the long cadence.

I did not obtain a clean Codex base-commit contrast before this follow-up. The original live base contrast in this PR uses the supported Claude lab worker. The disposable lab helper itself supports only Claude or Pi, so the Codex worker had to be created through a manual normal fm-spawn.sh path inside the lab; its initial stale invalid-model worker contaminated the monitor transcript. I am recording that limitation rather than presenting the Claude base run as Codex evidence.

@zestysoft

Copy link
Copy Markdown
Contributor Author

Codex base-commit contrast, completing the requested pair.

This used the same disposable lab shape as the new-head follow-up: a real Codex worker launched through fm-spawn.sh, which wrote paused: naming its gate and remained in a live Codex TUI. The lab checkout was df81d8166aab83f328aa3a05516cbe21882d5e23.

After the worker's initial status wake was drained, the direct monitor was restarted with the same short test cadence (FM_POLL=1, FM_STALE_ESCALATE_SECS=1, FM_BUSY_TURN_MAX_SECS=1). Unlike the new head, the base watcher raised the fast stale alarm for that exact Codex worker:

monitor_exit=0
--- monitor ---
stale: firstmate:fm-labcodexbase

--- wake-queue ---
1793867036	5	stale	firstmate:fm-labcodexbase	stale: firstmate:fm-labcodexbase

So the live Codex contrast is now complete: the base commit alarms for the declared wait, while the new head writes the pause recheck marker and does not alarm for that Codex worker over two restarts.

What remains unprovable here is whether every other unknown-verdict adapter has identical real-world pane behavior. The patch intentionally keys on the shared unknown semantic verdict, and the portable regression suite covers that classifier path; this lab establishes the requested real Codex instance only. The Full suite label gate remains untouched.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @zestysoft for the live labs, especially the real Codex worker and its base-commit contrast. That's exactly the unknown-verdict case this changes. On a95453a7, the new head keeps a declared wait on the slow pause cadence across restarts, while the base alarms. A live decision gate and an undeclared stale pane still alarm. The attestation binds this head with no skipped steps, the quick checks pass and Greptile is 5/5. I've added the full-ci label so the full suite runs. If it comes back green, this goes to Kun as a merge-or-leave decision, because it relaxes the documented "recovered only when the backend reports its agent dead" rule for every home. That decision is waiting on Kun, not on you.

@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 5, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @zestysoft, the full suite is green on a95453a7 (run 42054642997), so every gate on this head is now clear. Because this relaxes the documented "pause is recovered only when the backend reports its agent dead" rule for every home, it's a new-default change, and I've sent it to Kun as a merge-or-leave decision. That decision is waiting on Kun, not on you, so there's nothing more you need to do here.

@zestysoft
zestysoft force-pushed the fm/firstmate-pause-marker-unverified-pane branch from a95453a to aa4935a Compare November 7, 2026 07:37
Comment thread bin/fm-watch.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: tip moved after the waiting-captain stamp (a95453a7 → aa4935a5), and Require no-mistakes is now FAILURE on this head: attestation head_sha a95453a7 ≠ PR head aa4935a5 (MISMATCH after the later push). Per FM-FMOSS-SKIPGATE-01 that is not waived — a later push must not pass on an older attestation. Full suite is SUCCESS on the labelled tip, but the attestation gate blocks. Greptile is also FAILURE on this tip (open P1 "New picker stays hidden" on the Claude dialog path) — please address or reply on that thread when you re-raise.

Waiting on you: one clean git push no-mistakes re-raise that binds attestation to the current head (every step completed, no skips). Do not push a bare commit past an old attestation. After a bound tip lands we will re-check Greptile and Full.

Contract-class: new-default (unchanged from prior). Nothing further from our side until attestation binds again.

@zestysoft zestysoft changed the title fix(bin): keep the pause cadence for a declared wait when the pane state is unreadable fix(bin): keep declared-wait pause cadence for live panes with unreadable state Nov 7, 2026
Comment thread bin/fm-watch.sh
Comment on lines +2679 to +2684
if [ -e "$STATE/.paused-$key" ] && [ "$(age_of "$recheck_file")" -lt "$STALE_ESCALATE_SECS" ] \
&& { [ "$kind" = secondmate ] || [ "$agent_alive" = dead ]; }; then
printf 'paused'
return
fi
class=$(crew_absorb_class "$task")
[ -z "$task" ] || crew_line=$("$FM_CREW_STATE_BIN" "$task" 2>/dev/null) || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Waiting workers slow other checks

pause_state_class now calls FM_CREW_STATE_BIN every poll for a live worker with a declared wait, even when its pane and status have not changed. fm-crew-state.sh can make several no-mistakes reads, each with a default 10-second limit. If those reads are slow, several waiting workers delay checks for every other worker.

This is non-blocking, but keep a bounded recheck interval while preserving the new check for a run that becomes readable.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

…edge_cap_releases_after_declared_wait` failed ("declared-wait poll failed: stale: test:fm-wedge-cap-declared-wait"). "Full suite" failed only because that lane failed. In this test a live crew (crew state `paused · status-log`, so not unreadable) declares a plain `paused:` wait on an already-seen static hash. You decided earlier (round 3 parks-later decision, plus round 1/2 of this run) that the stable-hash `*)` arm must surface once when the declaration's first alarm is still owed. So the watcher now correctly raises one `stale:` wake and exits, by way of surface_nonterminal_stale. That path still writes .paused-<key> and calls wedge_episode_end, which clears the cap marker. The test still expected the old silent absorb: it used wait_poll_cycle, which needs the watcher to keep running. Invariant: a live declared wait with readable crew state raises its one owed first alarm, and any declared-wait route ends the wedge episode and releases the cap. The code already holds this at every site. Only this test assumed the old behavior. Fix (test only): the declared-wait step now waits for the watcher to exit on that one wake. It asserts the wake is a plain `stale: <window>` with no "possible wedge" or PERMANENTLY-WEDGED. Every existing check stays: .paused-<key> is written, the cap marker is cleared, the wait lift reconciles, and a re-wedge escalates from a fresh counter. Verified locally: `bash tests/fm-watch-wedge-cap.test.sh` passes all 23 cases, and shellcheck is clean. Nothing committed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @zestysoft, the re-raise clears what I asked for this morning. On head 542a86fc, the attestation binds this head with every step completed and none skipped, so the earlier mismatch is gone. Require no-mistakes, the coverage guard and repo invariants pass, and the Full suite is green (CI 42396813199). Greptile is 5/5: the "New picker stays hidden" P1 is resolved, and the remaining P2 about per-poll crew-state reads is non-blocking. The live lab run against current main (6 restarts with no stale wake on the declared wait, one wake when the run parks) and the dialog tests cover the new paths. The branch merges cleanly.

Because this changes the default supervision behavior for every home (a live pane with an unknown verdict and a declared wait keeps the pause cadence instead of the fast stale alarm), it's a new-default change. I've sent it to Kun as a merge-or-leave decision. That decision is waiting on Kun, not on you, so there's nothing more you need to do here.

@zestysoft

Copy link
Copy Markdown
Contributor Author

FYI for merge planning: this branch now conflicts with current main in bin/fm-watch.sh, after #8036, #8014 and #8236 landed there between 11-09 and 11-11. We have left the reviewed head 542a86fc untouched rather than rebasing unprompted. Say the word and we will rebase and re-raise through no-mistakes so the attestation and full suite cover the new head.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @zestysoft, and thanks for leaving 542a86fc untouched. Please don't rebase. Under our conflict rule, a merge conflict is ours to fix, never yours: if Kun says merge, I'll merge main into this branch myself, then get a fresh no-mistakes run and Full suite on that new head before landing it. This PR is still a captain-decision hold (new-default supervision change), so it's waiting on Kun, not on you, and there's nothing you need to do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Declared wait re-alarms as a stuck worker every few minutes after a watcher restart when pane state is unreadable

2 participants