Skip to content

fix: preserve durable failures for refused host rewakes - #58

Merged
peterOC26 merged 3 commits into
mainfrom
fm/fm-autoarm-lost-close-durable-a1
Nov 12, 2026
Merged

peterOC26 merged 3 commits into
mainfrom
fm/fm-autoarm-lost-close-durable-a1

Conversation

@peterOC26

Copy link
Copy Markdown
Owner

Intent

In bin/fm-claude-stop-autoarm.sh, when HOST_MODE=1, this generation is still the owner, and an actionable close was already printed, a failed rewake commit exits 0 silently. The rewake commit requires this session's lock and a pending or announced downtime marker, and a failed rewake while that marker is still downtime falls past the handling-marker fallback straight to that silent exit. The harness discards stderr on exit 0, so the already-printed actionable close is never delivered and nothing durable records the loss. That left this home unsupervised for 27 hours on 2026-11-10/11 (together with the handoff-acknowledgement gap, which is already fixed by config/supervision-handoff-ack). Fix: in that case commit a durable terminal outcome (the autoarm_commit failed/interrupted record plus the failure notice, which the guard and session start already read) instead of exit 0. An owning generation whose rewake commit is refused must leave that durable evidence.
Approved in the firstmate upkeep batch (Q1994): Grok builds, DeepSeek checks.

What Changed

  • Commit a durable failure and deliver the actionable host close when the owning generation’s rewake is refused while downtime remains pending or announced.
  • Document the fallback and add regression coverage for session-lock changes, both downtime marker states, and repeated failure-notice suppression.

Risk Assessment

✅ Low: The change adds one narrowly scoped HOST_MODE fallback. It runs only for an owning generation that has already printed an actionable close and whose rewake commit was refused while the recovery marker is still pending or announced downtime. It uses the existing autoarm_commit failed and autoarm_exit_suppressed protocol, so supersession still fails silently and the once-per-episode notice and alarm rules still apply, as the user intent requires. A behavioral test covers both the first and the repeated refusal.

Testing

The targeted behavior tests and fixture-based before/after reproduction passed; the real Claude launch produced a terminal transcript showing workspace trust blocked hook execution, and all temporary lab files were cleaned up.

  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
An owning generation loses its session lock during an actionable close with pending or announced downtime and records a durable failure ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
A repeated refused rewake preserves continuation without repeating the failure notice ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
An already-acknowledged close remains silent and creates no false failure ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
A superseded generation remains silent and leaves the successor's outcome untouched ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
Evidence: Isolated before/after reproduction (uses fixtures; not live)

Source: Isolated before/after reproduction (uses fixtures; not live)

ISOLATED BEHAVIORAL REPRODUCTION: fake Claude ancestry and host fixtures; NOT live Claude delivery.

CASE revision=base marker=refused-downtime attempt=1 exit=0
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
Persisted recovery marker: pending:downtime:fixture-generation
Persisted epoch ledger:
epoch=1 owner_pid=3448250 outcome=arming updated_at=1794469537
linux-starttime=112593548 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f626173652d726566757365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800
Failure-notified marker: ABSENT

CASE revision=target marker=refused-downtime attempt=1 exit=2
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
firstmate watcher auto-arm FAILED - the supervision host returned an actionable wake, but its rewake could not be committed.
Persisted recovery marker: pending:downtime:fixture-generation
Persisted epoch ledger:
epoch=1 owner_pid=3448876 outcome=failed updated_at=1794469539
linux-starttime=112593642 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f7461726765742d726566757365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800
Failure-notified marker: PRESENT

CASE revision=target marker=refused-downtime attempt=2 exit=2
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
firstmate watcher auto-arm rewake refused - the supervision host returned an actionable wake, but its rewake could not be committed, and the failure episode notice was already consumed; no operator notice repeats in this episode, and this suppressed continuation keeps the Stop-owned retry alive.
Persisted epoch ledger:
epoch=2 owner_pid=3449392 outcome=failed-suppressed updated_at=1794469540
linux-starttime=112593733 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f7461726765742d726566757365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800

CASE revision=base marker=refused-announced-downtime attempt=1 exit=0
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
Persisted recovery marker: announced:downtime:fixture-generation
Persisted epoch ledger:
epoch=1 owner_pid=3449877 outcome=arming updated_at=1794469540
linux-starttime=112593835 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f626173652d726566757365642d616e6e6f756e6365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800
Failure-notified marker: ABSENT

CASE revision=target marker=refused-announced-downtime attempt=1 exit=2
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
firstmate watcher auto-arm FAILED - the supervision host returned an actionable wake, but its rewake could not be committed.
Persisted recovery marker: announced:downtime:fixture-generation
Persisted epoch ledger:
epoch=1 owner_pid=3450355 outcome=failed updated_at=1794469541
linux-starttime=112593911 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f7461726765742d726566757365642d616e6e6f756e6365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800
Failure-notified marker: PRESENT

CASE revision=target marker=refused-announced-downtime attempt=2 exit=2
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
firstmate watcher auto-arm rewake refused - the supervision host returned an actionable wake, but its rewake could not be committed, and the failure episode notice was already consumed; no operator notice repeats in this episode, and this suppressed continuation keeps the Stop-owned retry alive.
Persisted epoch ledger:
epoch=2 owner_pid=3451056 outcome=failed-suppressed updated_at=1794469542
linux-starttime=112593988 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f7461726765742d726566757365642d616e6e6f756e6365642d646f776e74696d652f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800

