Skip to content

fix(bin): stop repeating unknown-wake escalations that were already delivered - #5599

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-4758
Sep 25, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-4758

Conversation

@tiago-peixoto

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

Copy link
Copy Markdown
Contributor

Intent

Fixes #4758.
Implement ready-for-pr issue #4758: fail-safe unknown-wake escalations repeat for already-handled events with no acknowledgement.

A wake reason the away daemon cannot classify escalates as unknown wake. That fail-safe is correct. The escalation has no acknowledgement path, so it repeats for an event already handled. Examples include unknown wake lines for decisions already closed and for an inactive terminal outcome already presented. An unknown wake that was handled should not re-present under the same event identity. A genuinely new unknown wake should still fire.

What Changed

  • bin/fm-supervise-daemon.sh: once an escalation digest reaches the supervisor, each unknown wake: line in it is written to state/.subsuper-unknown-acked. After that, escalate_add drops any line that matches an acknowledged line exactly. A new unknown wake, or one that is still only buffered or failed to deliver, still escalates. If the acknowledgement write fails, the daemon logs it and still clears the delivered buffer, so the only cost is that the wake may escalate again.
  • The ack file only lasts for one away session. fm-afk-start.sh and fm-afk-return.sh clear it with the other delivery artifacts. fm-afk-launch.sh backs it up and restores it alongside them.
  • The afk SKILL.md now describes the acknowledgement rules and lists the ack file among the session-scoped artifacts. The daemon, launch, and return tests are updated to cover the new behavior.

Fixes #4758.

Risk Assessment

✅ Low: The change is small and self-contained: it adds an exact-line acknowledgement file that is written only after a successful inject, cleared together with the other away-session artifacts, and included in launch backup and restore. The previous rounds' fixes check out. The in-buffer dedupe is gone, and a failed acknowledgement write now logs and clears the delivered digest. Both behaviors are covered by tests that run handle_wake and escalate_flush.

Testing

I ran the real away daemon, started through bin/fm-afk-start.sh, against an isolated private tmux server with a scripted supervisor pane, across three away sessions. All six live scenarios passed: a handled unknown wake was delivered once per session and not again; a new unknown wake and ordinary escalations were still delivered; starting a new session made the same wake deliverable again; and a failed acknowledgement write did not cause a second delivery. I did not drive the return catch-up (fm-afk-return.sh clearing the acknowledgement file) live, so it is marked untested. The scripted fm-afk-return test covers it and passed. The first harness attempt showed repeated deliveries, but that was my setup, not the product: I had used inactive-outcome: queue keys that the wake drain refuses to acknowledge without a matching reconcile record, so it replayed those rows every cycle. With neutral keys the run was clean. The targeted fm-daemon tests also passed. This change has no visual UI surface, so the evidence is the verbatim pane submissions and daemon log lines.

  • Live validation: ✅ go - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
An unknown wake while the captain is away (an inactive terminal outcome row) reaches the supervisor pane once and is recorded as acknowledged ✅ pass live unknown-wake-live-results.txt S1; supervisor-pane-submissions.txt line 1; ack file holds the exact 'unknown wake: ...' line
The same unknown-wake text arrives again in the same away session under a new queue key: it is not delivered again, and its queue row is still drained ✅ pass live unknown-wake-live-results.txt S2; daemon-log-excerpt.txt shows the second classification at 02:37:21 with no second pane submission
A different unknown wake (a closed-decision line) is still delivered after another wake was acknowledged ✅ pass live unknown-wake-live-results.txt S3; supervisor-pane-submissions.txt line 2
An ordinary escalation (a done: status) is still delivered each time and never written to the acknowledgement file ✅ pass live unknown-wake-live-results.txt S4; supervisor-pane-submissions.txt lines 3-4
A new away session started through fm-afk-start.sh clears the acknowledgements, so a wake handled in the previous session is delivered again ✅ pass live unknown-wake-live-results.txt S5; supervisor-pane-submissions.txt line 5
Adversarial: the acknowledgement file cannot be written (it is replaced by a directory). The digest is delivered exactly once, the buffer is cleared, and the failure is logged ✅ pass live unknown-wake-live-results.txt S6; daemon-log-excerpt.txt shows 'unknown-wake acknowledgement write failed'; supervisor-pane-submissions.txt line 6 appears once
The return catch-up (fm-afk-return.sh clear_delivery_artifacts) removes the acknowledgement file ⏸️ untested no The earlier payload did not show a live result for this scenario. Driving the return gate live needs a full captain return turn, which I did not run. The only coverage is the scripted test `bash tests…
Evidence: Live scenario results

Source: Live scenario results

=== Session 1: fresh away session via bin/fm-afk-start.sh
submitted lines after first unknown wake:
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
PASS: S1 first unknown wake escalates once to supervisor pane
PASS: S1 delivered unknown wake is recorded in state/.subsuper-unknown-acked
ack file:
  > unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1
PASS: S2 same unknown-wake identity re-presented is NOT escalated again
PASS: S2 re-presented wake row was drained/acked (not stuck in queue)
PASS: S3 genuinely new unknown wake still escalates
PASS: S4 ordinary (non-unknown) escalation still delivered and never written to ack file
submitted lines at end of session 1:
=== Session 2: new away session via bin/fm-afk-start.sh (fresh entry clears acknowledgements)
PASS: S5 fresh away-session entry cleared the acknowledgement file
PASS: S5 same identity handled in a PRIOR session fires again in the new session
=== Session 3: acknowledgement write fails after delivery
PASS: S6 digest delivered exactly once despite ack-write failure (no re-injection)
PASS: S6 escalation buffer cleared after delivery
PASS: S6 daemon logged the acknowledgement-write failure
=== Final supervisor-pane submissions (verbatim)
=== Daemon log excerpt
=== RESULTS
PASS S1 first unknown wake escalates once to supervisor pane
PASS S1 delivered unknown wake is recorded in state/.subsuper-unknown-acked
PASS S2 same unknown-wake identity re-presented is NOT escalated again
PASS S2 re-presented wake row was drained/acked (not stuck in queue)
PASS S3 genuinely new unknown wake still escalates
PASS S4 ordinary (non-unknown) escalation still delivered and never written to ack file
PASS S5 fresh away-session entry cleared the acknowledgement file
PASS S5 same identity handled in a PRIOR session fires again in the new session
PASS S6 digest delivered exactly once despite ack-write failure (no re-injection)
PASS S6 escalation buffer cleared after delivery
PASS S6 daemon logged the acknowledgement-write failure
KEPT_WORKDIR=/tmp/fm-unk-ack.LKNyzV
Evidence: Supervisor pane submissions (verbatim)

Source: Supervisor pane submissions (verbatim)

⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: decision closed already: needs-decision d-42 resolved by captain (pre-read; re-arm not needed — watcher daemon-managed)
⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: unrecognized widget event: w-9 (pre-read; re-arm not needed — watcher daemon-managed)
Evidence: Daemon log excerpt

Source: Daemon log excerpt

[2026-09-25T02:37:12+0200] daemon starting (pid 1485028); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
[2026-09-25T02:37:14+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 st
[2026-09-25T02:37:21+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 st
[2026-09-25T02:37:26+0200] escalate: decision closed already: needs-decision d-42 resolved by captain -> unknown wake: decision closed already: needs-decision d-42 resolved by captain
[2026-09-25T02:37:35+0200] escalate: signal: /tmp/fm-unk-ack.LKNyzV/home/state/c9.status -> c9.status: done: PR https://example.test/pull/77
[2026-09-25T02:37:41+0200] escalate: signal: /tmp/fm-unk-ack.LKNyzV/home/state/c9.status -> c9.status: done: PR https://example.test/pull/77
[2026-09-25T02:37:43+0200] daemon shutting down
[2026-09-25T02:37:44+0200] daemon starting (pid 1531485); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
[2026-09-25T02:37:46+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 st
[2026-09-25T02:37:51+0200] daemon shutting down
[2026-09-25T02:37:53+0200] daemon starting (pid 1546007); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
[2026-09-25T02:37:54+0200] escalate: unrecognized widget event: w-9 -> unknown wake: unrecognized widget event: w-9
[2026-09-25T02:37:56+0200] unknown-wake acknowledgement write failed; a delivered unknown wake may escalate again
[2026-09-25T02:38:04+0200] daemon shutting down
Evidence: Live driver script

Source: Live driver script

#!/usr/bin/env bash
# Live driver: runs the real away daemon (via bin/fm-afk-start.sh) against a
# private tmux socket with a fake supervisor composer that logs every submitted
# line. Unknown wakes are enqueued exactly as bin/fm-inactive-reconcile.sh does
# (fm_wake_append check <key> <payload>). Nothing touches the live fleet.
set -u
ROOT=${1:?repo root}
EVID=${2:?evidence dir}
REAL_TMUX=$(command -v tmux)
SOCKET="fm-unk-ack-$$"
W=$(mktemp -d "${TMPDIR:-/tmp}/fm-unk-ack.XXXXXX")
HOMEDIR="$W/home"; STATE="$HOMEDIR/state"; mkdir -p "$STATE"
LOGF="$W/submitted.log"; : > "$LOGF"
TR="$EVID/unknown-wake-live-transcript.txt"; : > "$TR"
DPID=
say() { printf '%s\n' "$*" | tee -a "$TR"; }
RESULTS=()
check() { if eval "$2"; then say "PASS: $1"; RESULTS+=("PASS $1"); else say "FAIL: $1"; RESULTS+=("FAIL $1"); fi; }
cleanup() {
  [ -n "$DPID" ] && { kill "$DPID" 2>/dev/null; wait "$DPID" 2>/dev/null; }
  "$REAL_TMUX" -L "$SOCKET" kill-server 2>/dev/null
  echo "KEPT_WORKDIR=$W"
}
trap cleanup EXIT

"$REAL_TMUX" -L "$SOCKET" new-session -d -s supervisor -x 200 -y 50
PANE=$("$REAL_TMUX" -L "$SOCKET" display-message -p -t supervisor '#{pane_id}')
cat > "$W/loop.sh" <<'LOOP'
#!/usr/bin/env bash
LOG="$1"; stty -echo -icanon min 1 time 0 2>/dev/null
_buf=
redraw() { printf '\r\033[K\xe2\x9d\xaf %s' "$_buf"; }
submit() { printf '%s\n' "$_buf" >> "$LOG"; _buf=; printf '\r\033[K\n'; redraw; }
redraw
while IFS= read -r -n 1 c; do
  if [ -z "$c" ]; then submit; continue; fi
  case "$c" in $'\r'|$'\n') submit ;; *) _buf="$_buf$c"; redraw ;; esac
done
LOOP
"$REAL_TMUX" -L "$SOCKET" send-keys -t "$PANE" "bash '$W/loop.sh' '$LOGF'" Enter
sleep 1
"$REAL_TMUX" -L "$SOCKET" new-window -d -n fm-c9 -t supervisor
mkdir -p "$W/shim"
printf '#!/usr/bin/env bash\nexec "%s" -L "%s" "$@"\n' "$REAL_TMUX" "$SOCKET" > "$W/shim/tmux"; chmod +x "$W/shim/tmux"

start_session() {  # fresh away-session entry through the real entry point
  PATH="$W/shim:$PATH" FM_HOME="$HOMEDIR" FM_STATE_OVERRIDE="$STATE" \
  FM_SUPERVISOR_TARGET="$PANE" FM_SUPERVISOR_BACKEND=tmux \
  FM_ESCALATE_BATCH_SECS=0 FM_HOUSEKEEPING_TICK=1 FM_POLL=1 FM_SIGNAL_GRACE=1 \
  FM_HEARTBEAT=3 FM_CHECK_INTERVAL=999999 FM_STALE_ESCALATE_SECS=999999 \
  FM_INJECT_CONFIRM_SLEEP=0.3 FM_INJECT_CONFIRM_RETRIES=5 FM_WEDGE_ALARM_EXEC=discard \
    "$ROOT/bin/fm-afk-start.sh" >"$W/daemon.out" 2>"$W/daemon.err" &
  DPID=$!
  for _ in $(seq 60); do [ -f "$STATE/.supervise-daemon.pid" ] && break; sleep 0.2; done
  [ -f "$STATE/.supervise-daemon.pid" ] || { cat "$W/daemon.err"; say "daemon did not start"; exit 1; }
}
stop_session() { kill "$DPID" 2>/dev/null; wait "$DPID" 2>/dev/null; DPID=; sleep 1; }
enqueue() {  # <key> <payload>  same call bin/fm-inactive-reconcile.sh publish_actionable makes
  ( STATE="$STATE"; FM_HOME="$HOMEDIR"; . "$ROOT/bin/fm-wake-lib.sh"; fm_wake_append check "$1" "$2" )
}
wait_drained() { for _ in $(seq 40); do [ -s "$STATE/.wake-queue" ] || { sleep 3; return 0; }; sleep 0.5; done; return 1; }
digests() { grep -c 'Supervisor escalate' "$LOGF" || true; }
count_in_log() { grep -cF -- "$1" "$LOGF" || true; }
A="inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1"
B="decision closed already: needs-decision d-42 resolved by captain"

say "=== Session 1: fresh away session via bin/fm-afk-start.sh"
start_session
enqueue "presentation:fp1" "$A"; wait_drained
say "submitted lines after first unknown wake:"; sed 's/^/  | /' "$LOGF" | tee -a "$TR" >/dev/null; cat "$LOGF" | sed 's/^/  | /'
check "S1 first unknown wake escalates once to supervisor pane" '[ "$(count_in_log "unknown wake: $A")" = 1 ]'
check "S1 delivered unknown wake is recorded in state/.subsuper-unknown-acked" 'grep -Fxq "unknown wake: $A" "$STATE/.subsuper-unknown-acked"'
say "ack file:"; sed 's/^/  > /' "$STATE/.subsuper-unknown-acked" | tee -a "$TR"

enqueue "presentation:fp1-again" "$A"; wait_drained
check "S2 same unknown-wake identity re-presented is NOT escalated again" '[ "$(count_in_log "unknown wake: $A")" = 1 ] && [ "$(digests)" = 1 ]'
check "S2 re-presented wake row was drained/acked (not stuck in queue)" '[ ! -s "$STATE/.wake-queue" ]'

enqueue "decision:d-42" "$B"; wait_drained
check "S3 genuinely new unknown wake still escalates" '[ "$(count_in_log "unknown wake: $B")" = 1 ] && [ "$(digests)" = 2 ]'

printf 'done: PR https://example.test/pull/77\n' > "$STATE/c9.status"; sleep 6
printf 'done: PR https://example.test/pull/77\n' >> "$STATE/c9.status"; sleep 6
check "S4 ordinary (non-unknown) escalation still delivered and never written to ack file" '[ "$(count_in_log "pull/77")" -ge 1 ] && ! grep -q "pull/77" "$STATE/.subsuper-unknown-acked"'
say "submitted lines at end of session 1:"; sed 's/^/  | /' "$LOGF" | tee -a "$TR" >/dev/null
stop_session

say "=== Session 2: new away session via bin/fm-afk-start.sh (fresh entry clears acknowledgements)"
rm -f "$STATE/c9.status"
before=$(digests)
start_session
check "S5 fresh away-session entry cleared the acknowledgement file" '[ ! -e "$STATE/.subsuper-unknown-acked" ] || ! grep -Fq "unknown wake: $A" "$STATE/.subsuper-unknown-acked" || [ "$(count_in_log "unknown wake: $A")" = 2 ]'
enqueue "presentation:fp1-session2" "$A"; wait_drained
check "S5 same identity handled in a PRIOR session fires again in the new session" '[ "$(count_in_log "unknown wake: $A")" = 2 ]'
stop_session

say "=== Session 3: acknowledgement write fails after delivery"
start_session
rm -f "$STATE/.subsuper-unknown-acked"; mkdir "$STATE/.subsuper-unknown-acked"
C="unrecognized widget event: w-9"
enqueue "widget:w9" "$C"; wait_drained; sleep 4
check "S6 digest delivered exactly once despite ack-write failure (no re-injection)" '[ "$(count_in_log "unknown wake: $C")" = 1 ]'
check "S6 escalation buffer cleared after delivery" '[ ! -s "$STATE/.subsuper-escalations" ]'
check "S6 daemon logged the acknowledgement-write failure" 'grep -rqs "unknown-wake acknowledgement write failed" "$STATE"/*.log "$STATE"/.*log* 2>/dev/null'
stop_session

say "=== Final supervisor-pane submissions (verbatim)"; sed 's/^/  | /' "$LOGF" | tee -a "$TR" >/dev/null
say "=== Daemon log excerpt"; ls -a "$STATE" | grep -i log | tee -a "$TR" >/dev/null
for f in "$STATE"/*daemon*log* "$STATE"/.*daemon*log*; do [ -f "$f" ] && grep -E "escalate: |acknowledgement|daemon starting|shutting" "$f" | sed 's/^/  L /' | tee -a "$TR" >/dev/null; done
say "=== RESULTS"; printf '%s\n' "${RESULTS[@]}" | tee -a "$TR"
Evidence: Live transcript

Source: Live transcript

=== Session 1: fresh away session via bin/fm-afk-start.sh
submitted lines after first unknown wake:
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
PASS: S1 first unknown wake escalates once to supervisor pane
PASS: S1 delivered unknown wake is recorded in state/.subsuper-unknown-acked
ack file:
  > unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1
PASS: S2 same unknown-wake identity re-presented is NOT escalated again
PASS: S2 re-presented wake row was drained/acked (not stuck in queue)
PASS: S3 genuinely new unknown wake still escalates
PASS: S4 ordinary (non-unknown) escalation still delivered and never written to ack file
submitted lines at end of session 1:
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: decision closed already: needs-decision d-42 resolved by captain (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
=== Session 2: new away session via bin/fm-afk-start.sh (fresh entry clears acknowledgements)
PASS: S5 fresh away-session entry cleared the acknowledgement file
PASS: S5 same identity handled in a PRIOR session fires again in the new session
=== Session 3: acknowledgement write fails after delivery
PASS: S6 digest delivered exactly once despite ack-write failure (no re-injection)
PASS: S6 escalation buffer cleared after delivery
PASS: S6 daemon logged the acknowledgement-write failure
=== Final supervisor-pane submissions (verbatim)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: decision closed already: needs-decision d-42 resolved by captain (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): c9.status: done: PR https://example.test/pull/77 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 (pre-read; re-arm not needed — watcher daemon-managed)
  | ⁣FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate (1 event(s)): unknown wake: unrecognized widget event: w-9 (pre-read; re-arm not needed — watcher daemon-managed)
=== Daemon log excerpt
.supervise-daemon.log
.watch-deliveries.log
  L [2026-09-25T02:37:12+0200] daemon starting (pid 1485028); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
  L [2026-09-25T02:37:14+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1
  L [2026-09-25T02:37:21+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1
  L [2026-09-25T02:37:26+0200] escalate: decision closed already: needs-decision d-42 resolved by captain -> unknown wake: decision closed already: needs-decision d-42 resolved by captain
  L [2026-09-25T02:37:35+0200] escalate: signal: /tmp/fm-unk-ack.LKNyzV/home/state/c9.status -> c9.status: done: PR https://example.test/pull/77
  L [2026-09-25T02:37:41+0200] escalate: signal: /tmp/fm-unk-ack.LKNyzV/home/state/c9.status -> c9.status: done: PR https://example.test/pull/77
  L [2026-09-25T02:37:43+0200] daemon shutting down
  L [2026-09-25T02:37:44+0200] daemon starting (pid 1531485); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
  L [2026-09-25T02:37:46+0200] escalate: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1 -> unknown wake: inactive terminal outcome awaiting captain presentation: child=c1 state=done pr=https://example.test/pull/1
  L [2026-09-25T02:37:51+0200] daemon shutting down
  L [2026-09-25T02:37:53+0200] daemon starting (pid 1546007); target=%0; target_source=FM_SUPERVISOR_TARGET; backend=tmux; backend_source=FM_SUPERVISOR_BACKEND; afk=on; inject_skip='heartbeat'; stale_escalate=999999s; batch=0s
  L [2026-09-25T02:37:54+0200] escalate: unrecognized widget event: w-9 -> unknown wake: unrecognized widget event: w-9
  L [2026-09-25T02:37:56+0200] unknown-wake acknowledgement write failed; a delivered unknown wake may escalate again
  L [2026-09-25T02:38:04+0200] daemon shutting down
=== RESULTS
PASS S1 first unknown wake escalates once to supervisor pane
PASS S1 delivered unknown wake is recorded in state/.subsuper-unknown-acked
PASS S2 same unknown-wake identity re-presented is NOT escalated again
PASS S2 re-presented wake row was drained/acked (not stuck in queue)
PASS S3 genuinely new unknown wake still escalates
PASS S4 ordinary (non-unknown) escalation still delivered and never written to ack file
PASS S5 fresh away-session entry cleared the acknowledgement file
PASS S5 same identity handled in a PRIOR session fires again in the new session
PASS S6 digest delivered exactly once despite ack-write failure (no re-injection)
PASS S6 escalation buffer cleared after delivery
PASS S6 daemon logged the acknowledgement-write failure

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (3) ✅
  • ⚠️ bin/fm-supervise-daemon.sh:498 - The unknown-wake acknowledgement file state/.subsuper-unknown-acked is append-only and nothing ever clears or prunes it. fm_afk_clear_stale_artifacts (bin/fm-afk-start.sh:64), the fm-afk-launch.sh artifact lists (488-494, 618, 675) and clear_delivery_artifacts (bin/fm-afk-return.sh:256) all delete the escalation buffer but leave this file. The only identity is the exact distilled text. Concrete case: fm-inactive-reco