Repository navigation
fix(bin): keep a live agent's declared pause on the bounded recheck cadence - #31
Merged
Merged
Conversation
…adence pause_state_class forced `none` whenever an ordinary crew's agent was alive, even after .paused-<key> already proved this window took its one-time live-agent surface. A ticking harness footer changes the raw pane hash on most polls, so once the fast-path recheck window expired the classifier fell back to `none` again, and the stale path bare- surfaces that verdict and re-primes .paused-<key> for the very next churn cycle - repeating forever. Liveness now only gates the FIRST sight of a declared pause; once known-paused, only crew_absorb_class returning `working` lifts it, matching the dead-agent and secondmate cases that already used the bounded PAUSE_RESURFACE_SECS cadence. Co-Authored-By: Claude Sonnet 5 <[email protected]>
alandomio
added a commit
that referenced
this pull request
Sep 26, 2026
…hourly (#37) * fix(bin): stop re-surfacing a declared pause whose situation has not changed A declared pause re-surfaced "confirm the wait still holds" every FM_PAUSE_RESURFACE_SECS forever, although nothing about the worker had changed, and a busy turn on a paused worker re-fired its one-time live-agent surface for the same pause line. The watcher now records the pause's situation at each surface - the status log's size:mtime, the agent's liveness (never read for a secondmate), and a digest of the pane tail with digits and blanks removed - and compares it at each due recheck. An unchanged situation is absorbed into the triage log until FM_PAUSE_REMIND_SECS (default one day) has passed since the last surface; an exited agent, new pane text such as a dialog, or a new status line surfaces at that recheck with the change named. The same pause line no longer takes a second one-time surface after a busy turn. #31's guarantee is kept: a live agent's declared pause never falls back to wedge detection. * no-mistakes(review): Keep surfacing dead paused workers on every recheck * no-mistakes(document): Align architecture wake inventory with absorbed pause rechecks --------- Co-authored-by: Alan Domio <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the watcher's pause classifier in
bin/fm-watch.shso a still-alive worker's declaredpaused:status stays on the bounded long-cadence recheck even while its pane content changes on every poll (a ticking status-line clock, a live token counter). Previously, once the classifier's one-time "just surfaced" state expired, a live agent's declared pause fell back to an unclassified verdict on every hash change, so the stale-pane path bare-surfaced it again and again.Why it matters: a worker genuinely waiting on an external dependency (an upstream release, a rate-limit reset) was getting flagged with an undecorated "stale" wake every few minutes instead of the intended once-per-cadence recheck - indistinguishable from a real wedge, and noisy enough to train the reader to ignore it.
Root cause:
pause_state_classtreated a live agent's aliveness as proof its declared pause needed re-confirming, and reset that confirmation to "unclassified" on every check regardless of whether the pause had already been recorded once. A pane whose last lines change on most polls (any live TUI footer) hits that reset constantly, so it never settled into the long recheck cadence a dead agent's or a secondmate's pause already used. Two fix shapes were possible: normalize the pane hash to ignore the footer, or fix the classifier. Hash normalization alone would not have been enough - the classifier would still discard its "already paused" state on the next occasion the hash happened to repeat across two polls, which is also part of the originally reported pattern. This MR takes the classifier-gate fix: liveness now only gates the first sighting of a declared pause (no prior record for that window); once recorded, only positive evidence that the crew resumed work lifts it. Dead agents and secondmates already worked this way - this brings a live agent's pause in line with them.This is a self-contained classifier change: no config knobs added, no cadence defaults changed, and behavior for a dead agent, an actively-working run-step, and an undeclared idle pane is unchanged (pinned by existing tests).
Change
bin/fm-watch.shpause_state_class: liveness no longer forces the pause to reset once a window has already recorded one; only the crew being provably back at work lifts ittests/fm-watch-triage.test.shdocs/architecture.mdValidation
stale: <window>wake; the same scenario against the fix produced only the decorated recheck wording, bounded to the cadence.tests/fm-watch-triage.test.shsuite green, including the pre-existing cases for a dead agent's pause, an actively-working run-step, and an undeclared idle pane.bin/fm-lint.shclean.Follow-ups / out of scope
PAUSE_RESURFACE_SECS/STALE_ESCALATE_SECSdefaults are unchanged by design; this is a classifier correctness fix, not a retuning.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-watch-triage.test.sh:1163- Intent criterion 4 requires 'Comments in changed code: max 3 lines each'. Two comments in the diff exceed it: the new test's header comment at tests/fm-watch-triage.test.sh:1163-1171 is 9 lines (a root-cause narrative that belongs in the PR description), and the modified pause_state_class header comment at bin/fm-watch.sh:489-492 is 4 lines. The remedy is trimming comment text only, but since it is a stated required criterion and the author chose this wording deliberately, flagging for confirmation rather than editing prose silently.bin/fm-watch.sh:508- The new comment at bin/fm-watch.sh:507-509 says 'only crew_absorb_class=working lifts the pause', but the fast path immediately below (known_paused=1 and .paused-rechecked younger than STALE_ESCALATE_SECS) returnspausedwithout consulting crew_absorb_class at all. Concretely: a live crew already known-paused whose run-step starts working while its log still ends inpaused:is reportedpausedfor up to STALE_ESCALATE_SECS (240s default) after each recheck stamp before the caller at bin/fm-watch.sh:1244 can switch it to the wedge timer. This is the same bounded delay a dead crew or secondmate already had and is not a regression on the incident path, but the comment should say 'once per STALE_ESCALATE_SECS' rather than implying an unconditional check.🔧 Fix: trim pause classifier comments to 3 lines, fix cadence wording
1 info still open:
bin/fm-watch.sh:521- The newknown_paused -eq 0guard treats any existing .paused-<key> as proof the window already took its one-time live-agent surface, but handle_paused_stale also primes that flag from the busy-pane path (busy_turn_bound_check at line 470, for a paused: crew whose busy pane crossed BUSY_TURN_MAX_SECS). Concrete trace: live crew declares paused:, pane stays busy past the bound -> .paused-<key> written with no surface; agent finishes the call and the pane goes idle-stable -> pause_state_class now returnspaused(liveness never read) instead of the pre-fixnonebare surface. The captain still gets the decorated recheck on the PAUSE_RESURFACE_SECS cadence anchored on status mtime, so nothing rots invisibly and no wedge is silenced (a declared pause was already exempt from wedge escalation). Noting the tradeoff only; it is consistent with the intent's 'liveness gates the first sight (no .paused-<key> yet)' definition and needs no change.✅ **Test** - passed
✅ No issues found.
test_nonterminal_stale_paused_live_churning_hash_uses_bounded_cadence(new test) on target 18c59cc: passtest_nonterminal_stale_paused_live_churning_hash_uses_bounded_cadencerun against agit archiveof base c0974ec's bin/fm-watch.sh: fails (round 1 (churning hash) never rechecked the declared pause- base silently clears the pause marker instead of rechecking)Existing pins on target:test_exited_declared_pause_is_bounded_but_live_gate_surfaces,test_nonterminal_stale_paused_absorbed_then_resurfaced,test_nonterminal_stale_not_working_surfaced,test_paused_authoritative_working_preserves_wedge_timer,test_busy_declared_pause_is_rechecked_not_wedge_escalated,test_nonterminal_paused_rechecks_authoritative_state,test_secondmate_paused_resurfaces_in_normal_mode,test_secondmate_nonpaused_stale_remains_suppressed,test_afk_paused_changed_pane_hands_off_plain_stale: all passManual incident repro: real fm-watch.sh subprocess with fake tmux whose pane footer ticks every 4 polls, liveclaudepane command,paused:status, pre-seeded.paused-<key>; base wakes with barestale: test:fm-churn, target wakes with the decoratedpaused Ns, awaiting external - declared pause, rechecked on a long cadence not a wedge; confirm the wait still holdsreason (wording unchanged), verified in both stdout and the durable wake queue via fm-wake-drain.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.