fix: prevent duplicate away-mode completion escalations - #11
Merged
Conversation
The away-mode catch-all scan only consulted .subsuper-seen-status-*, so a done: line firstmate already handled via always-on (.hb-surfaced-*) was re-escalated when afk started. Honour both markers in the scan without promoting hb into subsuper-seen, so the signal path still delivers.
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 away-mode catch-all scan re-escalating completions already handled through the normal signal path (or already surfaced to firstmate).
Defect (observed 2026-08-02): while afk was active, the daemon's catch-all fleet scan re-escalated the same done: lines already handled — three separate completions each waking firstmate a second time. Root cause: catch-all only consulted .subsuper-seen-status-* (written by the daemon escalate path). Always-on firstmate handling only sets .hb-surfaced-, so when afk started, historical done: lines firstmate already saw were re-escalated. The per-wake signal escalate path already marked .subsuper-seen-status- correctly; the gap was the always-on / hb-surfaced path.
Fix (narrow, 2 files): In bin/fm-supervise-daemon.sh, status_line_already_seen checks both .subsuper-seen-status-* and .hb-surfaced-*; catch-all uses it. Does NOT promote hb into subsuper-seen (watcher marks hb before the daemon signal path; promoting would make classify_signal self-handle without delivering). Tests in tests/fm-daemon.test.sh: signal-then-scan no re-fire (existing), scan-first still escalates (existing), new test that hb-only historical done is not re-escalated by catch-all while signal path still escalates.
Acceptance: completion escalated via signal path not re-escalated by catch-all; completion scan first sees still escalated; existing away-mode classification tests stay green. Scope fence: only the named scripts and their tests (~2 files); no backend adapters, AGENTS.md, docs/, skills/, CI, install scripts.
What Changed
Risk Assessment
✅ Low: Captain, the two-file change is narrowly scoped and preserves the signal-first, scan-first, and hb-surfaced deduplication invariants without suppressing the daemon signal path.
Testing
Exact-commit and scope preflight passed; focused daemon and watcher-to-supervisor lifecycle tests passed without skips, and the evidence transcript demonstrated signal-first deduplication, scan-first escalation, and hb-only catch-all suppression with signal delivery preserved. Two evidence-harness setup attempts were corrected before the successful transcript.
Evidence: AFK duplicate-escalation acceptance transcript
All scenarios report PASS: signal→scan remained one escalation; scan-first escalated once; hb-only history was skipped by catch-all while the signal path still escalated.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.
Exact-commit, merge-base, clean-worktree, and two-file scope preflight usinggit status,git rev-parse,git merge-base, andgit diffbin/fm-test-run.sh tests/fm-daemon.test.sh tests/fm-wake-daemon-lifecycle-e2e.test.shProduction-function acceptance scenarios exercisinghandle_wakeandhousekeeping, recorded inafk-dedup-behavior.txt🔧 **Document** - 1 issue found → auto-fixed ✅
bin/fm-classify-lib.sh:403- The shared scanner comment says daemon dedup uses only.subsuper-seen-status-*, but the catch-all now also uses.hb-surfaced-*. Fixing this third script would violate the two-file scope fence.🔧 Fix: Correct catch-all dedup owner comment
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.