Skip to content

fix(bin): stop each keyed answer from re-waking this home - #4907

Merged
kunchenguid merged 16 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm4885
Sep 22, 2026
Merged

kunchenguid merged 16 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/fm4885

Conversation

@tiago-peixoto

@tiago-peixoto tiago-peixoto commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

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-key still 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 worker resolved as 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-key in 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

  • Added a durable per-task home-owned append ledger in bin/fm-classify-lib.sh (state/.<task>.home-appends, plus its serializing lock): status_home_appends_record persists the exact half-open byte range of every self-announced append, coalescing a new range that starts where the last ended, and status_home_appends_covers walks those ascending ranges to prove a span is entirely this home's own growth. An identity mismatch discards the ledger, and status_retire_presentation_task now retires the ledger and its lock during teardown.
  • Split the wake predicate from the presentation predicate in bin/fm-wake-lib.sh: the old signature-only check is now fm_wake_signal_reported_current and stays the gate for the historical annotation, while fm_wake_signal_seen_current additionally treats growth past the watcher's classified offset as already seen when every grown byte is in the ledger. fm_wake_status_append_self_announced records its appended range before advancing the marker, so separate --resolve-key closes 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.
  • Added tests covering two distinct --resolve-key answers 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; updated AGENTS.md, docs/architecture.md, and docs/scripts.md to 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_current is byte-identical to the pre-change predicate, and the only production consumer of the widened predicate is fm-watch.sh's scan_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 both resolved [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.

  • Live validation: ✅ go - 7 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Supervisor answers two distinct --resolve-key decisions in one handling turn; a full watcher poll cycle passes with no wake and no durable wake record ✅ pass live live-e2e-after-fix.log scenario S3 (real bin/fm-watch.sh + two real bin/fm-send.sh --resolve-key answers); ledger shows the coalesced owned range 115-230 against classified-offset 115
The reported defect reproduces on the base commit: the same two answers re-wake the supervisor ✅ pass live live-e2e-before-fix-base-commit.log S3 FAIL, and regression-test-fails-on-base.log (not ok - the first --resolve-key answer was left to re-wake this home)
A worker-authored blocked: line appended after both answers still wakes the supervisor ✅ pass live live-e2e-after-fix.log scenario S4 - watcher exits with signal: &lt;STATE&gt;/t1.status
Both of this home's own answers are still printed to the captain by the drain (owned ranges are never hidden from presentation) ✅ pass live live-e2e-after-fix.log scenario S5 - drain prints resolved [key=k1]: answered: go with REST and resolved [key=k2]: answered: use eu-west, and the final drain shows both keys gone from OPEN DECISIO…
Adversarial: a worker line landing BETWEEN two owned answers is not absorbed by the surrounding owned ranges ✅ pass live live-adversarial.log A1 - ledger records two separate ranges (115-173, 207-264) rather than coalescing over the worker's bytes; the watcher wakes and the drain presents the worker line
Adversarial: a status log rotated onto a new inode with byte-identical content does not reuse the stale ledger ✅ pass live live-adversarial.log A2 - quiet before rotation, wakes after it
Adversarial: a status log turned unreadable after owned growth still surfaces instead of reading as already seen ✅ pass live live-adversarial.log A3 - quiet baseline, then chmod 000 produces a signal wake
Task teardown deletes the home-appends ledger and its lock, so a reused task id starts clean ⏸️ untested no The prior payload did not establish a live result: this was only exercised through the repository's own test (tests/fm-wake-drain-unread-status.test.sh, test_retired_task_id_starts_new_status_unread),…
A folded worker decision this home never answered still wakes the watcher (fold is not proof of being seen) ⏸️ untested no The prior payload did not establish a live result: this was only exercised through the repository's own watcher test (FM_TEST_ONLY=test_folded_worker_decision_without_home_append_still_wakes bash test…
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


=== S1  worker opens two keyed decisions -> the supervisor is woken
PASS  watcher surfaced the worker's decisions: signal: <STATE>/t1.status
--- OPEN DECISIONS as the captain sees them ---
OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
t1 [key=k1] needs-decision: pick REST or RPC
t1 [key=k2] needs-decision: pick us-east or eu-west
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'

=== S2  the supervisor answers BOTH keys in one handling turn, while the

===     watcher's classification for an unrelated worker note is in flight
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=115 file-size=230
    home-appends ledger: v1 ident=strong:33:7869029:2026-09-20 10:22:59.967456724 +0000 115	230 

=== S3  the two answers alone must NOT wake the supervisor again
PASS  a full watcher poll cycle passed with no wake over this home's own answers

=== S4  a worker-authored line after the answers must still wake
PASS  watcher surfaced the worker's blocked line: signal: <STATE>/t1.status

=== S5  the answers are still presented to the captain (never hidden)
    drain| 1789899796	4	signal	t1.status	signal: <STATE>/t1.status
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: working: still building
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: resolved [key=k1]: answered: go with REST
    drain| wake annotation: latest wake-EVENT observed at drain, not current state: t1.status: resolved [key=k2]: answered: use eu-west
PASS  both owned answers still appear in the captain-facing status presentation
    final| 1789899805	6	signal	t1.status	signal: <STATE>/t1.status
    final| wake annotation: latest wake-EVENT observed at drain, not current state: t1.status: blocked: need staging credentials
    final| OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
    final| t1 blocked: need staging credentials
    final| OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
PASS  the worker's blocked line is presented too

===== RESULT: ALL-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)


=== S1  worker opens two keyed decisions -> the supervisor is woken
PASS  watcher surfaced the worker's decisions: signal: <STATE>/t1.status
--- OPEN DECISIONS as the captain sees them ---
OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
t1 [key=k1] needs-decision: pick REST or RPC
t1 [key=k2] needs-decision: pick us-east or eu-west
OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'

=== S2  the supervisor answers BOTH keys in one handling turn, while the

===     watcher's classification for an unrelated worker note is in flight
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=115 file-size=230
    home-appends ledger: 

=== S3  the two answers alone must NOT wake the supervisor again
FAIL  the answers woke the watcher (it exited): signal: <STATE>/t1.status

=== S4  a worker-authored line after the answers must still wake
PASS  watcher surfaced the worker's blocked line: signal: <STATE>/t1.status

=== S5  the answers are still presented to the captain (never hidden)
    drain| 1789899829	4	signal	t1.status	signal: <STATE>/t1.status
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: working: still building
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: resolved [key=k1]: answered: go with REST
    drain| wake annotation: latest wake-EVENT observed at drain, not current state: t1.status: resolved [key=k2]: answered: use eu-west
PASS  both owned answers still appear in the captain-facing status presentation
    final| 1789899834	6	signal	t1.status	signal: <STATE>/t1.status
    final| wake annotation: latest wake-EVENT observed at drain, not current state: t1.status: blocked: need staging credentials
    final| OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
    final| t1 blocked: need staging credentials
    final| OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
PASS  the worker's blocked line is presented too

===== RESULT: SCENARIO-FAILURE =====
Evidence: Live adversarial runs: interleaved worker line, rotated log, unreadable log

Source: Live adversarial runs: interleaved worker line, rotated log, unreadable log


=== A1  a worker line landing BETWEEN two owned answers must still wake
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| blocked: need staging credentials
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=115 file-size=264 ledger=[115	173 207	264 ]
PASS  the interleaved worker blocker still woke the supervisor
    drain| 1789900035	4	signal	t1.status	signal: <STATE>/t1.status
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: working: still building
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: resolved [key=k1]: answered: go with REST
    drain| wake annotation: unread wake-EVENT since last drain, not current state: t1.status: blocked: need staging credentials
    drain| wake annotation: latest wake-EVENT observed at drain, not current state: t1.status: resolved [key=k2]: answered: use eu-west
    drain| OPEN DECISIONS (still open, folded from the durable status logs - not just the latest line):
    drain| t1 blocked: need staging credentials
    drain| OPEN DECISIONS: close one by answering it: bin/fm-send.sh <task> --resolve-key <key> '<answer>'
PASS  the interleaved worker blocker is presented to the captain

===== RESULT: ADVERSARIAL-PASS =====

=== A2  a rotated status file (new identity, same bytes) must not reuse the ledger
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=115 file-size=230 ledger=[115	230 ]
PASS  baseline: the owned answers alone stay quiet
    rotated the status log onto a new inode, byte-identical content
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=0 file-size=230 ledger=[115	230 ]
    (watcher woke with: check: rearm-resurface  - acknowledging and re-checking)
PASS  the rotated log wakes: the ledger is not replayed against a new identity

===== RESULT: ADVERSARIAL-PASS =====

=== A3  an unreadable status log after owned growth must still wake
    status| needs-decision [key=k1]: pick REST or RPC
    status| needs-decision [key=k2]: pick us-east or eu-west
    status| working: still building
    status| resolved [key=k1]: answered: go with REST
    status| resolved [key=k2]: answered: use eu-west
    classified-offset=115 file-size=230 ledger=[115	230 ]
PASS  baseline: the owned answers alone stay quiet
    the status log is now mode 000 (unreadable)
    (watcher woke with: check: rearm-resurface  - acknowledging and re-checking)
PASS  the unreadable log surfaces instead of being absorbed as owned

===== RESULT: ADVERSARIAL-PASS =====
Evidence: Branch regression test fails on the base commit

Source: Branch regression test fails on the base commit

# The branch's own regression test, run against the BASE commit (a09090d) with
# only tests/fm-send-resolve-key.test.sh copied in from the branch.
$ bash tests/fm-send-resolve-key.test.sh
ok - fm-send --resolve-key: the answer send itself closes the open decision
ok - fm-send --resolve-key: the close never re-wakes its own home, later lines still do
not ok - the first --resolve-key answer was left to re-wake this home
exit=1
Evidence: Re-runnable live end-to-end driver

Source: Re-runnable live end-to-end driver

#!/usr/bin/env bash
# Live end-to-end driver for firstmate issue #4885.
# Drives the REAL bin/fm-watch.sh watcher, the REAL bin/fm-send.sh --resolve-key
# answer path, and the REAL bin/fm-wake-drain.sh presentation against a throwaway
# FM_HOME. Usage: e2e.sh <repo-root> <work-dir>
set -u
ROOT=$1
WORK=$2
rm -rf "$WORK"; mkdir -p "$WORK"
HOME_DIR="$WORK/home"; STATE="$HOME_DIR/state"; FB="$WORK/fakebin"
mkdir -p "$STATE" "$FB"
WATCH="$ROOT/bin/fm-watch.sh"; SEND="$ROOT/bin/fm-send.sh"; DRAIN="$ROOT/bin/fm-wake-drain.sh"
STATUS="$STATE/t1.status"
FAIL=0
say() { printf '\n=== %s\n' "$*"; }
ok()  { printf 'PASS  %s\n' "$*"; }
bad() { printf 'FAIL  %s\n' "$*"; FAIL=1; }

# --- harness seams -----------------------------------------------------------
# tmux stub: the only thing standing in for a real terminal multiplexer.
cat > "$FB/tmux" <<'SH'
#!/usr/bin/env bash
set -u
case "${1:-}" in
  send-keys)
    shift; literal=0
    while [ $# -gt 0 ]; do
      case "$1" in -t) shift 2 ;; -l) literal=1; shift ;; *) break ;; esac
    done
    [ "$literal" = 1 ] && printf '%s' "${1:-}" >> "${FM_SEND_LOG:-/dev/null}"
    exit 0 ;;
  display-message)
    for a in "$@"; do case "$a" in *cursor_y*) printf '1\n'; exit 0 ;; esac; done
    printf '\n'; exit 0 ;;
  capture-pane) printf '(idle)\n'; exit 0 ;;
  list-windows) printf '%s\n' fm-t1; exit 0 ;;
esac
exit 0
SH
chmod +x "$FB/tmux"
# fm-crew-state seam (FM_CREW_STATE_BIN): the watcher calls this to decide whether
# a crew is provably working. The real one makes a bounded no-mistakes call that
# takes real time; FM_FAKE_CREW_SLEEP reproduces that latency so the answers can
# land inside the watcher's real classify-then-commit window.
cat > "$FB/fm-crew-state.sh" <<'SH'
#!/usr/bin/env bash
set -u
printf '%s\n' "${1:-}" >> "${FM_CREW_STATE_LOG:-/dev/null}"
[ -n "${FM_FAKE_CREW_SLEEP:-}" ] && sleep "$FM_FAKE_CREW_SLEEP"
printf '%s\n' "${FM_FAKE_CREW_STATE:-state: unknown · source: none · idle worker}"
exit 0
SH
chmod +x "$FB/fm-crew-state.sh"

printf 'window=sess:fm-t1\nkind=ship\n' > "$STATE/t1.meta"

watch_bg() {  # <out> [extra env assignments...]
  local out=$1; shift
  env PATH="$FB:$PATH" FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" \
    FM_CREW_STATE_BIN="$FB/fm-crew-state.sh" FM_POLL=1 FM_SIGNAL_GRACE=1 \
    FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 "$@" "$WATCH" > "$out" 2>>"$WORK/watch.err" &
}
wait_exit() { local pid=$1 n=${2:-150} i=0
  while [ $i -lt $n ]; do kill -0 "$pid" 2>/dev/null || { wait "$pid" 2>/dev/null; return 0; }; sleep 0.1; i=$((i+1)); done
  return 1; }
reap() { kill "$1" 2>/dev/null || true; wait "$1" 2>/dev/null || true; }
poll_cycle() {  # <pid>: wait for one full watcher poll cycle; 1 if it exited
  local pid=$1 beat="$STATE/.last-watcher-beat" first now i=0
  rm -f "$beat"
  while [ $i -lt 300 ]; do kill -0 "$pid" 2>/dev/null || return 1
    first=$(stat -c %Y "$beat" 2>/dev/null); [ -n "$first" ] && break; sleep 0.1; i=$((i+1)); done
  while [ $i -lt 300 ]; do kill -0 "$pid" 2>/dev/null || return 1
    now=$(stat -c %Y "$beat" 2>/dev/null)
    [ -n "$now" ] && [ "$now" != "$first" ] && return 0
    sleep 0.1; i=$((i+1)); done
  return 1; }
drain_ack() {  # [<out-file>]
  local out=${1:-/dev/null} err="$WORK/ack.err" seq gen
  FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" >"$out" 2>"$err" || return 1
  seq=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through \([0-9][0-9]*\) --recovery-generation \([A-Za-z0-9._-]*\)$/\1/p' "$err")
  gen=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through [0-9][0-9]* --recovery-generation \([A-Za-z0-9._-]*\)$/\1/p' "$err")
  [ -n "$seq" ] && [ -n "$gen" ] || return 0
  FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" --ack-through "$seq" --recovery-generation "$gen" >/dev/null 2>&1
}
send_answer() {  # <key> <text>
  env PATH="$FB:$PATH" FM_GATE_REFUSE_BYPASS=1 FM_ROOT_OVERRIDE="$HOME_DIR" FM_HOME="$HOME_DIR" \
    FM_SEND_LOG="$WORK/send.log" FM_SEND_SETTLE=0 "$SEND" t1 --resolve-key "$1" "$2" >>"$WORK/send.out" 2>>"$WORK/send.err"
}

# --- scenario ---------------------------------------------------------------
say "S1  worker opens two keyed decisions -> the supervisor is woken"
{ printf 'needs-decision [key=k1]: pick REST or RPC\n'
  printf 'needs-decision [key=k2]: pick us-east or eu-west\n'; } > "$STATUS"
watch_bg "$WORK/w1.out"; pid=$!
if wait_exit "$pid" && grep -qF "signal: $STATUS" "$WORK/w1.out"; then
  ok "watcher surfaced the worker's decisions: $(grep -m1 signal: "$WORK/w1.out")"
else reap "$pid"; bad "watcher never surfaced the worker's two decisions"; fi
drain_ack || bad "could not drain+ack the decisions wake"
printf '%s\n' "--- OPEN DECISIONS as the captain sees them ---"
FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" 2>/dev/null | sed -n '/OPEN DECISIONS/,$p'

say "S2  the supervisor answers BOTH keys in one handling turn, while the"
say "    watcher's classification for an unrelated worker note is in flight"
printf 'working: still building\n' >> "$STATUS"
: > "$WORK/crew.log"
watch_bg "$WORK/w2.out" FM_CREW_STATE_LOG="$WORK/crew.log" FM_FAKE_CREW_SLEEP=6
pid=$!
i=0; while [ $i -lt 200 ]; do [ -s "$WORK/crew.log" ] && break; sleep 0.1; i=$((i+1)); done
[ -s "$WORK/crew.log" ] || bad "the watcher never reached its crew-state evidence call"
send_answer k1 "go with REST"  || bad "the first --resolve-key answer failed"
send_answer k2 "use eu-west"   || bad "the second --resolve-key answer failed"
wait_exit "$pid" 200 || { reap "$pid"; bad "the watcher did not finish its in-flight cycle"; }
drain_ack "$WORK/drain-after-answers.out" || bad "could not drain+ack the in-flight cycle"
sed -E 's/ \[at=[0-9]+\]//' "$STATUS" | sed 's/^/    status| /'
printf '    classified-offset=%s file-size=%s\n' \
  "$(FM_STATE_OVERRIDE="$STATE" bash -c '. "$1"; fm_wake_signal_seen_size "$2" "$3"' _ "$ROOT/bin/fm-wake-lib.sh" "$STATE" "$STATUS")" \
  "$(wc -c < "$STATUS" | tr -d ' ')"
printf '    home-appends ledger: %s\n' "$(cat "$STATE/.t1.home-appends" 2>/dev/null | tr '\n' ' ' || echo '(none)')"

say "S3  the two answers alone must NOT wake the supervisor again"
: > "$WORK/w3.out"
watch_bg "$WORK/w3.out"; pid=$!
if poll_cycle "$pid"; then
  if [ -s "$WORK/w3.out" ]; then bad "the answers re-woke the supervisor: $(cat "$WORK/w3.out")"
  elif [ -s "$STATE/.wake-queue" ]; then bad "the answers enqueued a durable wake: $(cat "$STATE/.wake-queue")"
  else ok "a full watcher poll cycle passed with no wake over this home's own answers"; fi
else bad "the answers woke the watcher (it exited): $(cat "$WORK/w3.out")"; fi

say "S4  a worker-authored line after the answers must still wake"
printf 'blocked: need staging credentials\n' >> "$STATUS"
if wait_exit "$pid" 200 && grep -qF "signal: $STATUS" "$WORK/w3.out"; then
  ok "watcher surfaced the worker's blocked line: $(grep -m1 signal: "$WORK/w3.out")"
else reap "$pid"; bad "the worker's blocked line was swallowed: $(cat "$WORK/w3.out")"; fi

say "S5  the answers are still presented to the captain (never hidden)"
out="$WORK/drain-after-answers.out"
sed -E 's/ \[at=[0-9]+\]//' "$out" | sed 's/^/    drain| /'
if sed -E 's/ \[at=[0-9]+\]//' "$out" | grep -qF 'resolved [key=k1]: answered: go with REST' \
  && sed -E 's/ \[at=[0-9]+\]//' "$out" | grep -qF 'resolved [key=k2]: answered: use eu-west'; then
  ok "both owned answers still appear in the captain-facing status presentation"
else bad "an owned answer was hidden from the captain-facing presentation"; fi
final="$WORK/drain-final.out"
FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" > "$final" 2>/dev/null
sed -E 's/ \[at=[0-9]+\]//' "$final" | sed 's/^/    final| /'
if sed -E 's/ \[at=[0-9]+\]//' "$final" | grep -qF 'blocked: need staging credentials'; then
  ok "the worker's blocked line is presented too"
else bad "the worker's blocked line was not presented"; fi

printf '\n===== RESULT: %s =====\n' "$([ $FAIL -eq 0 ] && echo ALL-SCENARIOS-PASS || echo SCENARIO-FAILURE)"
exit $FAIL
Evidence: Re-runnable live adversarial driver

Source: Re-runnable live adversarial driver

