fix(watch): stop wedge-escalating a crew whose run is gone - #10
Merged
Merged
Conversation
added 2 commits
September 26, 2026 22:22
A stale pane absorbed as provably working starts a wedge timer. When the run later vanished (crew state unknown, latest status done:), the timer kept escalating 'possible wedge' every STALE_ESCALATE_SECS, and the repair path restarted it after each escalation. Re-confirm provable work where the idle-pane paths use the timer: at the threshold, a crew no longer working drops the timer and hash suppressor so the ordinary first-sight handling surfaces it once; when the timer is missing, a crew no longer working gets no new timer and the hash is marked settled. Busy-turn bound callers and genuinely working runs are unchanged.
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.
Intent
Stop the firstmate watcher from wedge-escalating a finished crew: once a crew's run is gone (latest status done:, crew state unknown), the wedge timer must stop, with at most the ordinary one-time stale surfacing and then quiet, while a genuinely working-and-frozen run still escalates and declared pauses are unchanged. PR #10 already exists for this branch.
What Changed
wedge_timer_checkinbin/fm-watch.shtakes a newreverifyargument, passed by both stale-pane call sites. With it set, the watcher re-reads crew state before starting a wedge timer or escalating on one. If the crew is no longer provably working (for example adone:status with unknown crew state), no timer is started. An already-expired timer is dropped along with the hash suppressor, so the next poll classifies the hash afresh. The finished crew then surfaces at most once through the ordinary stale path and stays quiet. A crew that is still provably working and frozen escalates as before, andpaused:handling is unchanged..stale-settled-<key>marker records the hash that was found no longer provably working. While it matches the current stale hash, later polls return early without re-reading crew state. Every place that clears stale or pause tracking (handle_paused_stale,clear_stale_hash_tracking, and the busy-pane resets) now also removes it.tests/fm-watch-triage.test.shadds two cases, one for adone:status and one for a non-terminal status. Each drives working absorb (timer starts), then run gone at the threshold, then the same hash staying quiet.docs/architecture.mdgains a short note on the wedge timer's crew-state gate.Risk Assessment
✅ Low: The change is bounded to the wedge-timer path in fm-watch.sh. The reverify flag is passed only from the two call sites that started a timer on run evidence, and declared-pause and busy-turn callers are unchanged. The added tests exercise both status shapes through working, run-gone and quiet phases by running the watcher.
Testing
I drove the real bin/fm-watch.sh as a subprocess through a filtered copy of tests/fm-watch-triage.test.sh (19 tests). It covers the two new working-then-gone cases, plus the genuine-wedge, declared-pause, busy-turn, timer-repair and write-deferral regressions, and all passed on the fix. Against the base watcher the new done-run-gone test fails with a "possible wedge, escalation 1" wake, so it reproduces the bug. I stopped there and did not run the quiet-run-gone case against base. The filtered copy is removed and the worktree is clean.
Evidence: Fixed watcher: filtered triage tests, all ok
Source: Fixed watcher: filtered triage tests, all ok
Evidence: Base watcher: new done-run-gone test fails with a wedge wake
Source: Base watcher: new done-run-gone test fails with a wedge wake
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/zz-filtered.test.sh(temporary filtered copy of tests/fm-watch-triage.test.sh, 19 tests, all ok, about 81s)Base-watcher run of the two new tests withgit show 3ce7f05:bin/fm-watch.shswapped in: done-run-gone fails with a wedge escalation (fail-before-fix confirmed), then the fixed file was restored✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.