Repository navigation
fix: preserve durable failures for refused host rewakes - #58
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
Evidence: Isolated before/after reproduction (uses fixtures; not live)
Source: Isolated before/after reproduction (uses fixtures; not live)
Evidence: Real Claude workspace-trust blocker
Source: Real Claude workspace-trust blocker
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
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 failedand 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 acaseon 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.git diff d37fbbdae178529d2ac7a0ff9cd02b4577bd4425 b9b34076095adcac4e1b339b8f29f93aae8230d7TMPDIR="$PWD/.test-autoarm-tmp" bash tests/fm-claude-stop-autoarm.test.sh— passedTMPDIR="$PWD/.test-autoarm-tmp" bash tests/.nm-autoarm-focused.sh— temporary fixture probe compared base and target behavior, repeated failures, acknowledged markers, and superseded ownershipclaude --versionandclaude auth status— installed Claude 2.1.319 reported an active loginLaunchedclaudefrom the gate worktree in a marked lab home through privatetmux -L fm-lab, using a 120×40 terminal; captured the workspace-trust dialogStopped 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.