Repository navigation
fix(bin): suppress redundant supervision wakes - #18
Merged
Merged
Conversation
Deterministic, script-only wake-noise suppression owned by bin/fm-wake-suppress-lib.sh, behind one switch (config/wake-noise-suppression) that defaults to shadow mode, where every decision is only logged to state/.watch-triage.log: - Repeat captain outcomes: fm-branch-outcome.sh append stores a captain outcome as routine when the task's newest captain outcome has the same fingerprint (task, digit-normalized wake, summary URLs) and the task's status log and recorded PR state (meta pr/pr_head, PR poll registration, merge-notified receipt) are unchanged. fm-branch-report.sh receipts carry the stored verdict, so the supervision host wakes main only for real captain rows. - Empty wakes: fm-wake-drain.sh --would-present answers read-only whether main's drain would present anything (queued rows, unread status, outcome backstop, open decisions, record divergence, captain branch outcomes). The watcher's rearm-resurface, the host's attended main-only pass-through, and the host-off Claude Stop-hook rewake retire an empty close's recovery episode with main's own acknowledgement and keep supervising instead. - BRANCH OUTCOMES now prints each task's current fm-crew-state line beside its captain outcome. Heartbeats, escalations, needs-decision and blocked events, failures, supervision-host lines, away or quiet records, stale-lock reclaims, and any unreadable evidence always reach main.
…le contract comments
… preserving fail-open suppression and uncommitted status receipts. Fixed both ShellCheck warnings. Wake-queue, remote-reply, suppression, and unread-status suites passed, along with pinned lint and diff checks. Shard 4’s timeout did not reproduce; its cause remains unconfirmed
… reproduced shard 5’s timing failure, aligning all related waits with the existing suite bound. Remote lifecycle, open-decisions, unread-status, suppression, pinned lint, syntax, and diff checks passed locally
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
I approve of the improvements 1-4 approach as recommended.
Context, item 1: keep no-op supervision wakes out of the main session. Evidence: data/env-retro-2026-10-10/report.md, and Fable's and Astra's reviews at data/fm-improve-xreview-fable/report.md (item 1, designs A, B and D) and data/fm-improve-xreview-astra/report.md (item 1). With the Claude supervision host running, main still gets about three wakes an hour, mostly (1) repeated captain outcomes that restate an unchanged state, such as "AP-1 PR still waiting on your merge decision" recorded twice, and (2) recovery announcements such as check: rearm-resurface with nothing queued. The approved approach is to build it in firstmate and propose it upstream later.
Substance of the referenced item 1 recommendations (approved as recommended):
What Changed
Risk Assessment
✅ Low: Suppression defaults to shadow mode, the current fixes preserve actionable evidence, and no additional material defects or intent contradictions were substantiated.
Testing
Focused checks and live CLI, Claude, and Pi scenarios passed after repairing two missing-backlog fixtures. Captured product transcripts and startup digests; isolated tmux sessions had no GUI surface for screenshots. Only the two test-fixture fixes remain in the worktree.
Evidence: Live outcome-store, presentation-probe, and divergence checks
Source: Live outcome-store, presentation-probe, and divergence checks
Evidence: Real Claude supervision-host delivery
Source: Real Claude supervision-host delivery
Evidence: Real Claude Stop-hook monitoring and decision delivery
Source: Real Claude Stop-hook monitoring and decision delivery
Evidence: Real Pi report responses and persisted verdicts
Source: Real Pi report responses and persisted verdicts
Evidence: Shadow-mode recovery remains visible
Source: Shadow-mode recovery remains visible
Evidence: Complete startup digest with suppression enabled
Source: Complete startup digest with suppression enabled
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 5 issues found → auto-fixed (3) ✅
bin/fm-wake-suppress-lib.sh:232- A new escalation can be downgraded to routine. With unchanged status/PR files and the same stale wake, a previous merge-wait summary and a new summary containing 'escalation 1' plus the same PR URL have identical fingerprints. Only the wake is checked for exemptions; summary prose is discarded. This contradicts 'never suppress needs-decision rows or anything carrying an escalation count.' Related sites: bin/fm-wake-suppress-lib.sh:186 ignores summary substance; bin/fm-branch-outcome.sh:556 changes the verdict; bin/fm-branch-report.sh:131 propagates it. Remove the summary-blind matching path and retain escalation/decision exemptions across the entire outcome. Normalizing every number at bin/fm-wake-suppress-lib.sh:184 also exceeds the idle-age matching needed for repeat suppression; narrow it to the changing age.bin/fm-wake-drain.sh:870- The empty-wake probe treats failed evidence reads as absence. For a resolved status key whose backlog task remains captain-held, a timeout in the divergence lookup is swallowed by print_record_divergence_section, so this call succeeds with empty output and the recovery wake can be suppressed. Other affected reads: bin/fm-wake-drain.sh:860 uses a snapshot that skips unreadable status files; :868 uses a decision scan that skips failed folds. Repeat evidence has the same problem at bin/fm-wake-suppress-lib.sh:195 and :200, where failed reads of pr/pr_head, poll data, and merge-notified contents are masked by the checksum pipeline. Propagate indeterminate reads at the shared readers and prohibit suppression unless every required record was successfully inspected.bin/fm-wake-drain.sh:864- The required 'check the drain’s presentation read-only' is not implemented consistently. With a status file, an outcome store, and missing outcome indexes, --would-present calls print_status_outcome_backstop_section, which invokes processed-init and persistently writes per-task indexes and .branch-outcome-index-ready. The added comment at bin/fm-wake-drain.sh:854 explicitly allows this write. Use a genuinely read-only coverage lookup, leaving index migration to the presenting drain.bin/fm-wake-suppress-lib.sh:230- Repeat suppression never calls fm_wake_suppress_away. A matching captain outcome appended while .afk-contract exists is therefore stored as routine, despite the new documented guarantee that away/quiet outcomes are exempt. The empty-wake path correctly checks this at bin/fm-wake-suppress-lib.sh:149, but the shared repeat path does not. Add the posture check before matching; it must cover bin/fm-branch-outcome.sh:549 for both host and Pi callers.bin/fm-wake-drain.sh:744- Current-state enrichment adds an independent 20-second wait for every presented task before printing the section. Seven tasks whose state readers time out can consume 140 seconds, exceeding fm-session-start.sh’s default 120-second total budget and truncating the startup digest before later recovery/context sections. Related sites: bin/fm-wake-drain.sh:685 serializes the reads; :744 applies only a per-task timeout. Bound the aggregate enrichment time and print unavailable state for remaining tasks when that budget expires.🔧 Fix applied.
5 issues (2 errors, 3 warnings) still open:
bin/fm-wake-drain.sh:870- The empty-wake probe treats failed evidence reads as absence. For a resolved status key whose backlog task remains captain-held, a timeout in the divergence lookup is swallowed by print_record_divergence_section, so this call succeeds with empty output and the recovery wake can be suppressed. Other affected reads: bin/fm-wake-drain.sh:860 uses a snapshot that skips unreadable status files; :868 uses a decision scan that skips failed folds. Repeat evidence has the same problem at bin/fm-wake-suppress-lib.sh:195 and :200, where failed reads of pr/pr_head, poll data, and merge-notified contents are masked by the checksum pipeline. Propagate indeterminate reads at the shared readers and prohibit suppression unless every required record was successfully inspected.bin/fm-wake-drain.sh:864- The required 'check the drain’s presentation read-only' is not implemented consistently. With a status file, an outcome store, and missing outcome indexes, --would-present calls print_status_outcome_backstop_section, which invokes processed-init and persistently writes per-task indexes and .branch-outcome-index-ready. The added comment at bin/fm-wake-drain.sh:854 explicitly allows this write. Use a genuinely read-only coverage lookup, leaving index migration to the presenting drain.bin/fm-wake-drain.sh:744- Current-state enrichment adds an independent 20-second wait for every presented task before printing the section. Seven tasks whose state readers time out can consume 140 seconds, exceeding fm-session-start.sh’s default 120-second total budget and truncating the startup digest before later recovery/context sections. Related sites: bin/fm-wake-drain.sh:685 serializes the reads; :744 applies only a per-task timeout. Bound the aggregate enrichment time and print unavailable state for remaining tasks when that budget expires.bin/fm-wake-drain.sh:399- Round 1's R3 fix introduced an extra coverage path for modern outcomes whose status capture failed. If an existing done status is temporarily unreadable during append, the stored row has statusEndpoint=0 and statusIdent="-". Once readability returns, this condition treats the status as covered whenever its unchanged mtime precedes the outcome epoch. With no queued rows, decisions, or unprocessed captain outcomes, the probe can suppress recovery even though the presenting drain's index leaves that status uncovered. This contradicts "every case whose evidence cannot be read" remaining actionable. Remove the added acceptance of modern "-" captures and revert to the minimal read-only equivalent of existing coverage semantics; timestamp inference belongs only to legacy rows missing capture fields. Related sites: bin/fm-wake-drain.sh:396 defaults missing identity to the same sentinel; :411 skips covered events; bin/fm-branch-outcome.sh:296 initializes failed captures; :353 limits existing legacy inference to absent fields.bin/fm-branch-outcome.sh:562- On Pi, an identical captain report can now be stored and delivered as routine, but fm_branch_report still returns "delivered [captain]" using the requested verdict. The actual delivery correctly reads the stored row, so the tool reports a wrong result without erroring. Read the stored verdict for the tool response, as the shell report path already does. Related sites: .pi/extensions/fm-branch-supervision.ts:1233 retains the requested verdict, :1173 dispatches the stored verdict, :1270 emits the incorrect label; bin/fm-branch-report.sh:131 handles the corresponding shell path.🔧 Fix applied.
1 warning still open:
bin/fm-branch-outcome.sh:562- On Pi, an identical captain report can now be stored and delivered as routine, but fm_branch_report still returns "delivered [captain]" using the requested verdict. The actual delivery correctly reads the stored row, so the tool reports a wrong result without erroring. Read the stored verdict for the tool response, as the shell report path already does. Related sites: .pi/extensions/fm-branch-supervision.ts:1233 retains the requested verdict, :1173 dispatches the stored verdict, :1270 emits the incorrect label; bin/fm-branch-report.sh:131 handles the corresponding shell path.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
TMPDIR="$PWD/.test-tmp" bash tests/fm-wake-noise-suppression.test.shSelected supervision-host tests: empty enforced recovery, shadow recovery, and refusal outside the lock ownerSelected Claude Stop-hook tests: empty enforced recovery and shadow recovery; reran successfully after adding missing disposable backlog fixturestest_branch_report_response_uses_stored_verdictwith the existing stubbed Pi SDK regression driverpython3 .test-tmp/live-cli.py: real public CLI calls against disposable marked homes, with persisted-output and read-only-state assertionsReal Claude interactive launch attempted on a private 120x36 tmux terminal; workspace trust prevented entry, so non-interactive normal-login launches were usedReal Claude supervision host and Stop hook: empty recovery followed by an injected keyed decisionReal Pi 0.87.1 with the tracked branch extension and a disposable public-dispatch probe: two actual model-driven report calls, asserting captain then routine receipts and stored verdictsReal watcher CLI in shadow mode on a private tmux socketReal Claude startup and competing-session startup; captured complete digests and verified the original lock owner remained unchangedStopped private lab sessions and lab-owned processes; removed temporary homes, runtime marker, selectors, and drivers✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.
Related prior work
Open upstream PRs that overlap this change: