Skip to content

fix: let the Stop auto-arm claim an unowned session lock; verify the wedge alarm at away entry - #4943

Open
marcospaterson wants to merge 1 commit into
kunchenguid:mainfrom
marcospaterson:fm/4927-autoarm-unowned-lock
Open

marcospaterson wants to merge 1 commit into
kunchenguid:mainfrom
marcospaterson:fm/4927-autoarm-unowned-lock

Conversation

@marcospaterson

Copy link
Copy Markdown

Fixes #4927. Addresses the entry half of #4928.

The problem

A home whose watcher has exited cannot recover on its own. The turn-end guard reports TURN WOULD END BLIND every turn, the auto-arm runs but does nothing, and the operator is pushed into the manual arm loop the supervision instructions explicitly forbid.

Observed on a live home with in-flight work over several hours: state/.claude-autoarm-epoch stayed frozen at one record across many turn ends while the guard fired each time, and the arm wrapper run by hand succeeded immediately every time.

The cause, which is not what the issue first guessed

The issue speculated that the guard's blocking exit prevented the second same-group Stop hook from running. That is wrong, and worth correcting for anyone reading #4927: on Claude 2.1.278 both same-group Stop hooks run in parallel, verified while investigating. The auto-arm does run.

The real cause is that the arm exits early when the session lock is absent or malformed, so it runs, claims nothing, and returns without arming, while the guard keeps blocking on the resulting absence of a watcher.

The change

  • The Stop auto-arm may claim an unowned session lock rather than exiting early, so a home with no live watcher recovers automatically within one turn end.
  • At away-mode entry, the wedge alarm is verified rather than assumed, so a broken escalation channel fails loudly at entry instead of silently hours later. This is the entry half of Away daemon can run for hours delivering nothing; wedge is visible only in its own log #4928; it does not address a channel that wedges mid-window, and that issue should stay open for it.

Verification

  • Regression test reproduces the pre-fix state, in-flight work with no live watcher and an unowned lock, and fails on the unfixed code.
  • The original symptom was reproduced on a live home before anything was changed, rather than working from the report alone.
  • ShellCheck could not run in the pipeline on this machine because the binary is not installed there; it was run locally and is clean.

Note for reviewers

This was found while the fix's own home was losing supervision, so the manual arm workaround was in use throughout. The guard itself is unchanged and still blocks a genuinely blind stop; only the arm's lock handling changed.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: waiting-author (contract-class: new-default). Prefer sibling #4955 for the same #4927 fix.

Tip check (b6930db737c382533120d6005ac515478eb6f083): same unowned-lock inertness bug as #4955. This HEAD claims absent/malformed locks and adds away-entry wedge verify, but does not add the guard FM_CLAUDE_AUTOARM_LOCK_CLAIM_WAIT_MS allowance that #4955 needs for the integrated self-heal regression under load. Based on older tip than #4955.

Does it close #4927? Would, if preferred — same lock-claim restore invariant. Body correctly says it only covers the entry half of #4928; leave #4928 open. We are not landing this while #4955 is open and strictly stronger.

Contract-class: new-default — same mix as #4955 (restore lock-claim + new default-on away-entry verify). Cannot auto-merge.

VISION.md (each rule) — same verdicts as #4955 (aligns on peace-of-mind / restart / scripts / spine / fleet / scope; tension on Authority for the new away-start refusal).

Checks: MERGEABLE / UNSTABLE. Attestation MISSING. First-time fork CI: workflow-approved. If #4955 merges, this will be closed-overlap with a thank-you naming #4955 — please do not keep both open after one lands.

Security FYI: none material.

No Firstmate escalation. Help #4955 (rebase/attest there) rather than advancing this duplicate.

mremond added a commit to mremond/firstmate that referenced this pull request Sep 25, 2026
… work is spent

Refs kunchenguid#4018

Limits, stated as limits:
- It closes nothing. Every forge call is a read, including in the opt-in
  --sweep mode: no issue is closed, labelled, or commented on, and no backlog
  is read or written. It is the evidence half of the claim problem, not the
  loop closure the triage also leaves open.
- A fix that cites the issue number nowhere - no PR body, branch, or title,
  no commit message, and no --symbol the caller supplies - stays invisible to
  every check.

bin/fm-issue-claim.sh runs five read-only checks per issue and prints an
inspectable verdict (open, claimed, partially-covered, fixed-on-main, or
unknown): timeline cross-references, maintainer triage stamps (OWNER, MEMBER,
or COLLABORATOR only; the existing-pr target PR is read for its current
state), the complete open-PR corpus fetched by paginated REST and checked
against the search API total, the issue author's fork branches (resolved to
the PR each heads), and main history since the issue opened (commit messages
citing the issue, plus optional caller --symbol pickaxe searches). Issue
numbers match only as whole numbers, so 4018 never matches 40181, and a
foreign owner/repo#N is not a citation. A failed or rate-limited read, a
short or unverified corpus, or a history ref that cannot be searched yields
unknown or an explicit disclosure, never open. One corpus is shared across
every issue in a run and can be saved and reused across runs with its
completeness verdict and age.

--sweep is opt-in and report-only: one disposition line per issue
(close-candidate, leave-open, no-action, undetermined) with link candidates,
judged only from durable evidence and never from titles, branches, PR checks,
reviews, or mergeability. An issue with a live PR stamped existing-pr is
always leave-open, and merged evidence with incomplete coverage is
undetermined rather than a close candidate.

Live proof against kunchenguid/firstmate, 2026-09-23, history ref
origin/main@9296f9b9, open-PR corpus 1261/1261:
- kunchenguid#4927 claimed, reproduced: PR kunchenguid#4943 and PR kunchenguid#4955 (timeline, corpus, fork,
  and the maintainer existing-pr stamp on kunchenguid#4955), plus kunchenguid#4026 named by the
  earlier stamp and still open.
- kunchenguid#3370 fixed-on-main, reproduced: commit baede47 (kunchenguid#4656), found only by
  the history check with --symbol 3370:rerecord_device, issue still open.
- kunchenguid#4412 partially-covered, reproduced: PR kunchenguid#4775 merged (landed as 9bc051f)
  and PR kunchenguid#4832 open.
- kunchenguid#4466 open, reproduced, with every check complete.
- Reporter's cases in one --sweep: kunchenguid#3966 claimed by PR kunchenguid#3977 and kunchenguid#3942
  claimed by PR kunchenguid#3978 (leave-open); kunchenguid#3928 (PR kunchenguid#3946) and kunchenguid#3926 (PR kunchenguid#3944)
  show fixed-on-main and have since been closed on the forge (no-action).
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.

Turn-end guard blocks the same-group Stop hook that restores the watcher, so missing supervision cannot self-heal

2 participants