Skip to content

fix(bin): dedupe watcher stale wakes for already-delivered terminal status - #11

Merged
peterOC26 merged 8 commits into
mainfrom
fm/fm-watcher-false-wake-2573-w1
Aug 20, 2026
Merged

peterOC26 merged 8 commits into
mainfrom
fm/fm-watcher-false-wake-2573-w1

Conversation

@peterOC26

Copy link
Copy Markdown
Owner

Intent

Fix Firstmate issue https://github.com/peterOC26/firstmate/issues/2573 with the smallest upstream-compatible change. Stop routine terminal footer redraws from repeatedly invoking the primary model after the current terminal lifecycle/status transition has already been durably delivered. Implement delivered lifecycle/status-transition deduplication in the terminal-stale path in bin/fm-watch.sh: when the current terminal status line is byte-identical to the line already recorded as delivered in state/.hb-surfaced-, absorb a cosmetic pane-hash change, advance existing stale bookkeeping, and clear existing stale/wedge timers. Keep raw pane hashes as liveness input, never delivery identity. Do not create new durable state or a new resurfacing cadence. Preserve exactly-once first undelivered terminal delivery; genuine blocked, failed, keyed decision, PR-ready, and merged transitions; merge polling; blind-stop protection; watcher liveness beacon; raw pane hashes as liveness and wedge evidence; enqueue-before-mark-surfaced ordering; away-mode ownership and heartbeat batching. Do not filter footer text or regions, change Claude/Pi/Codex delivery policy, modify their supervision adapters to compensate, revisit the re-arm fix, widen into issue kunchenguid#2614, or add teardown cleanup. Add behavioral changing-footer regression coverage proving watcher, Claude Stop, Pi sendUserMessage, and Codex checkpoint behavior, first undelivered exactly once, later blocked/decision delivery, and preserved merge-polling/liveness/away/heartbeat/blind-stop behavior; reproduce failure before fix where feasible. Update authoritative current-behavior documentation one sentence per line with plain dashes: background waiting is tokenless; surfaced Claude Stop feedback, Pi follow-up, or a Codex checkpoint return invoking the primary consumes an ordinary model turn; pane hash is liveness evidence and delivered status line is lifecycle delivery evidence. Keep mechanism detail in one owner and concise cross-references elsewhere. Do not modify unrelated baseline failures or environment-only failures. The committed implementation is 7ad698b, and focused behavioral, lint, docs, and full-suite validation were run; full-suite failures were outside changed surfaces: composer geometry, pending-reply concurrency, missing actionlint, missing Kimi python3/tomllib, and Muse harness identity.

What Changed

  • bin/fm-watch.sh terminal-stale triage gains stale_state_already_delivered(): when a stale pane's current status line is byte-identical to the line recorded in state/.hb-surfaced-<task>, the watcher absorbs the pane-hash change — writes the new hash, clears that key's stale-since and wedge-escalation markers, and logs the absorb — instead of enqueuing another stale: wake. Undelivered terminal lines and later genuine transitions still surface through the existing paths; no new durable state or resurfacing cadence is added.
  • New changing-footer regression tests cover the watcher triage absorb (including cleared wedge timers, later blocked: waking exactly once, and a keyed decision surfacing via the signal path), Claude Stop re-arm, Pi sendUserMessage follow-up, and the Codex checkpoint (quiet when delivered, exactly one wake when undelivered). hash_text moved from tests/wake-helpers.sh to tests/lib.sh so all four suites share one pane-hash helper across the macOS md5 and Linux md5sum lanes.
  • Docs restate current behavior: README.md and docs/architecture.md replace "zero-token supervision" with tokenless background waiting plus the note that surfaced Claude Stop feedback, Pi follow-up, or a Codex checkpoint return that invokes the primary consumes an ordinary model turn; docs/architecture.md owns the mechanism detail (pane hashes as liveness evidence, delivered status line as lifecycle delivery evidence) and docs/configuration.md notes the delivered-line exception on FM_STALE_ESCALATE_SECS.

Risk Assessment

✅ Low: The source change is a single well-bounded 8-line branch in the terminal-stale path that keys only on already-delivered-status evidence, cannot suppress a first undelivered terminal line, leaves away-mode/secondmate/signal/heartbeat/merge-poll paths untouched, and is backed by behavioral regression coverage across all four harness surfaces that fails pre-fix; the remaining findings are documentation accuracy and test-robustness nits.

Testing

I ran the four suites that carry this change's new behavioral coverage (watcher triage, Codex checkpoint, Claude Stop auto-arm, Pi watch extension) plus the documentation-audience suite, and all passed at HEAD 5d9a793. Because passing tests alone are not evidence, I also drove the real bin/fm-watch.sh through a continuous supervision window — a finished crewmate whose done: PR … line was already delivered, pane open, footer clock redrawing every ~1.5s — re-arming the watcher only when it actually exited, which is exactly what the Claude Stop hook, Pi extension, and Codex checkpoint return do, so each re-arm in the transcript is one real primary model turn. Over identical 45-second windows the pre-fix watcher spent 29 primary turns on cosmetic redraws and HEAD spent 0, while both still delivered the first undelivered terminal line exactly once and still surfaced a later genuine blocked: credentials expired transition; HEAD logged 39 absorbed stale (terminal status already delivered, cosmetic pane change only) lines and kept the watcher alive. I separately confirmed each of the four new tests fails against a pre-fix tree, so the coverage genuinely reproduces the bug. I ran the two enqueue-before-suppressor tests from tests/fm-wake-queue.test.sh individually rather than the whole suite, since that suite's first test is a known pre-existing lock failure unrelated to this change that would abort the run before reaching them. This change has no rendered UI, HTML, or renderer surface — the end-user surface is the terminal supervision loop and the wake reasons handed to the primary harness — so the evidence is CLI transcripts rather than screenshots. Temporary base-tree extractions were removed and the worktree is clean.

Evidence: Before/after: primary model turns spent on cosmetic footer redraws
BEFORE (base 58f18ad) — 45s of footer redraws on an already-delivered done: line
t+02s primary invoked with: "stale: fm:alpha"
t+04s primary invoked with: "stale: fm:alpha"
t+05s primary invoked with: "stale: fm:alpha"
... (29 total, roughly one per redraw)
footer redrew 30 times over 45s
>>> primary model turns spent on cosmetic redraws: 29

AFTER (HEAD 5d9a793) — same fixture, same 45s window
footer redrew 30 times over 45s
>>> primary model turns spent on cosmetic redraws: 0

watcher triage log, last of 39 delivered-stale absorbs:
[..] absorbed stale (terminal status already delivered, cosmetic pane change only): fm:alpha

Preserved in BOTH runs:
part 1 first undelivered terminal line -> "stale: fm:alpha", records
state/.hb-surfaced-alpha = done: PR https://github.com/acme/app/pull/412 ...
part 3 genuine later transition -> wake, records
state/.hb-surfaced-alpha = blocked: credentials expired, need a fresh npm token
Evidence: Full pre-fix supervision transcript (base 58f18ad)
================================================================
firstmate #2573 - crew pane footer redraws after delivery
watcher under test: BEFORE the fix - base commit 58f18ad
================================================================
crew window ......... fm:alpha
status log last line  done: PR https://github.com/acme/app/pull/412 (retry backoff) - ready for review
crew pane ........... open; footer clock redraws every ~1.5s
primary re-arm ...... after every watcher exit (Stop hook / Pi ext / checkpoint)

--- part 1: the terminal status has never been delivered to the captain
    primary invoked with: "stale: fm:alpha"
    delivered marker state/.hb-surfaced-alpha: done: PR https://github.com/acme/app/pull/412 (retry backoff) - ready for review

--- part 2: 45s of pure footer redraws, nothing else changed
    t+02s  primary invoked with: "stale: fm:alpha"
    t+04s  primary invoked with: "stale: fm:alpha"
    t+05s  primary invoked with: "stale: fm:alpha"
    t+07s  primary invoked with: "stale: fm:alpha"
    t+08s  primary invoked with: "stale: fm:alpha"
    t+09s  primary invoked with: "stale: fm:alpha"
    t+11s  primary invoked with: "stale: fm:alpha"
    t+12s  primary invoked with: "stale: fm:alpha"
    t+14s  primary invoked with: "stale: fm:alpha"
    t+15s  primary invoked with: "stale: fm:alpha"
    t+17s  primary invoked with: "stale: fm:alpha"
    t+19s  primary invoked with: "stale: fm:alpha"
    t+20s  primary invoked with: "stale: fm:alpha"
    t+22s  primary invoked with: "stale: fm:alpha"
    t+23s  primary invoked with: "stale: fm:alpha"
    t+24s  primary invoked with: "stale: fm:alpha"
    t+26s  primary invoked with: "stale: fm:alpha"
    t+27s  primary invoked with: "stale: fm:alpha"
    t+29s  primary invoked with: "stale: fm:alpha"
    t+31s  primary invoked with: "stale: fm:alpha"
    t+32s  primary invoked with: "stale: fm:alpha"
    t+33s  primary invoked with: "stale: fm:alpha"
    t+35s  primary invoked with: "stale: fm:alpha"
    t+37s  primary invoked with: "stale: fm:alpha"
    t+38s  primary invoked with: "stale: fm:alpha"
    t+39s  primary invoked with: "stale: fm:alpha"
    t+41s  primary invoked with: "stale: fm:alpha"
    t+43s  primary invoked with: "stale: fm:alpha"
    t+44s  primary invoked with: "stale: fm:alpha"
    footer redrew 30 times over 45s
    >>> primary model turns spent on cosmetic redraws: 29

--- part 3: a GENUINE later transition (the crew hits a blocker)
    primary invoked with: "signal: /var/folders/j0/w34lmlf93rdgx6qhg4t5m2mh0000gn/T//fm-footer-demo.3dS1FT/state/alpha.status"
    delivered marker state/.hb-surfaced-alpha: blocked: credentials expired, need a fresh npm token

--- part 4: dedup now tracks the NEW delivered line - 15s more redraws
    t+01s  primary invoked with: "stale: fm:alpha"
    t+02s  primary invoked with: "stale: fm:alpha"
    t+04s  primary invoked with: "stale: fm:alpha"
    t+05s  primary invoked with: "stale: fm:alpha"
    t+07s  primary invoked with: "stale: fm:alpha"
    t+08s  primary invoked with: "stale: fm:alpha"
    t+10s  primary invoked with: "stale: fm:alpha"
    t+11s  primary invoked with: "stale: fm:alpha"
    t+12s  primary invoked with: "stale: fm:alpha"
    t+14s  primary invoked with: "stale: fm:alpha"
    >>> primary model turns spent after the blocked delivery: 10

----------------------------------------------------------------
watcher triage log (state/.watch-triage.log), last 4 of 0 delivered-stale absorbs:
----------------------------------------------------------------
Evidence: Full post-fix supervision transcript (HEAD 5d9a793)
================================================================
firstmate #2573 - crew pane footer redraws after delivery
watcher under test: AFTER the fix - HEAD 5d9a793 (fix commit 7ad698b)
================================================================
crew window ......... fm:alpha
status log last line  done: PR https://github.com/acme/app/pull/412 (retry backoff) - ready for review
crew pane ........... open; footer clock redraws every ~1.5s
primary re-arm ...... after every watcher exit (Stop hook / Pi ext / checkpoint)

--- part 1: the terminal status has never been delivered to the captain
    primary invoked with: "stale: fm:alpha"
    delivered marker state/.hb-surfaced-alpha: done: PR https://github.com/acme/app/pull/412 (retry backoff) - ready for review

--- part 2: 45s of pure footer redraws, nothing else changed
    footer redrew 30 times over 45s
    >>> primary model turns spent on cosmetic redraws: 0

--- part 3: a GENUINE later transition (the crew hits a blocker)
    primary invoked with: "signal: /var/folders/j0/w34lmlf93rdgx6qhg4t5m2mh0000gn/T//fm-footer-demo.KvI3hi/state/alpha.status"
    delivered marker state/.hb-surfaced-alpha: blocked: credentials expired, need a fresh npm token

--- part 4: dedup now tracks the NEW delivered line - 15s more redraws
    >>> primary model turns spent after the blocked delivery: 0

----------------------------------------------------------------
watcher triage log (state/.watch-triage.log), last 4 of 39 delivered-stale absorbs:
    [2026-08-20T00:37:39+0200] absorbed stale (terminal status already delivered, cosmetic pane change only): fm:alpha
    [2026-08-20T00:37:42+0200] absorbed stale (terminal status already delivered, cosmetic pane change only): fm:alpha
    [2026-08-20T00:37:45+0200] absorbed stale (terminal status already delivered, cosmetic pane change only): fm:alpha
    [2026-08-20T00:37:49+0200] absorbed stale (terminal status already delivered, cosmetic pane change only): fm:alpha
----------------------------------------------------------------
Evidence: Regression proof: the four new tests fail before the fix, pass after
Regression proof for the four new behavioral tests: each was run against the
pre-fix tree (base 58f18ad, with HEAD's tests overlaid) and against HEAD
5d9a793. Same test, same fixture, opposite verdict.

--- BEFORE (base 58f18ad + HEAD tests) ------------------------------------

$ bash tests/fm-watch-triage.test.sh          # watcher itself
not ok - a delivered terminal state with an unchanged footer woke the watcher: stale: test:fm-footer

$ bash tests/fm-watch-checkpoint.test.sh      # Codex checkpoint return
not ok - delivered changing-footer checkpoint exit: expected exit 124, got 0
          (exit 0 = the checkpoint returned a wake to the primary instead of staying quiet)

$ bash tests/fm-claude-stop-autoarm.test.sh   # Claude Stop hook
not ok - a delivered terminal footer change must not trigger a Claude Stop rewake: rc=2
  output=firstmate watcher wake - one supervision event needs a handling turn now.
  stale: test:fm-footer
  Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED ...
  queue=1787179168  1  stale  test:fm-footer  stale: test:fm-footer

$ bash tests/fm-pi-watch-extension.test.sh    # Pi sendUserMessage
Error: delivered footer state sent a Pi follow-up: FIRSTMATE_OP: v1 watcher: FIRSTMATE WATCHER WAKE: stale: test:fm-footer
not ok - Pi delivered footer fixture failed

--- AFTER (HEAD 5d9a793) --------------------------------------------------

$ bin/fm-test-run.sh tests/fm-watch-triage.test.sh tests/fm-watch-checkpoint.test.sh
ok - a delivered terminal lifecycle absorbs changing cosmetic footer content
ok - delivered changing-footer state stays quiet through the Codex checkpoint
ok - the first undelivered changing-footer state wakes the Codex checkpoint once
FM_TEST_SUMMARY total=2 failed=0 skipped_gate=0

$ bin/fm-test-run.sh tests/fm-claude-stop-autoarm.test.sh tests/fm-pi-watch-extension.test.sh
ok - Claude Stop stays quiet for delivered changing-footer state and rewakes once for the first undelivered state
ok - Pi sends no follow-up for delivered changing-footer state and sends one for the first undelivered state
FM_TEST_SUMMARY total=2 failed=0 skipped_gate=0

--- preserved invariants spot-checked -------------------------------------

$ bash <subset of tests/fm-wake-queue.test.sh>   # enqueue-before-suppressor ordering,
                                                 # and the hash_text helper this change
                                                 # moved into tests/lib.sh
ok - stale wake is queued before suppressor state is advanced
ok - a not-provably-working stale wake is queued before its suppressor is advanced
Evidence: Demo driver (reproducible, uses the repo's hermetic backend fakes)
#!/usr/bin/env bash
# End-to-end demo for firstmate issue #2573.
#
# Scenario an end user actually lives through: a crewmate has finished, and its
# status log's last line is a terminal "done: PR ..." line. Its harness pane is
# still open, so the TUI footer keeps redrawing (elapsed clock ticking). Every
# redraw changes the raw pane hash.
#
# This drives the real bin/fm-watch.sh over one continuous supervision window.
# Whenever the watcher exits with a reason, that IS the primary being invoked
# (a model turn), so the demo drains/acks the wake and re-arms exactly like the
# Claude Stop hook, the Pi extension, or a Codex checkpoint return would. A
# watcher that stays alive is background waiting, which costs no model turn.
#
# Usage: footer-redraw-demo.sh <tree-root> <label>
set -u

TREE=$1
LABEL=$2
WATCH="$TREE/bin/fm-watch.sh"
DRAIN="$TREE/bin/fm-wake-drain.sh"

WINDOW="fm:alpha"
TASK=alpha
STATUS_LINE='done: PR https://github.com/acme/app/pull/412 (retry backoff) - ready for review'
REDRAW_WINDOW_TENTHS=450   # 45s of continuous footer redraws
FIRST_WAKE_TENTHS=200

RUN=$(mktemp -d "${TMPDIR:-/tmp}/fm-footer-demo.XXXXXX")
STATE="$RUN/state"
FAKEBIN="$RUN/fakebin"
PANE="$RUN/pane.txt"
OUT="$RUN/watch.out"
mkdir -p "$STATE" "$FAKEBIN"

WATCH_PID=""
cleanup() {
  [ -z "$WATCH_PID" ] || { kill "$WATCH_PID" 2>/dev/null || true; wait "$WATCH_PID" 2>/dev/null || true; }
  rm -rf "$RUN"
}
trap cleanup EXIT

cat > "$FAKEBIN/tmux" <<'SH'
#!/usr/bin/env bash
set -u
case "${1:-}" in
  list-windows) [ -n "${FM_FAKE_TMUX_WINDOW:-}" ] && printf '%s\n' "${FM_FAKE_TMUX_WINDOW#*:}"; exit 0 ;;
  capture-pane) [ -n "${FM_FAKE_TMUX_CAPTURE:-}" ] && cat "$FM_FAKE_TMUX_CAPTURE"; exit 0 ;;
  display-message) printf '\n'; exit 0 ;;
esac
exit 1
SH
cat > "$FAKEBIN/fm-crew-state.sh" <<'SH'
#!/usr/bin/env bash
printf 'state: unknown · source: none · demo fixture\n'
SH
chmod +x "$FAKEBIN/tmux" "$FAKEBIN/fm-crew-state.sh"

printf 'window=%s\nkind=ship\n' "$WINDOW" > "$STATE/$TASK.meta"
printf '%s\n' "$STATUS_LINE" > "$STATE/$TASK.status"

# The crew pane: finished work plus a live TUI footer whose elapsed clock ticks.
MIN=15
render_pane() {
  cat > "$PANE" <<EOF
> add the retry backoff and open a PR
  ⎿  edited src/retry.ts, tests/retry.test.ts
  ⎿  Done (14 tool uses)

finished, awaiting review
⏱  ${MIN}m | 12% context
EOF
}
render_pane

# The captain already consumed this status line as a wake signal on the turn it
# landed, so everything below exercises the terminal-stale path - the path
# issue #2573 reports as repeatedly re-invoking the primary.
prime_seen() {
  FM_STATE_OVERRIDE="$STATE" bash -c '
    . "$1"
    sig=$(fm_wake_signal_sig "$3") || exit 1
    printf "%s" "$sig" > "$(fm_wake_signal_seen_path "$2" "$3")"
  ' _ "$TREE/bin/fm-wake-lib.sh" "$STATE" "$STATE/$TASK.status"
}

