Repository navigation
fix(bin): stop the repeating watcher recovery wake and stop reading a busy watcher as hung - #7205
Open
Marsjohn-11 wants to merge 11 commits into
Open
Marsjohn-11 wants to merge 11 commits into
Marsjohn-11 wants to merge 11 commits into
Conversation
…a busy watcher as hung Two faults in the same area left a 38-task home with no live watcher for stretches of hours while costing a supervision turn every few minutes. A watcher start that found an announced but unacknowledged downtime episode minted a fresh generation, which invalidated the acknowledgement the handling turn had already been given. Every turn then announced recovery, exited on that wake, and left nothing supervising in between. The reopen now keeps the episode's own generation, and an acknowledgement retires an episode once it has settled what was presented rather than waiting for an empty queue, which a busy home never reaches. A row appended during handling stays queued and resurfaces through its own wake. Separately, the liveness beacon was touched once per cycle while a cycle's work scales with the fleet, so cycles ran 300-1000s against a 300s grace. Arms then refused to attach to a live pid with a stale beacon, and the guard reported supervision as hung. The watcher now beats at each proven-progress point, so beacon age bounds progress rather than cycle turnover. That split the beacon's meaning from cycle turnover, which tests/fm-watch-triage.test.sh had been inferring from it: its cycle waits began returning inside the first fraction of a cycle and two CI shards failed. Turnover now has its own signal, state/.last-cycle-turnover, touched exactly once per cycle immediately before the terminal wait. Nothing may infer turnover from the beacon. Observable for consumers: state/.last-cycle-turnover is new durable state, documented in AGENTS.md. The beacon's meaning changed from per-cycle to per-progress-point; every existing reader uses it for freshness only, so no reader changed. Tests cover the turn-boundary re-arm between presentation and acknowledgement, a cycle whose beacon must keep advancing through a sweep longer than the grace, and the turnover marker bounded to exactly one touch per cycle. docs/verification/supervision.md holds the measurements. docs/watcher-continuity.md and docs/turnend-guard.md record the known limitations, including the check-timeout gap tracked as arm-guard-poll-derived-grace. This branch carries only this fix, nothing from PR 4488, which gets its own run.
The per-progress-point beat, the turnover marker, and the recovery-generation reopen are exercised by five specific cases. Record them with their observed output and why each one is the case that breaks if its contract regresses, so a later change to those contracts knows what to run. States the scoping rationale explicitly: targeted validation belongs to the no-mistakes evidence path while CI owns broad regression coverage across its nine sharded lanes, and running either enclosing suite whole here would duplicate that serially.
Owner
|
Speaking as Kun's firstmate: thank you @Marsjohn-11. The base reproductions (28s stale beacon, generation churn at T3) and the lab beacon drive make this easy to follow.
|
Owner
|
Speaking as Kun's firstmate: thanks @Marsjohn-11, the reworded Re-look at tip
The #7203 beacon overlap note still stands. |
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.
What Changed
_fm_recovery_marker_reopen_announcedinbin/fm-wake-lib.sh). This lets an acknowledgement that was already handed out land. Separately,bin/fm-wake-drain.shnow retires the episode when an acknowledgement settled what was presented: it consumed rows, or it had none to consume and no presented row waits above its cutoff. Together these stop the loop of one firstmate turn per recovery round. A stale acknowledgement still leaves the episode open.bin/fm-watch.shnow touches the liveness beacon at every progress point in a cycle (between reconciliation steps, before each check, at each scan phase, before each scanned window), not once per cycle. A large fleet's long cycle no longer looks like a wedged watcher. A newstate/.last-cycle-turnovermarker is touched once per cycle, just before the terminal wait. Only the tests read it, to wait for a cycle to finish.fm-claude-stop-autoarm.sh,fm-supervision-lib.shandfm-wake-lib.sh, and the docs (watcher-continuity.md,turnend-guard.md,verification/supervision.md, the operational-home-layout skill), to describe the new beacon cadence and retirement rule. Added and adjusted tests: a recovery-loop re-arm between presentation and acknowledgement, a check sweep longer than the grace that keeps the beacon fresh, and new episode-retirement expectations in the wake-queue, arm, triage and watcher-lock tests.Scope note
The late-append behaviour from the original #5421 was dropped to match main: a wake appended over an announced recovery episode still starts a fresh generation (#4819, #5489), so this PR does not make a row appended during handling leave the presented acknowledgement able to retire its episode. The same-generation reopen, the acknowledgement retirement rule and the per-progress-point beacon are kept. If you want the late-append behaviour too, the alternative is for an append over an announced downtime episode to reopen it pending on the same generation and rewrite main's characterization fixtures; say so and it can be added.
This PR and #7203 both add per-progress beacon touches in
bin/fm-watch.sh; whichever lands second reconciles them.Risk Assessment
Testing
The Test agent exceeded its invocation budget before live validation completed; no evidence was gathered for this head.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.