#!/usr/bin/env bash
# Live ADVERSARIAL driver for firstmate issue #4885: actively tries to make the
# owned-append ledger swallow something it must never swallow.
# Drives the REAL bin/fm-watch.sh watcher, the REAL bin/fm-send.sh --resolve-key
# answer path, and the REAL bin/fm-wake-drain.sh presentation against a throwaway
# FM_HOME. Usage: e2e.sh <repo-root> <work-dir>
set -u
ROOT=$1
WORK=$2
rm -rf "$WORK"; mkdir -p "$WORK"
HOME_DIR="$WORK/home"; STATE="$HOME_DIR/state"; FB="$WORK/fakebin"
mkdir -p "$STATE" "$FB"
WATCH="$ROOT/bin/fm-watch.sh"; SEND="$ROOT/bin/fm-send.sh"; DRAIN="$ROOT/bin/fm-wake-drain.sh"
STATUS="$STATE/t1.status"
FAIL=0
say() { printf '\n=== %s\n' "$*"; }
ok()  { printf 'PASS  %s\n' "$*"; }
bad() { printf 'FAIL  %s\n' "$*"; FAIL=1; }

# --- harness seams -----------------------------------------------------------
# tmux stub: the only thing standing in for a real terminal multiplexer.
cat > "$FB/tmux" <<'SH'
#!/usr/bin/env bash
set -u
case "${1:-}" in
  send-keys)
    shift; literal=0
    while [ $# -gt 0 ]; do
      case "$1" in -t) shift 2 ;; -l) literal=1; shift ;; *) break ;; esac
    done
    [ "$literal" = 1 ] && printf '%s' "${1:-}" >> "${FM_SEND_LOG:-/dev/null}"
    exit 0 ;;
  display-message)
    for a in "$@"; do case "$a" in *cursor_y*) printf '1\n'; exit 0 ;; esac; done
    printf '\n'; exit 0 ;;
  capture-pane) printf '(idle)\n'; exit 0 ;;
  list-windows) printf '%s\n' fm-t1; exit 0 ;;
esac
exit 0
SH
chmod +x "$FB/tmux"
# fm-crew-state seam (FM_CREW_STATE_BIN): the watcher calls this to decide whether
# a crew is provably working. The real one makes a bounded no-mistakes call that
# takes real time; FM_FAKE_CREW_SLEEP reproduces that latency so the answers can
# land inside the watcher's real classify-then-commit window.
cat > "$FB/fm-crew-state.sh" <<'SH'
#!/usr/bin/env bash
set -u
printf '%s\n' "${1:-}" >> "${FM_CREW_STATE_LOG:-/dev/null}"
[ -n "${FM_FAKE_CREW_SLEEP:-}" ] && sleep "$FM_FAKE_CREW_SLEEP"
printf '%s\n' "${FM_FAKE_CREW_STATE:-state: unknown · source: none · idle worker}"
exit 0
SH
chmod +x "$FB/fm-crew-state.sh"

printf 'window=sess:fm-t1\nkind=ship\n' > "$STATE/t1.meta"

watch_bg() {  # <out> [extra env assignments...]
  local out=$1; shift
  env PATH="$FB:$PATH" FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" \
    FM_CREW_STATE_BIN="$FB/fm-crew-state.sh" FM_POLL=1 FM_SIGNAL_GRACE=1 \
    FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 "$@" "$WATCH" > "$out" 2>>"$WORK/watch.err" &
}
wait_exit() { local pid=$1 n=${2:-150} i=0
  while [ $i -lt $n ]; do kill -0 "$pid" 2>/dev/null || { wait "$pid" 2>/dev/null; return 0; }; sleep 0.1; i=$((i+1)); done
  return 1; }
reap() { kill "$1" 2>/dev/null || true; wait "$1" 2>/dev/null || true; }
poll_cycle() {  # <pid>: wait for one full watcher poll cycle; 1 if it exited
  local pid=$1 beat="$STATE/.last-watcher-beat" first now i=0
  rm -f "$beat"
  while [ $i -lt 300 ]; do kill -0 "$pid" 2>/dev/null || return 1
    first=$(stat -c %Y "$beat" 2>/dev/null); [ -n "$first" ] && break; sleep 0.1; i=$((i+1)); done
  while [ $i -lt 300 ]; do kill -0 "$pid" 2>/dev/null || return 1
    now=$(stat -c %Y "$beat" 2>/dev/null)
    [ -n "$now" ] && [ "$now" != "$first" ] && return 0
    sleep 0.1; i=$((i+1)); done
  return 1; }
drain_ack() {  # [<out-file>]
  local out=${1:-/dev/null} err="$WORK/ack.err" seq gen
  FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" >"$out" 2>"$err" || return 1
  seq=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through \([0-9][0-9]*\) --recovery-generation \([A-Za-z0-9._-]*\)$/\1/p' "$err")
  gen=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through [0-9][0-9]* --recovery-generation \([A-Za-z0-9._-]*\)$/\1/p' "$err")
  [ -n "$seq" ] && [ -n "$gen" ] || return 0
  FM_STATE_OVERRIDE="$STATE" FM_ROOT_OVERRIDE="$HOME_DIR" "$DRAIN" --ack-through "$seq" --recovery-generation "$gen" >/dev/null 2>&1
}
send_answer() {  # <key> <text>
  env PATH="$FB:$PATH" FM_GATE_REFUSE_BYPASS=1 FM_ROOT_OVERRIDE="$HOME_DIR" FM_HOME="$HOME_DIR" \
    FM_SEND_LOG="$WORK/send.log" FM_SEND_SETTLE=0 "$SEND" t1 --resolve-key "$1" "$2" >>"$WORK/send.out" 2>>"$WORK/send.err"
}