ack_cycle() {
  local err="$STATE/.demo-drain.err" seq gen
  FM_STATE_OVERRIDE="$STATE" "$DRAIN" >/dev/null 2> "$err" || return 1
  seq=$(sed -n 's/^WAKE_ACK_REQUIRED:.*--ack-through \([0-9][0-9]*\) --recovery-generation [A-Za-z0-9._-][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._-][A-Za-z0-9._-]*\)$/\1/p' "$err")
  rm -f "$err"
  [ -n "$seq" ] && [ -n "$gen" ] || return 1
  FM_STATE_OVERRIDE="$STATE" "$DRAIN" --ack-through "$seq" --recovery-generation "$gen" >/dev/null
}

arm_watcher() {  # what the primary's turn-end hook does
  : > "$OUT"
  PATH="$FAKEBIN:$PATH" FM_STATE_OVERRIDE="$STATE" FM_CREW_STATE_BIN="$FAKEBIN/fm-crew-state.sh" \
    FM_FAKE_TMUX_WINDOW="$WINDOW" FM_FAKE_TMUX_CAPTURE="$PANE" \
    FM_POLL=0.3 FM_SIGNAL_GRACE=0.1 FM_CHECK_INTERVAL=999999 FM_HEARTBEAT=999999 \
    "$WATCH" > "$OUT" 2>/dev/null &
  WATCH_PID=$!
}

watcher_exited() { ! kill -0 "$WATCH_PID" 2>/dev/null; }

# Sets REASON to what the watcher returned to the primary. Assigns globals, so
# it must never run inside a command substitution (that would leave WATCH_PID
# pointing at the reaped watcher and re-read its output next iteration).
REASON=""
collect_wake() {
  wait "$WATCH_PID" 2>/dev/null || true
  WATCH_PID=""
  REASON=$(head -1 "$OUT")
}

printf '================================================================\n'
printf 'firstmate #2573 - crew pane footer redraws after delivery\n'
printf 'watcher under test: %s\n' "$LABEL"
printf '================================================================\n'
printf 'crew window ......... %s\n' "$WINDOW"
printf 'status log last line  %s\n' "$STATUS_LINE"
printf 'crew pane ........... open; footer clock redraws every ~1.5s\n'
printf 'primary re-arm ...... after every watcher exit (Stop hook / Pi ext / checkpoint)\n\n'

prime_seen

printf -- '--- part 1: the terminal status has never been delivered to the captain\n'
arm_watcher
i=0
while [ "$i" -lt "$FIRST_WAKE_TENTHS" ] && ! watcher_exited; do sleep 0.1; i=$((i + 1)); done
if watcher_exited; then
  collect_wake
  printf '    primary invoked with: "%s"\n' "$REASON"
  ack_cycle || printf '    (drain/ack failed)\n'
else
  printf '    NO WAKE within %ss - the first terminal delivery was lost\n' "$((FIRST_WAKE_TENTHS / 10))"
fi
printf '    delivered marker state/.hb-surfaced-%s: %s\n\n' "$TASK" \
  "$(cat "$STATE/.hb-surfaced-$TASK" 2>/dev/null || echo '(none)')"

printf -- '--- part 2: %ss of pure footer redraws, nothing else changed\n' "$((REDRAW_WINDOW_TENTHS / 10))"
INVOCATIONS=0
[ -n "$WATCH_PID" ] || arm_watcher
i=0
while [ "$i" -lt "$REDRAW_WINDOW_TENTHS" ]; do
  if [ -n "$WATCH_PID" ] && watcher_exited; then
    collect_wake
    INVOCATIONS=$((INVOCATIONS + 1))
    printf '    t+%02ss  primary invoked with: "%s"\n' "$((i / 10))" "$REASON"
    ack_cycle || true
    arm_watcher
  fi
  if [ $((i % 15)) -eq 14 ]; then
    MIN=$((MIN + 1))
    render_pane
  fi
  sleep 0.1
  i=$((i + 1))
done
printf '    footer redrew %s times over %ss\n' "$((REDRAW_WINDOW_TENTHS / 15))" "$((REDRAW_WINDOW_TENTHS / 10))"
printf '    >>> primary model turns spent on cosmetic redraws: %s\n\n' "$INVOCATIONS"

printf -- '--- part 3: a GENUINE later transition (the crew hits a blocker)\n'
[ -n "$WATCH_PID" ] || arm_watcher
printf 'blocked: credentials expired, need a fresh npm token\n' >> "$STATE/$TASK.status"
MIN=$((MIN + 1)); render_pane
i=0
while [ "$i" -lt "$FIRST_WAKE_TENTHS" ] && ! watcher_exited; do
  if [ $((i % 15)) -eq 14 ]; then MIN=$((MIN + 1)); render_pane; fi
  sleep 0.1
  i=$((i + 1))
done
if watcher_exited; then
  collect_wake
  printf '    primary invoked with: "%s"\n' "$REASON"
  printf '    delivered marker state/.hb-surfaced-%s: %s\n' "$TASK" \
    "$(cat "$STATE/.hb-surfaced-$TASK" 2>/dev/null || echo '(none)')"
  ack_cycle || true
else
  printf '    NO WAKE within %ss - a genuine blocked transition was swallowed\n' "$((FIRST_WAKE_TENTHS / 10))"
fi

printf '\n--- part 4: dedup now tracks the NEW delivered line - %ss more redraws\n' 15
[ -n "$WATCH_PID" ] || arm_watcher
LATE=0
i=0
while [ "$i" -lt 150 ]; do
  if [ -n "$WATCH_PID" ] && watcher_exited; then
    collect_wake
    LATE=$((LATE + 1))
    printf '    t+%02ss  primary invoked with: "%s"\n' "$((i / 10))" "$REASON"
    ack_cycle || true
    arm_watcher
  fi
  if [ $((i % 15)) -eq 14 ]; then MIN=$((MIN + 1)); render_pane; fi
  sleep 0.1
  i=$((i + 1))
done
printf '    >>> primary model turns spent after the blocked delivery: %s\n' "$LATE"

printf '\n----------------------------------------------------------------\n'
absorbed=$(grep -cF "absorbed stale (terminal status already delivered" "$STATE/.watch-triage.log" 2>/dev/null || true)
printf 'watcher triage log (state/.watch-triage.log), last 4 of %s delivered-stale absorbs:\n' "${absorbed:-0}"
grep -F "absorbed stale (terminal status already delivered" "$STATE/.watch-triage.log" 2>/dev/null \
  | tail -4 | sed 's/^/    /' || printf '    (none)\n'
