Repository navigation
fix(bin): stop each keyed answer from re-waking this home - #4907
Conversation
Self-announced bookkeeping appends now record their exact byte ranges. Later drains and signal scans skip those ranges, so two distinct --resolve-key answers after an OPEN DECISIONS fold do not each wake the supervisor. Worker-authored lines outside that ledger still signal.
…decisions still wake
Keep the home-appends ledger so this home's own --resolve-key answers do not each wake the supervisor, and keep fold-lag from substituting for watcher classification. Take main's multi-line self-announced append so one answer can close several keys in one write. Conflicts resolved in bin/fm-wake-lib.sh, docs/architecture.md, and tests/fm-watch-triage.test.sh.
…ent to its function
# Conflicts: # bin/fm-wake-lib.sh
…mped-line assertions
… home-appends ledger
|
Speaking as Kun's firstmate: First look. Main What I inspected
VISION.md (each rule)
contract-class: restore (concrete existing default wake path for self-announced multi-decision answers was specified by expected behavior / #4885 and broken). Still blocked on NM test completion — no auto-merge until NM green. Security FYI (not waiting-captain): wake-only sidecar; fails closed toward waking; no workflow/secret changes. |
|
Following up on #4907 (comment) The waiting-author item from that 2026-09-20T10:23Z triage is done. HEAD is now |
|
Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this. Contract-class: restore. Tip vs main: home-owned append ledger ( |
Intent
Fixes #4885
Observed: on the self-announce / fold-cursor path for supervisor status appends (related to #4767), two different answers that each carry a distinct
--resolve-keystill each wake the supervisor once. OPEN DECISIONS / fold-cursor lag can absorb some same-turn noise, but separate answer events still produce separate wakes. Covering the ordinary multi-decision flow without residual wakes appears to need a durable record of which byte ranges this home itself appended, so later drains can treat those ranges as already-owned, not only lag verbs on unread status lines. This is separate from lag treating a workerresolvedas already-read (narrower defect under #4767).Expected: when this home answers multiple open keyed decisions in one supervision handling turn (or in rapid succession), the supervisor is not woken once per answer solely because each answer appended a status line. Worker-authored appends that are not this home's own answers must still signal.
How to verify: open two keyed decisions; answer each with a distinct
--resolve-keyin the same handling turn (or back-to-back); confirm answer appends do not each force a new captain-facing wake while true worker signals remain audible.What Changed
bin/fm-classify-lib.sh(state/.<task>.home-appends, plus its serializing lock):status_home_appends_recordpersists the exact half-open byte range of every self-announced append, coalescing a new range that starts where the last ended, andstatus_home_appends_coverswalks those ascending ranges to prove a span is entirely this home's own growth. An identity mismatch discards the ledger, andstatus_retire_presentation_tasknow retires the ledger and its lock during teardown.bin/fm-wake-lib.sh: the old signature-only check is nowfm_wake_signal_reported_currentand stays the gate for the historical annotation, whilefm_wake_signal_seen_currentadditionally treats growth past the watcher's classified offset as already seen when every grown byte is in the ledger.fm_wake_status_append_self_announcedrecords its appended range before advancing the marker, so separate--resolve-keycloses no longer each force a wake; any signature change without owned growth, and any worker-authored line outside the recorded ranges, still wakes. Presentation is untouched, so those lines still print in the signal annotation and UNREAD STATUS.--resolve-keyanswers staying quiet with and without a covering seen marker, a later worker line past the recorded ranges still waking, a folded worker decision with no home append still waking, owned growth still producing a turn-ended annotation, and an unreadable log still reading as unreported; updatedAGENTS.md,docs/architecture.md, anddocs/scripts.mdto describe the new state file and the ledger's wake-only scope.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The new owned-append ledger is well-bounded and fails toward waking in every uncertainty branch I traced (gap in coverage, unreadable/symlinked/absent file, identity mismatch, truncation, unrecordable range), the presentation path is provably unchanged because
fm_wake_signal_reported_currentis byte-identical to the pre-change predicate, and the only production consumer of the widened predicate isfm-watch.sh'sscan_signals.Testing
I stood the product up as an operator would - a throwaway FM_HOME under /tmp driven by the real fm-watch.sh watcher process, the real fm-send.sh --resolve-key answer path and the real fm-wake-drain.sh presentation - and reproduced the exact state the issue describes: the supervisor answers two keyed decisions while the watcher's classification for an unrelated worker note is still in flight, so the watcher's seen marker commits behind the answers. On the branch the two answers pass a full watcher poll cycle in silence, a following worker
blocked:line still wakes, and bothresolved [key=...]answers are still printed to the captain by the drain; on the base commit the identical driver fails that quiet cycle, which is the reported defect. Three adversarial runs tried to make the new ledger absorb something it must not - a worker line landing between the two answers, a status log rotated onto a new inode with byte-identical content, and a status log turned unreadable after owned growth - and all three still woke the supervisor. The branch's own regression test also fails on the base commit and passes here. Two behaviours were exercised only through the repository's own test files and never driven against a live product instance, so I report them as untested: task-teardown cleanup of the home-appends ledger, and a folded worker decision this home never answered still waking the watcher. I ran three of the four touched test files to completion; for tests/fm-watch-triage.test.sh I deliberately stopped the whole-file run after ~30 minutes and 55 passing assertions with no failures, and instead ran its two new tests individually through that file's own FM_TEST_ONLY hook - broad regression on that file belongs to remote CI. There is no GUI surface here: the captain-facing surface is terminal output, so the evidence is the wake lines and drain transcripts rather than screenshots.not ok - the first --resolve-key answer was left to re-wake this home)signal: <STATE>/t1.statusresolved [key=k1]: answered: go with RESTandresolved [key=k2]: answered: use eu-west, and the final drain shows both keys gone from OPEN DECISIO…Evidence: Live end-to-end run on the branch - all driven scenarios pass
Source: Live end-to-end run on the branch - all driven scenarios pass
Evidence: Same driver on base commit a09090d - reproduces the bug (S3 fails)
Source: Same driver on base commit a09090d - reproduces the bug (S3 fails)
Evidence: Live adversarial runs: interleaved worker line, rotated log, unreadable log
Source: Live adversarial runs: interleaved worker line, rotated log, unreadable log
Evidence: Branch regression test fails on the base commit
Source: Branch regression test fails on the base commit
Evidence: Re-runnable live end-to-end driver
Source: Re-runnable live end-to-end driver
Evidence: Re-runnable live adversarial driver
Source: Re-runnable live adversarial driver
Evidence: Evidence guide (what each file proves, how to re-run)
Source: Evidence guide (what each file proves, how to re-run)
Evidence: The one-line before/after difference
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
bin/fm-classify-lib.sh:1515- The change defines the ledger's path scheme twice.status_home_appends_path(bin/fm-classify-lib.sh:1962) derives<dir>/.<task>.home-appendsfrom a status-file path, butstatus_retire_presentation_taskre-derives the same string inline as"$state/.$task.home-appends"(and"$home_appends.lock"), in the early-exit existence guard, in therm -flist, and in thefm_lock_remove_pathcall. The two copies agree today, so nothing is broken now. The reason it is worth folding: teardown before task-ID reuse is exactly the path the ledger's correctness depends on -test_retired_task_id_starts_new_status_unreadexists because a reused ID that inherits stale presentation state is a real failure mode - and if the path scheme ever moves, the helper-based reader/writer would follow it while this inline copy silently stopped deleting the sidecar and its lock. Narrower form: callstatus_home_appends_path "$state/$task.status"once and derive the lock from it, the way the sibling marker paths already go throughstatus_signal_seen_marker_path. (Note the adjacent.open-decisions-cursoris inlined the same way, so this matches local idiom; the remedy is a one-line consistency fix, not a redesign.)✅ **Test** - passed
✅ No issues found.
not ok - the first --resolve-key answer was left to re-wake this home)signal: <STATE>/t1.statusresolved [key=k1]: answered: go with RESTandresolved [key=k2]: answered: use eu-west, and the final drain shows both keys gone from OPEN DECISIO…~/.no-mistakes/evidence/01M2Z4D16Q9S0RADH5H31CAP6E/driver-live-e2e.sh <branch-worktree> <workdir>- live watcher + fm-send --resolve-key + drain, branch head 0992f93 (all driven scenarios pass)driver-live-e2e.sh <base-tree-of-a09090d> <workdir>- same driver on the base commit (S3 fails: the answers re-wake the supervisor)driver-live-adversarial.sh <branch-worktree> <workdir> interleave|rotate|unreadable- three live attempts to make the owned-append ledger swallow something it must notbin/fm-test-run.sh tests/fm-send-resolve-key.test.sh tests/fm-wake-drain-unread-status.test.sh(exit 0)bin/fm-test-run.sh tests/fm-wake-queue.test.sh(exit 0, 46 assertions)FM_TEST_ONLY=test_folded_worker_decision_without_home_append_still_wakes bash tests/fm-watch-triage.test.sh(exit 0)FM_TEST_ONLY=test_separate_self_announced_answers_after_fold_wake_once bash tests/fm-watch-triage.test.sh(exit 0)bash tests/fm-send-resolve-key.test.shagainst a base-commit tree with only the branch's test file copied in (exit 1:not ok - the first --resolve-key answer was left to re-wake this home)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.