# --- adversarial scenarios ---------------------------------------------------
# Shared setup: the supervisor has handled the worker's open decisions once, so
# the watcher's classified offset sits at the end of them.
open_decisions_and_handle() {  # <lines...>
  printf '%s\n' "$@" > "$STATUS"
  watch_bg "$WORK/w0.out"; pid=$!
  wait_exit "$pid" || { reap "$pid"; bad "setup: watcher never surfaced the worker's decisions"; }
  drain_ack "$WORK/drain0.out" || bad "setup: could not drain+ack"
}
# Answer keys while the watcher's classification for an unrelated worker note is
# in flight, optionally running <hook> between the answers.
answer_during_inflight() {  # <hook-or-:> <key> <text> [<key> <text>...]
  local hook=$1; shift
  printf 'working: still building\n' >> "$STATUS"
  : > "$WORK/crew.log"
  watch_bg "$WORK/w1.out" FM_CREW_STATE_LOG="$WORK/crew.log" FM_FAKE_CREW_SLEEP=8
  ipid=$!
  local i=0; while [ $i -lt 200 ]; do [ -s "$WORK/crew.log" ] && break; sleep 0.1; i=$((i+1)); done
  [ -s "$WORK/crew.log" ] || bad "the watcher never reached its crew-state evidence call"
  send_answer "$1" "$2" || bad "answer $1 failed"; shift 2
  "$hook"
  while [ $# -gt 1 ]; do send_answer "$1" "$2" || bad "answer $1 failed"; shift 2; done
  wait_exit "$ipid" 250 || { reap "$ipid"; bad "the in-flight watcher cycle never finished"; }
  drain_ack "$WORK/drain1.out" || bad "could not drain+ack the in-flight cycle"
}
# Start a watcher and require a status-file signal wake. A watcher that was
# killed (not exited) leaves a downtime marker, so the next one legitimately
# wakes once with "check: rearm-resurface" first; acknowledge that and retry.
expect_signal_wake() {  # <out> <label>
  local out=$1 label=$2 try=0 pid
  while [ $try -lt 3 ]; do
    : > "$out"; watch_bg "$out"; pid=$!
    if ! wait_exit "$pid" 250; then reap "$pid"; bad "$label: the watcher never woke"; return 1; fi
    if grep -qF "signal: $STATUS" "$out"; then ok "$label"; return 0; fi
    printf '    (watcher woke with: %s - acknowledging and re-checking)\n' "$(tr '\n' ' ' < "$out")"
    drain_ack "$WORK/resurface.out" || true
    try=$((try + 1))
  done
  bad "$label: the status change never surfaced as a signal"
  return 1
}

show_state() {
  sed -E 's/ \[at=[0-9]+\]//' "$STATUS" | sed 's/^/    status| /'
  printf '    classified-offset=%s file-size=%s ledger=[%s]\n' \
    "$(FM_STATE_OVERRIDE="$STATE" bash -c '. "$1"; fm_wake_signal_seen_size "$2" "$3"' _ "$ROOT/bin/fm-wake-lib.sh" "$STATE" "$STATUS")" \
    "$(wc -c < "$STATUS" | tr -d ' ')" \
    "$(tail -n +3 "$STATE/.t1.home-appends" 2>/dev/null | tr '\n' ' ')"
}

case "${3:-interleave}" in
interleave)
  say "A1  a worker line landing BETWEEN two owned answers must still wake"
  open_decisions_and_handle 'needs-decision [key=k1]: pick REST or RPC' \
    'needs-decision [key=k2]: pick us-east or eu-west'
  worker_writes() { printf 'blocked: need staging credentials\n' >> "$STATUS"; }
  answer_during_inflight worker_writes k1 "go with REST" k2 "use eu-west"
  show_state
  expect_signal_wake "$WORK/w2.out" "the interleaved worker blocker still woke the supervisor"
  sed -E 's/ \[at=[0-9]+\]//' "$WORK/drain1.out" | sed 's/^/    drain| /'
  grep -qF 'blocked: need staging credentials' "$WORK/drain1.out" \
    && ok "the interleaved worker blocker is presented to the captain" \
    || bad "the interleaved worker blocker never reached the captain-facing presentation"
  ;;
rotate)
  say "A2  a rotated status file (new identity, same bytes) must not reuse the ledger"
  open_decisions_and_handle 'needs-decision [key=k1]: pick REST or RPC' \
    'needs-decision [key=k2]: pick us-east or eu-west'
  answer_during_inflight : k1 "go with REST" k2 "use eu-west"
  show_state
  : > "$WORK/w2.out"; watch_bg "$WORK/w2.out"; pid=$!
  poll_cycle "$pid" && ok "baseline: the owned answers alone stay quiet" \
    || bad "baseline: the owned answers woke the watcher"
  reap "$pid"
  cp "$STATUS" "$WORK/rot"; rm -f "$STATUS"; mv "$WORK/rot" "$STATUS"
  printf '    rotated the status log onto a new inode, byte-identical content\n'
  show_state
  expect_signal_wake "$WORK/w3.out" "the rotated log wakes: the ledger is not replayed against a new identity"
  ;;
unreadable)
  say "A3  an unreadable status log after owned growth must still wake"
  if [ "$(id -u)" -eq 0 ]; then ok "skipped: running as root, mode-000 is still readable"; exit 0; fi
  open_decisions_and_handle 'needs-decision [key=k1]: pick REST or RPC' \
    'needs-decision [key=k2]: pick us-east or eu-west'
  answer_during_inflight : k1 "go with REST" k2 "use eu-west"
  show_state
  : > "$WORK/w2.out"; watch_bg "$WORK/w2.out"; pid=$!
  poll_cycle "$pid" && ok "baseline: the owned answers alone stay quiet" \
    || bad "baseline: the owned answers woke the watcher"
  reap "$pid"
  chmod 000 "$STATUS"
  printf '    the status log is now mode 000 (unreadable)\n'
  expect_signal_wake "$WORK/w3.out" "the unreadable log surfaces instead of being absorbed as owned"
  chmod 600 "$STATUS"
  ;;
esac

printf '\n===== RESULT: %s =====\n' "$([ $FAIL -eq 0 ] && echo ADVERSARIAL-PASS || echo ADVERSARIAL-FAILURE)"
exit $FAIL
Evidence: Evidence guide (what each file proves, how to re-run)

Source: Evidence guide (what each file proves, how to re-run)

# Live validation evidence - firstmate #4885 (branch fm/fm4885)

Everything here was produced by driving the real product in a throwaway `FM_HOME`
under `/tmp`: the real `bin/fm-watch.sh` watcher process, the real
`bin/fm-send.sh --resolve-key` answer path, and the real `bin/fm-wake-drain.sh`
captain-facing presentation.
No live fleet, no real `FM_HOME`, no Herdr session was touched.

The only stand-ins are the two seams the product already exposes for this:
a `tmux` stub on `PATH` and the `FM_CREW_STATE_BIN` crew-state reader.
`FM_FAKE_CREW_SLEEP` makes that reader take real time, which is how the real
watcher behaves (it makes a bounded no-mistakes call there) and what opens the
window in which the supervisor's answers land between the watcher's
classification and its seen-marker commit.
That window is the state the issue describes.

## Files

| file | what it shows |
| --- | --- |
| `live-e2e-before-fix-base-commit.log` | the bug, on base commit `a09090d`: scenario S3 FAILS - the two `--resolve-key` answers alone re-wake the supervisor |
| `live-e2e-after-fix.log` | the same driver on the branch head `0992f93`: S3 passes, S4 (worker line still wakes) and S5 (answers still presented) pass |
| `live-adversarial.log` | three attempts to make the ledger swallow something it must not: an interleaved worker line, a rotated status log, an unreadable status log |
| `regression-test-fails-on-base.log` | the branch's own `test_separate_resolve_key_answers_do_not_rewake` run against the base commit: `not ok` |
| `driver-live-e2e.sh`, `driver-live-adversarial.sh` | the drivers, so a reviewer can re-run them: `./driver-live-e2e.sh <repo-root> <workdir>` |

## The one-line difference

Same driver, same throwaway home, same six steps.

`` `
base  a09090d : S3  FAIL  the answers woke the watcher (it exited): signal: <STATE>/t1.status
branch 0992f93: S3  PASS  a full watcher poll cycle passed with no wake over this home's own answers
`` `

In both runs the answers are still printed to the captain by the drain
(`wake annotation: ... resolved [key=k1]: answered: go with REST`), which is the
"do not hide owned ranges from presentation" constraint holding.
Evidence: The one-line before/after difference
base a09090d : S3 FAIL the answers woke the watcher (it exited): signal: <STATE>/t1.status
branch 0992f93 : S3 PASS a full watcher poll cycle passed with no wake over this home's own answers

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

⚠️ **Review** - 1 info
  • ℹ️ 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 &lt;dir&gt;/.&lt;task&gt;.home-appends from a status-file path, but status_retire_presentation_task re-derives the same string inline as &#34;$state/.$task.home-appends&#34; (and &#34;$home_appends.lock&#34;), in the early-exit existence guard, in the rm -f list, and in the fm_lock_remove_path call. 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_unread exists 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: call status_home_appends_path &#34;$state/$task.status&#34; once and derive the lock from it, the way the sibling marker paths already go through status_signal_seen_marker_path. (Note the adjacent .open-decisions-cursor is 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.

  • Live validation: ✅ go - 7 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Supervisor answers two distinct --resolve-key decisions in one handling turn; a full watcher poll cycle passes with no wake and no durable wake record ✅ pass live live-e2e-after-fix.log scenario S3 (real bin/fm-watch.sh + two real bin/fm-send.sh --resolve-key answers); ledger shows the coalesced owned range 115-230 against classified-offset 115
The reported defect reproduces on the base commit: the same two answers re-wake the supervisor ✅ pass live live-e2e-before-fix-base-commit.log S3 FAIL, and regression-test-fails-on-base.log (not ok - the first --resolve-key answer was left to re-wake this home)
A worker-authored blocked: line appended after both answers still wakes the supervisor ✅ pass live live-e2e-after-fix.log scenario S4 - watcher exits with signal: &lt;STATE&gt;/t1.status
Both of this home's own answers are still printed to the captain by the drain (owned ranges are never hidden from presentation) ✅ pass live live-e2e-after-fix.log scenario S5 - drain prints resolved [key=k1]: answered: go with REST and resolved [key=k2]: answered: use eu-west, and the final drain shows both keys gone from OPEN DECISIO…
Adversarial: a worker line landing BETWEEN two owned answers is not absorbed by the surrounding owned ranges ✅ pass live live-adversarial.log A1 - ledger records two separate ranges (115-173, 207-264) rather than coalescing over the worker's bytes; the watcher wakes and the drain presents the worker line
Adversarial: a status log rotated onto a new inode with byte-identical content does not reuse the stale ledger ✅ pass live live-adversarial.log A2 - quiet before rotation, wakes after it
Adversarial: a status log turned unreadable after owned growth still surfaces instead of reading as already seen ✅ pass live live-adversarial.log A3 - quiet baseline, then chmod 000 produces a signal wake
Task teardown deletes the home-appends ledger and its lock, so a reused task id starts clean ⏸️ untested no The prior payload did not establish a live result: this was only exercised through the repository's own test (tests/fm-wake-drain-unread-status.test.sh, test_retired_task_id_starts_new_status_unread),…
A folded worker decision this home never answered still wakes the watcher (fold is not proof of being seen) ⏸️ untested no The prior payload did not establish a live result: this was only exercised through the repository's own watcher test (FM_TEST_ONLY=test_folded_worker_decision_without_home_append_still_wakes bash test…
  • ~/.no-mistakes/evidence/01M2Z4D16Q9S0RADH5H31CAP6E/driver-live-e2e.sh &lt;branch-worktree&gt; &lt;workdir&gt; - live watcher + fm-send --resolve-key + drain, branch head 0992f93 (all driven scenarios pass)
  • driver-live-e2e.sh &lt;base-tree-of-a09090d&gt; &lt;workdir&gt; - same driver on the base commit (S3 fails: the answers re-wake the supervisor)
  • driver-live-adversarial.sh &lt;branch-worktree&gt; &lt;workdir&gt; interleave|rotate|unreadable - three live attempts to make the owned-append ledger swallow something it must not
  • bin/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.sh against 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.

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.
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.
@tiago-peixoto tiago-peixoto changed the title fix(bin): stop this home's own --resolve-key answers from each waking the supervisor fix(bin): stop each keyed answer from re-waking the supervisor Sep 20, 2026
@tiago-peixoto tiago-peixoto changed the title fix(bin): stop each keyed answer from re-waking the supervisor fix(bin): stop each keyed-decision answer from waking this home again Sep 20, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

First look. Main a09090d13ef24ce3cf71d171ade119896d6db301. Tip 0992f931e8cf. Attestation MATCH (head_sha binds tip). Tip NM FAIL — required pipeline step test is skipped (repo requires review/test/document completed; quota/agent skips are not compliant). CI SUCCESS on tip. MERGEABLE / UNSTABLE. No Greptile review yet. Workflows: none pending. Author body references issue #4885 but does not use a GitHub closing keyword — does not close #4885 from body alone. No auto-merge. Waiting on author to complete the no-mistakes test step (re-run git push no-mistakes with test completed, not skipped).

What I inspected

VISION.md (each rule)

  • One captain, one interface: aligns — spurious per-answer wakes are noise, not decisions.
  • Authority is explicit: aligns — no new autonomy grant; wake suppression is only for this home's own bookkeeping bytes.
  • Scripts own the mechanics: aligns — ledger + wake predicate are exact script work.
  • A restart is a non-event: aligns — durable owned-range record survives session death.
  • Delegation with a spine: aligns — worker-authored bytes still wake.
  • The fleet outlives any vendor: aligns — harness-agnostic status/wake path.
  • Scope: aligns — command-layer wake correctness.

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.

@tiago-peixoto tiago-peixoto changed the title fix(bin): stop each keyed-decision answer from waking this home again fix(bin): stop each keyed answer from re-waking this home Sep 20, 2026
@tiago-peixoto

Copy link
Copy Markdown
Contributor Author

Following up on #4907 (comment)

The waiting-author item from that 2026-09-20T10:23Z triage is done. HEAD is now a5f2dab952da7c410d325264c3bb6723e9d9c606; attestation head_sha matches; required test is completed (no longer skipped). Latest no-mistakes check and CI on this HEAD succeeded.

@kunchenguid
kunchenguid merged commit 39f4c2a into kunchenguid:main Sep 22, 2026
21 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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 (state/.<task>.home-appends) + wake-only fm_wake_signal_seen_current so multi --resolve-key answers no longer each force a captain-facing wake; presentation/UNREAD STATUS unchanged (#4885). Attestation MATCH. NM test completed. Closes #4885 verified (Fixes #4885).