CASE revision=target marker=benign-refusal attempt=1 exit=0
firstmate watcher wake - one supervision event needs a handling turn now.
signal: fixture.status
supervision-host: branch-outcome: fixture
Run bin/fm-wake-drain.sh first, handle the wake, then run its exact WAKE_ACK_REQUIRED --ack-through command. Until that post-handling acknowledgement, interruption leaves the wake durable for idempotent re-handling. This Stop hook owns watcher continuity: when the handling turn ends, the next needed cycle arms automatically - do NOT run bin/fm-watch-arm.sh after an ordinary wake.
Persisted recovery marker: acked:downtime:fixture-generation
Persisted epoch ledger:
epoch=1 owner_pid=3451784 outcome=arming updated_at=1794469543
linux-starttime=112594075 cmdline-hex=62617368002f686f6d652f7a6162692f2e6e6f2d6d697374616b65732f776f726b74726565732f3766306563313831383162362f30314d3737423834385a5238524d364e30484747474a5a4152302f2e746573742d6175746f61726d2d746d702f666d2d636c617564652d73746f702d6175746f61726d2e79747742564c2f7461726765742d62656e69676e2d7265667573616c2f62696e2f666d2d636c617564652d73746f702d6175746f61726d2e736800
Failure-notified marker: ABSENT
ok - auto-arm: a superseded owner goes silent - one supersession episode, one translation, no held mutex
Evidence: Real Claude workspace-trust blocker

Source: Real Claude workspace-trust blocker

Claude 2.1.319; marked lab FM_HOME inside gate worktree; private socket minted by fm-lab-home tmux-dir; 120x40 terminal.

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 Accessing workspace:

 ~/.no-mistakes/worktrees/7f0ec18181b6/01M77B848ZR8RM6N0HGGGJZAR0

 Quick safety check: Is this a project you created or one you trust? (Like your own code, a well-known open source
 project, or work from your team). If not, take a moment to review what's in this folder first.

 Claude Code'll be able to read, edit, and execute files here.

 Security guide

 ❯ No, exit
   Yes, I trust this folder

 Enter to confirm · Esc to cancel
























RESULT: workspace trust blocks hook execution. No trust choice was submitted and no user configuration was edited. Private tmux server stopped and marked lab removed.
- Outcome: ⚠️ 2 warnings across 1 run (4m25s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ tests/fm-claude-stop-autoarm.test.sh:2136 - The new test and its comment were inserted between the existing comment for test_host_benign_rewake_refusal_opens_no_failure_episode (lines 2136-2138, 'Main already drained and acknowledged the wake…') and that function (line 2169). That comment now sits above the new assert_host_refused_downtime_rewake_leaves_durable_failure helper, where it describes the opposite case. The new comment also says 'An acknowledged marker stays the benign case above', but the benign test now comes after it. Fix: move the new comment and both new functions so they sit above the benign test's comment, or after the benign test, and change 'above' to match.
  • ℹ️ bin/fm-claude-stop-autoarm.sh:744 - The new downtime fallback (lines 744-754) copies the handling fallback at lines 729-740 almost line for line: the same owner check, marker snapshot, notice-consumed suppression, FAILED banner, autoarm_commit failed and exit 2. Only three things differ: which marker kinds match, the healthy-watcher check (handling only), and the wording of the suppression cause. One block that snapshots the marker once and uses a case on FM_RECOVERY_MARKER_TOKEN (handling kinds need ! fm_watcher_healthy, downtime kinds always qualify) would remove the duplicate snapshot and commit sequence and keep the two refusal paths from drifting apart. This is a non-functional refactor.
⚠️ **Test** - 2 warnings
  • ⚠️ Live hook delivery could not be demonstrated: Claude stopped at workspace trust. A person must approve this worktree interactively before rerunning live validation; this phase cannot change user-level Claude configuration.
  • ⚠️ live validation verdict: inconclusive (0 of 4 scenarios were driven live against the product); untested: An owning generation loses its session lock during an actionable close with pending or announced downtime and records a durable failure, A repeated refused rewake preserves continuation without repeating the failure notice, An already-acknowledged close remains silent and creates no false failure, A superseded generation remains silent and leaves the successor's outcome untouched
  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
An owning generation loses its session lock during an actionable close with pending or announced downtime and records a durable failure ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
A repeated refused rewake preserves continuation without repeating the failure notice ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
An already-acknowledged close remains silent and creates no false failure ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
A superseded generation remains silent and leaves the successor's outcome untouched ⏸️ untested no Real Claude stopped at workspace trust before hooks could run. Approve the worktree interactively and rerun.
  • git diff d37fbbdae178529d2ac7a0ff9cd02b4577bd4425 b9b34076095adcac4e1b339b8f29f93aae8230d7
  • TMPDIR="$PWD/.test-autoarm-tmp" bash tests/fm-claude-stop-autoarm.test.sh — passed
  • TMPDIR="$PWD/.test-autoarm-tmp" bash tests/.nm-autoarm-focused.sh — temporary fixture probe compared base and target behavior, repeated failures, acknowledged markers, and superseded ownership
  • claude --version and claude auth status — installed Claude 2.1.319 reported an active login
  • Launched claude from the gate worktree in a marked lab home through private tmux -L fm-lab, using a 120×40 terminal; captured the workspace-trust dialog
  • Stopped the private tmux server, removed the lab and temporary probe files, and confirmed a clean worktree
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

peterOC26 and others added 3 commits November 12, 2026 07:26
An owning generation that already printed an actionable host close exited 0
when the rewake commit failed while the recovery marker was still downtime.
Commit the failure episode instead, so the loss is recorded and delivered.
@peterOC26
peterOC26 merged commit 79338f2 into main Nov 12, 2026
57 of 59 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