Repository navigation
Conversation
[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 |
|
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. |
|
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 What I checked: Contract-class: new-default. 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: 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 (The red "Full suite" check is our label gate for outside PRs, not something you need to fix.) |
|
Live evidence, from disposable labs with a real Claude worker and the lab's New head - declared wait stays quietRaw monitor output for the already-recorded 20-second run: Raw wake queue: Guard A - live decision gate still alarmsGuard B - no declared wait still raises the fast stale alarmBase
|
|
Follow-up live evidence with a genuine Codex worker. The worker was launched by With After the initial status wake was drained, two direct watcher restarts produced no Restart 1: Restart 2: Neither restart emitted or queued 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 |
|
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 After the worker's initial status wake was drained, the direct monitor was restarted with the same short test cadence ( 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 |
|
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 |
|
Speaking as Kun's firstmate: thank you @zestysoft, the full suite is green on |
a95453a to
aa4935a
Compare
|
Speaking as Kun's firstmate: tip moved after the waiting-captain stamp ( Waiting on you: one clean Contract-class: new-default (unchanged from prior). Nothing further from our side until attestation binds again. |
| 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 |
There was a problem hiding this comment.
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
|
Speaking as Kun's firstmate: thank you @zestysoft, the re-raise clears what I asked for this morning. On head 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. |
|
FYI for merge planning: this branch now conflicts with current main in |
|
Speaking as Kun's firstmate: thank you @zestysoft, and thanks for leaving |
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_classinbin/fm-watch.shnow keeps the paused class for a live ordinary crew when two things are bothunknown: its crew state fromfm-crew-stateand its semantic busy verdict. So after a watcher restart, a worker that declaredpaused:orcaptain-heldstays on the longPAUSE_RESURFACE_SECScadence 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_classinbin/fm-classify-lib.sh. Busy-verdict lookup now uses a new helper,window_busy_verdict, shared bywindow_is_busy,unknown_alive_stale_boundand the new pause check.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. Apaused: ... 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.mdand the code comments now describe this exception.tests/fm-watch-triage-pause.test.shadds 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
unknowncrew state and anunknownbusy verdict (checked against the real fm-crew-state.sh, which printsunknown panefor an unknown busy verdict). The dialog and parks-later wakes go through stale_wait_first_alarm_owed, which leavesuntillines 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.
unknown codex-unverified) declarespaused: waiting for CI; the real watcher is restarted 6 times and the pane content changes between resta…parked · run-stepin the same live lab). Expected: one stale wake, then no…stale: fmlab:codexlane, start #2 had no wake in 15suntil) still surfaces once, or keeps the cadencea 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
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)
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
Evidence: Real Codex pane the watcher was watching
Source: Real Codex pane the watcher was watching
Evidence: Targeted pause test file output (34/34 ok)
Source: Targeted pause test file output (34/34 ok)
Evidence: New watcher restart transcript
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_classnoneintopaused(bin/fm-watch.sh:2711). crew_absorb_class (bin/fm-classify-lib.sh:2583) folds readable states intonone: fm-crew-state'sparked,failed,done,blocked. Concrete path: a codex worker writespaused: waiting for the pipeline, then its no-mistakes run parks at an ask-user gate. fm-crew-state printsstate: parked · source: run-step, so crew_absorb_class saysnone. The codex busy verdict is alwaysunknown codex-unverified, so pause_runtime_unreadable returns 0 at :2698 and the class becomespaused. 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_stalearm at bin/fm-watch.sh:4481 absorbs anonewhose 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 itselfunknown. 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 foruntillines and for an already-recordeddeclared:<sig>ordeclared:<sig>:duethrottle, 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 anunknownbusy verdict is classifiedpausedon 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 answersnonefor 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_classnoneintopaused(bin/fm-watch.sh:2711). crew_absorb_class (bin/fm-classify-lib.sh:2583) folds readable states intonone: fm-crew-state'sparked,failed,done,blocked. Concrete path: a codex worker writespaused: waiting for the pipeline, then its no-mistakes run parks at an ask-user gate. fm-crew-state printsstate: parked · source: run-step, so crew_absorb_class saysnone. The codex busy verdict is alwaysunknown codex-unverified, so pause_runtime_unreadable returns 0 at :2698 and the class becomespaused. 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_stalearm at bin/fm-watch.sh:4481 absorbs anonewhose 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 itselfunknown. 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 foruntillines and for an already-recordeddeclared:<sig>ordeclared:<sig>:duethrottle, 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 anunknownbusy verdict is classifiedpausedon 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 answersnonefor 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 anuntiltime. They also miss a picker that shows up after the first sight. Round 1's fix (f1a5dd1) added stale_wait_first_alarm_owed for thenonearm 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 <a time 1 year away, e.g. a wrong year>while the picker is on screen. Every over-age busy poll calls surface_nonterminal_stale. Itsnow < untilbranch 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 faruntilcannot 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 (:4546paused) handle_paused_stale) absorbs it, then every stable poll hits thepaused)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 "$dialog" ] && stale_wait_first_alarm_owed "$key" "$task"→ surface_nonterminal_stale, else handle_paused_stale. Sites: :2568 (busy), :4479 (first-sightpaused)), and add the same branch to the stablepaused)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 apaused: ... until <time>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.
unknown codex-unverified) declarespaused: waiting for CI; the real watcher is restarted 6 times and the pane content changes between resta…parked · run-stepin the same live lab). Expected: one stale wake, then no…stale: fmlab:codexlane, start #2 had no wake in 15suntil) still surfaces once, or keeps the cadencea 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: realbin/fm-watch.shwith 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 realbin/fm-wake-drain.shLab: same 6-restart run against base commit bf05a4fc bin/ (git archive into the lab) for comparisonLab: 2 more watcher starts with FM_CREW_STATE_BIN stubbed tostate: parked · source: run-step(adversarial parked gate)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.