printf -- '----------------------------------------------------------------\n'
Evidence: Evidence index across rounds
# Evidence - firstmate #2573, delivered terminal lifecycle dedup

Branch `fm/fm-watcher-false-wake-2573-w1` (base `58f18ad` → target `5d9a793`).

The end-user surface for this change is the watcher's printed wake reason: every
reason the watcher prints is handed to the primary harness and costs one ordinary
model turn. Staying blocked costs nothing. So "did the captain's model get invoked
again for a cosmetic footer redraw?" is exactly what these artifacts show.

## Round 3 artifacts (target `5d9a793`)

### `before-fix.txt` / `after-fix.txt` (driver: `footer-redraw-demo.sh`)

One continuous supervision window instead of a scripted cycle count. A crewmate
finished, its `done: PR https://github.com/acme/app/pull/412 …` line is the last
line of its status log, and its pane stays open with the footer clock redrawing
every ~1.5s. The demo re-arms `bin/fm-watch.sh` only when the watcher actually
exits - which is precisely what the Claude Stop hook, the Pi extension, and a
Codex checkpoint return do - so every re-arm in the transcript is one real
primary model turn, and a watcher left running is free background waiting.

Over the same 45s of pure footer redraws (30 redraws):

- base `58f18ad`: **29 primary invocations**, one `stale: fm:alpha` roughly every
  1.5s, one per redraw.
- HEAD `5d9a793`: **0 primary invocations**, 39 `absorbed stale (terminal status
  already delivered, cosmetic pane change only)` lines in
  `state/.watch-triage.log`, watcher still alive and supervising.

Both transcripts also show the invariants the intent requires kept: the first
undelivered terminal line still surfaces exactly once and records delivery in
`state/.hb-surfaced-alpha`, and a later genuine `blocked: credentials expired`
transition still reaches the captain. Part 4 then shows the dedup identity
following the *new* delivered line - 15 more seconds of redraws after the
blocked delivery cost 0 turns on HEAD and 10 on base.

### `regression-proof.txt`

The four committed behavioral tests run against base `58f18ad` (with HEAD's
`tests/` overlaid so the fixtures exist) and against HEAD. Each one fails before
the fix and passes after it, at the level an end user feels it: watcher stale
path, Codex checkpoint exit code, Claude Stop exit-2 rewake with the full hook
feedback, and a real Pi `sendUserMessage` follow-up prompt.

## Round 2 artifacts (target `ad3327a`)

### `delivered-footer-demo.txt` (driver: `delivered-footer-demo.sh`)

End-to-end supervision transcript. The same fixture - a crewmate whose
`done: PR https://…` line was already delivered to the captain, whose TUI footer
then ticks `15m → 16m → 17m → 18m` - is driven through the real `bin/fm-watch.sh`
at both commits, with the repo's own hermetic backend fakes:

- **section 1, pre-fix watcher (`58f18ad`)**: one cosmetic footer redraw prints
  `stale: test:fm-footer` and enqueues a wake → the primary model is invoked.
- **section 2, this branch**: three cosmetic redraws produce no output, an empty
  `state/.wake-queue`, three `absorbed stale (terminal status already delivered,
  cosmetic pane change only)` lines in `state/.watch-triage.log`, stale
  bookkeeping advanced to the newest pane hash, wedge timer cleared, liveness
  beacon fresh, and the watcher still blocked and supervising.
- **section 3**: the first *undelivered* `done:` line still surfaces exactly once
  and records delivery in `state/.hb-surfaced-footer`.
- **section 4**: a later genuine `blocked: credentials expired` transition still
  surfaces and records its own delivery.

### `checkpoint-cli-demo.txt` (driver: `checkpoint-cli-demo.sh`)

The Codex supervision CLI an end user's harness actually invokes.
`bin/fm-watch-checkpoint.sh --seconds 20` on delivered state returns
`checkpoint: no actionable wake within 20s` / exit 124 (no model turn); the same
state undelivered returns `stale: test:fm-footer` / exit 0 (one model turn).

### `focused-tests.log`, `pi-watch-extension-full.log`, `pi-final-serial.log`

The four focused suites covering the changed surface, run serially and green:
`tests/fm-watch-checkpoint.test.sh`, `tests/fm-pi-watch-extension.test.sh`,
`tests/fm-claude-stop-autoarm.test.sh`, `tests/fm-watch-triage.test.sh`.

### `prefix-regression-check.log`

Each of the four suites re-run with `bin/fm-watch.sh` swapped to base `58f18ad`
(worktree restored afterwards). All four fail on the pre-fix watcher - watcher
stale path, Pi `sendUserMessage`, Claude Stop exit-2 rewake, and Codex
checkpoint exit code - so the new coverage genuinely reproduces the bug.

### `pi-fixed-stress-*.log` / `pi-load-*.log` / `pi-base-load*.log`

Load-sensitivity investigation. `pi-load-*` shows the committed Pi footer test
failing under concurrency (`sends=0 prompt=`) because its wait loop allowed only
6s for the watcher to surface. After widening that failure bound, all four
concurrent copies pass (`pi-fixed-stress-*`). The `pi-base-load*` runs are the
control: the other timing-bound failures seen under 4-identical-copy stress
(`OpenCode watch plugin must arm only when this session owns the fleet lock`,
`Pi session transitions must rearm through an explicit generation owner`)
reproduce identically on base `58f18ad`, so they are pre-existing suite load
sensitivity, not a regression from this change.

### `adjacent-tests.log`

`tests/fm-documentation-audiences.test.sh` (consumer of the changed README and
`docs/architecture.md`) passes. `tests/fm-wake-queue.test.sh` (consumer of the
`hash_text` helper moved into `tests/lib.sh`) fails one unrelated lock case,
`a subshell reclaimed its parent's live hold (rc=13)` - verified to fail
identically on base `58f18ad`.

## Round 1 artifacts (target `6481451`)

### `watcher-footer-wakes-before-after.txt` (driver: `demo-footer-dedup.sh`)

Earlier end-to-end transcript over six cosmetic redraws: base commit spends
**6 extra primary turns**; the branch spends **0**.

### `regression-before-after.txt`

The four new behavioral tests run against both commits: each fails on `58f18ad`
and passes on `6481451`.

### `triage-test-flake-hardening.txt`

Evidence for the round-1 fix that replaced a fixed 2.0s wait in
`test_delivered_terminal_footer_change_is_absorbed` with a poll that fails fast
if the watcher surfaces instead.
- Outcome: 🔧 2 issues found → auto-fixed (2) ✅ across 3 runs (3h40m18s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 3 infos
  • ⚠️ bin/fm-watch.sh:1183 - A pane whose last status line stays byte-identical to .hb-surfaced-<task> can never again produce a stale wake OR a wedge escalation, which opens a blind spot for a re-tasked crew. Concrete path: crew writes done: PR #123, it is delivered and mark_surfaced records it. Firstmate then gives the crew more work in the same pane; per AGENTS.md's sparse status-reporting contract the crew appends no new status line, so last_status_line() still returns the delivered done:. The agent then dies and the pane freezes. On the next distinct stale hash: stale_is_terminal is true, crew_is_provably_working is false (no run, dead agent), so stale_state_already_delivered absorbs and rm -f &#34;$ssf&#34; &#34;$ewf&#34; deletes the wedge timer. On later polls of the same hash the elif [ -e &#34;$ssf&#34; ] wedge branch at line 1194 is skipped because $ssf was just removed, so FM_STALE_ESCALATE_SECS / demand-deep-inspection never fire. The heartbeat backstop cannot recover it either: heartbeat_scan_finds_actionable (line 673) skips the task for the same surfaced==last reason. Only the long-inactive fm-inactive-reconcile cadence remains. The intent explicitly requires "clear existing stale/wedge timers", so this is authorized rather than a defect, but it is a durable behavior loss worth an explicit decision - e.g. keeping the wedge timer (drop $ssf from the rm) while still suppressing the wake, which would preserve escalation without re-introducing the false wakes.
  • ⚠️ docs/architecture.md:13 - docs/architecture.md is the designated authoritative current-behavior owner, but line 13 still states unconditionally that actionable wakes include "stale panes whose crew is not provably working whether their status log looks terminal or non-terminal". After this change that is no longer true: a stale pane whose crew is not provably working and whose terminal status line already matches .hb-surfaced-<task> is absorbed, not surfaced. The sentence added at line 29 ("Pane hashes are liveness evidence, while the delivered status line is lifecycle delivery evidence for terminal stale deduplication") names the evidence split the intent asked for but never states the suppression, so a reader following line 13 gets the wrong model. Qualify line 13 with the delivered-status exclusion (one sentence per line, plain dash style).
  • ℹ️ tests/fm-pi-watch-extension.test.sh:105 - The Pi arm fixture runs ... sh -c &#39;... exec &#34;$FM_WATCH_SCRIPT&#34;&#39; as the arm script's last command without exec, so the real fm-watch.sh is a grandchild of the arm child. Verified locally that bash does not exec-optimize the last command of a script file (the parent bash stays resident with the sh-exec'd child alongside it). The extension's cleanupOnProcessExit -> stopGeneration sends SIGTERM only to the arm child (.pi/extensions/fm-primary-pi-watch.ts:212), so in the delivered case - where the watcher never exits by design - node's process.exit(0) kills the arm bash and orphans a live fm-watch.sh polling at FM_POLL=0.2 against $TMP_ROOT/pi-footer-delivered. It self-evicts only when the EXIT trap removes TMP_ROOT and $WATCH_LOCK/pid disappears (bin/fm-watch.sh:903), i.e. after the rest of this ~2200-line test file has run. Prefixing the final command with exec makes the arm child the watcher itself and lets the existing SIGTERM path reap it. Unlike the other arm fixtures in this file (e.g. line 322), this one has no TERM trap either.
  • ℹ️ tests/fm-claude-stop-autoarm.test.sh:206 - Both quiet-path fixtures burn a fixed wall-clock budget with no early exit, because in the delivered case the watcher is expected never to exit: this loop always runs its full 100 x 0.1s = 10s, and tests/fm-pi-watch-extension.test.sh:141 always runs its full 600 x 20ms = 12s. That is ~22s of unconditional sleep added to the suite to prove a negative that FM_POLL=0.2 / FM_SIGNAL_GRACE=0.1 settle within roughly a second (the checkpoint test proves the same property in 2s). Bounding these to a couple of seconds keeps identical coverage.
  • ℹ️ bin/fm-watch.sh:441 - stale_state_already_delivered() re-derives values the caller already holds: task is computed at line 1118 and last at line 1122 for the same window, and neither is reassigned before the call site at line 1183. Re-running window_to_task() globs and greps every state/.meta file again (bin/fm-classify-lib.sh:1053) on each new stale hash. Taking &lt;task&gt; &lt;last&gt; as parameters removes the redundant fleet-wide meta scan and the duplicate status read without changing behavior. The [ -n &#34;$task&#34; ] || return 1 guard is also effectively dead, since window_to_task always falls back to "${w##:}" with the fm- prefix stripped.

🔧 Fix: document delivered-stale suppression; trim test waits
2 issues (1 warning, 1 info) still open:

  • ⚠️ tests/fm-watch-checkpoint.test.sh:42 - Three of the four new fixtures seed the pane hash with md5 -q, which is BSD/macOS-only and does not exist on ubuntu-latest, where all four of these scripts actually run in CI. bin/fm-test-run.sh --list --lane portable-serial places fm-watch-checkpoint.test.sh, fm-claude-stop-autoarm.test.sh, fm-pi-watch-extension.test.sh, and fm-watch-triage.test.sh in the portable-serial lane, and .github/workflows/ci.yml:129-131 runs that lane's 4 shards on runs-on: ubuntu-latest (only fm-fleet-snapshot-view / fm-bearings-snapshot run on macOS). On Linux md5 -q is a command-not-found, so hash is empty, printf &#39;%s&#39; &#34;&#34; &gt; .hash-&lt;key&gt; writes an empty file, and the fixture's documented precondition (pane already sitting at this hash with count=1, so the very next poll classifies stale) silently never holds - the watcher just takes two extra polls to reach the same state. The tests still pass, but the seeding is dead on the platform CI exercises, and md5: command not found leaks to the suite's stderr. Every other hash site in this repo already handles it: tests/wake-helpers.sh:302 hash_text(), bin/fm-watch.sh:190 hash_pane(), bin/fm-supervise-daemon.sh:245 all fall back to md5sum | cut -d&#39; &#39; -f1, and the fourth new test (tests/fm-watch-triage.test.sh:646) correctly uses hash_text. These three files source tests/lib.sh, which has no hash helper, so inline the same two-branch form used in bin/fm-watch.sh:190 (sourcing wake-helpers.sh instead would drag in its FM_ROOT_OVERRIDE and wedge-alarm side effects). Affected lines: tests/fm-watch-checkpoint.test.sh:42, tests/fm-claude-stop-autoarm.test.sh:181, tests/fm-pi-watch-extension.test.sh:90.
  • ℹ️ tests/fm-claude-stop-autoarm.test.sh:424 - The delivered arms of the two adapter tests assert only absence (rc=0, empty output, epoch outcome clean), so they pass whether the absorb branch ran or the watcher simply never reached stale classification in time. That was tolerable at the original bounds, but this fix round cut the Claude fixture's wait from 100x0.1s to 25x0.1s (line 206) and the Pi loop from 600x20ms to 150x20ms (tests/fm-pi-watch-extension.test.sh:141). In the delivered case the watcher is expected never to exit, so the full bound is always burned, and the absorb must land inside it: the fixture ticks the footer at t=0.3s, after which the watcher needs a fresh hash plus two consecutive identical hashes (3 polls at FM_POLL=0.2 plus per-poll subprocess work - backend capture, hash, busy classify, fm-crew-state) before the delivered-terminal branch is even reached. On Linux that costs two extra polls because the seeded hash is empty (see the md5 finding). Under load on a shared CI runner the classification can miss the window and the test passes vacuously. tests/fm-watch-triage.test.sh:634-640 shows the fix: assert the bookkeeping the absorb branch writes. Here that is [ &#34;$(cat &#34;$dir/state/.stale-test_fm-footer&#34;)&#34; = &#34;$post_tick_hash&#34; ] plus absent .stale-since-test_fm-footer, checked after run_autoarm returns and before the fixture's meta cleanup - which anchors the quiet assertion to the branch actually executing. Note the regression value itself is intact: with the fix reverted both arms do fail, since the watcher exits on stale: test:fm-footer and autoarm reports rc=2.

🔧 Fix: share portable hash helper; assert absorb bookkeeping
3 infos still open:

  • ℹ️ docs/configuration.md:651 - The FM_STALE_ESCALATE_SECS reference comment still asserts "stale panes whose crew is not provably working surface immediately unless they declare the pause verb". After this change there is a second exception: bin/fm-watch.sh:1181 absorbs such a pane when its terminal status line is byte-identical to state/.hb-surfaced-<task>. docs/architecture.md was correctly updated (lines 13, 29-31), but this env-var reference - which readers consult to reason about the stale/escalate knobs - now states a rule the code no longer follows. Extend the clause, e.g. "...unless they declare the pause verb or their terminal status line is already recorded as delivered", keeping mechanism detail in docs/architecture.md.
  • ℹ️ tests/fm-watch-checkpoint.test.sh:133 - The Codex delivered arm asserts only absence (rc=124, quiet line, no queue, no lock), so it passes whether the delivered-terminal absorb ran or the watcher simply never reached stale classification inside --seconds 2. Round 2 closed exactly this gap for the Claude arm (tests/fm-claude-stop-autoarm.test.sh:435) and the Pi arm (tests/fm-pi-watch-extension.test.sh:178) by anchoring on the absorb's bookkeeping, but left this third fixture untouched. Here the watcher must complete two polls at FM_POLL=0.2 (pane.txt is seeded at 16m while .hash-test_fm-footer holds the 15m digest, so the first poll only resets the counter) plus a real, unstubbed bin/fm-crew-state.sh read per fresh stale - this fixture is the only one of the four that does not set FM_CREW_STATE_BIN, and it is fast only because footer.meta has no worktree= line so fm-crew-state.sh short-circuits at its "worktree gone" emit. Add the same positive anchor after the checkpoint returns: .stale-test_fm-footer equals hash_text of the 16m pane, and .stale-since-test_fm-footer is absent. Note the regression value itself is intact - pre-fix the checkpoint exits 0 with stale: test:fm-footer, so the arm does fail without the fix.
  • ℹ️ tests/fm-watch-triage.test.sh:653 - The cosmetic-footer-change phase waits a fixed sleep 0.8 before asserting .stale-&lt;key&gt; advanced to second_hash, while the sibling fixtures were converted to condition waits in the last fix round. Usually one poll suffices, but the phase rewrites .hash-<key>/.count-<key> underneath a live watcher: if the watcher's pane capture and its prev=$(cat &#34;$hf&#34;) read straddle those writes, it needs up to three polls (0.2s each plus per-poll capture/hash/busy/crew-state subprocess work) to settle, which can exceed 0.8s on a loaded runner. The failure mode is a loud flake rather than a vacuous pass, since the second_hash assertion fails if the absorb has not landed. Replace the fixed sleep with a bounded poll for .stale-&lt;key&gt; = second_hash followed by the existing kill -0 &#34;$pid&#34; liveness check - strictly stronger, because the absorb and surface branches are mutually exclusive within a poll.
🔧 **Test** - 2 issues found → auto-fixed (2) ✅
  • ⚠️ tests/fm-watch-checkpoint.test.sh:133 - tests/fm-watch-checkpoint.test.sh::test_delivered_terminal_footer_checkpoint_is_quiet asserted a quiet checkpoint over a 2-second window, but the pre-fix watcher surfaces that exact fixture at ~2.0-2.2s, so the test passed on base commit 58f18ad and could not detect a regression of the fix. Auto-fixed by using the same 8s window its undelivered sibling uses; it now fails on 58f18ad and passes on 6481451.
  • ⚠️ tests/fm-watch-triage.test.sh:658 - tests/fm-watch-triage.test.sh::test_delivered_terminal_footer_change_is_absorbed waited a fixed 2.0s (and later 0.8s) before asserting that .stale-<key> advanced, which fails on correct code under load - 5 of 6 concurrent runs failed with 'stale bookkeeping did not advance'. Auto-fixed with an await_absorbed_stale poll that fails fast if the watcher surfaces instead; 6/6 pass under the same load and it still reproduces the bug on base 58f18ad.
  • bash tests/fm-watch-triage.test.sh (full file, 51 ok, exit 0, after the flake hardening)
  • bash tests/fm-watch-checkpoint.test.sh (full file, all ok, after raising the delivered-case window to 8s)
  • bash tests/fm-claude-stop-autoarm.test.sh (full file, all ok, includes test_delivered_terminal_footer_change_does_not_rewake_claude)
  • bash tests/fm-pi-watch-extension.test.sh (full file, all ok, includes test_delivered_terminal_footer_change_does_not_send_pi_followup)
  • Before/after reproduction: same four regression tests run against a checkout of base commit 58f18ad (bin/fm-watch.sh from git show 58f18ad:bin/fm-watch.sh) and against branch 6481451 - each fails before the fix, passes after
  • Manual end-to-end supervision scenario demo-footer-dedup.sh driving the real bin/fm-watch.sh and bin/fm-wake-drain.sh: delivery wake, 6 cosmetic footer redraws, then a genuine blocked: transition, run against both commits
  • Flake probe: 6 concurrent runs of test_delivered_terminal_footer_change_is_absorbed as committed (5/6 failed) vs the hardened version (6/6 passed) on the same branch watcher
  • Latency probe: timed the pre-fix Codex-checkpoint wake in the delivered fixture (~2.5s wall, 3 runs) to size the quiet window

🔧 Fix: fix flaky delivered-footer checkpoint test timing and lock assertion
3 issues (1 warning, 2 infos) still open:

  • ⚠️ tests/fm-pi-watch-extension.test.sh:152 - tests/fm-pi-watch-extension.test.sh::test_delivered_terminal_footer_change_does_not_send_pi_followup waited at most 6s (300 iterations x 20ms) for the watcher to surface, which is under the ~10s worst-case surface latency when several watcher suites overlap. Under concurrent load the undelivered case failed on correct code with 'undelivered footer state did not send one real Pi follow-up: sends=0 prompt=', and the delivered case had the same exposure via its 'never reached the delivered-terminal absorb' throw. Auto-fixed by widening the loop to a 60s failure bound; both exits are still driven by observed watcher state so success costs nothing extra, all four concurrent copies now pass, and the test still fails against the pre-fix watcher.
  • ℹ️ tests/fm-wake-queue.test.sh:742 - tests/fm-wake-queue.test.sh::test_self_held_lock_reclaims_instead_of_deadlocking fails with 'a subshell reclaimed its parent's live hold (rc=13)'. I ran this suite because it consumes the hash_text helper this change moved into tests/lib.sh. The failure reproduces identically at base commit 58f18ad with the base helper files restored, so it is a pre-existing baseline failure in bin/fm-wake-lib.sh lock semantics, outside this change's surface. Left untouched per the intent's instruction not to modify unrelated baseline failures.
  • ℹ️ tests/fm-pi-watch-extension.test.sh:1490 - When four copies of tests/fm-pi-watch-extension.test.sh run concurrently with other watcher suites, two timing-bound tests in that file fail non-deterministically: 'OpenCode watch plugin must arm only when this session owns the fleet lock' and 'Pi session transitions must rearm through an explicit generation owner'. Both are untouched by this change and both reproduce under the identical stress with the base 58f18ad version of the file, so this is pre-existing suite load sensitivity, not a regression. Serial runs and mixed-file concurrency are green.
  • ./tests/fm-watch-triage.test.sh (includes test_delivered_terminal_footer_change_is_absorbed)
  • ./tests/fm-watch-checkpoint.test.sh (includes test_delivered_terminal_footer_checkpoint_is_quiet, test_undelivered_terminal_footer_checkpoint_wakes_once)
  • ./tests/fm-claude-stop-autoarm.test.sh (includes test_delivered_terminal_footer_change_does_not_rewake_claude)
  • ./tests/fm-pi-watch-extension.test.sh (includes test_delivered_terminal_footer_change_does_not_send_pi_followup)
  • ./tests/fm-documentation-audiences.test.sh — consumer of the changed README.md / docs/architecture.md
  • ./tests/fm-wake-queue.test.sh — consumer of the hash_text helper moved into tests/lib.sh
  • Pre-fix reproduction: git show 58f18ad:bin/fm-watch.sh &gt; bin/fm-watch.sh then re-ran all four focused suites, restoring with git checkout -- bin/fm-watch.sh
  • Manual end-to-end supervision transcript: FM_DEMO_WORKTREE=$PWD bash delivered-footer-demo.sh — real bin/fm-watch.sh at base 58f18ad vs HEAD over the same delivered-status changing-footer fixture
  • Manual CLI transcript: FM_DEMO_WORKTREE=$PWD bash checkpoint-cli-demo.sh — bin/fm-watch-checkpoint.sh --seconds 20 (delivered, exit 124) and --seconds 60 (undelivered, exit 0)
  • Flake investigation: 4 concurrent copies of ./tests/fm-pi-watch-extension.test.sh alongside the triage/claude/checkpoint suites, repeated on HEAD and on base 58f18ad as a control
  • Leak check: ps -eo pid,command | grep &#39;bin/fm-watch\.sh$&#39; after the Pi suite — no orphaned watcher processes

🔧 Fix: widen Pi footer test wait bound past watcher surface latency
✅ Re-checked - no issues remain.

  • bin/fm-test-run.sh tests/fm-watch-triage.test.sh tests/fm-watch-checkpoint.test.sh — green, including test_delivered_terminal_footer_change_is_absorbed, test_delivered_terminal_footer_checkpoint_is_quiet, test_undelivered_terminal_footer_checkpoint_wakes_once
  • bin/fm-test-run.sh tests/fm-claude-stop-autoarm.test.sh tests/fm-pi-watch-extension.test.sh — green, including test_delivered_terminal_footer_change_does_not_rewake_claude and the Pi sendUserMessage footer case
  • bin/fm-test-run.sh tests/fm-documentation-audiences.test.sh — green (consumer of the changed README.md and docs/architecture.md prose contract)
  • Regression proof: git archive 58f18ad | tar -x -C &lt;tmp&gt; + git archive 5d9a793 tests | tar -x -C &lt;tmp&gt;, then bash tests/fm-watch-triage.test.sh, bash tests/fm-watch-checkpoint.test.sh, bash tests/fm-claude-stop-autoarm.test.sh, bash tests/fm-pi-watch-extension.test.sh against the pre-fix tree — all four fail there
  • Manual end-to-end supervision demo driving the real bin/fm-watch.sh with the repo's hermetic backend fakes, re-arming only on watcher exit (footer-redraw-demo.sh, run against both base 58f18ad and HEAD 5d9a793)
  • Enqueue-ordering invariant + the hash_text helper moved into tests/lib.sh: ran test_stale_enqueue_before_suppressor and test_not_working_stale_enqueue_before_suppressor from tests/fm-wake-queue.test.sh in isolation — both pass
  • git status --porcelain and pgrep -fl fm-watch.sh after testing — worktree clean, no leaked watcher processes
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

@peterOC26
peterOC26 merged commit 60f291b into main Aug 20, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant