Repository navigation
Conversation
…session The Stop-owned watcher auto-arm proved its right to act with harness ancestry alone: state/.lock had to name one of the hook process's own contiguous harness ancestors. Claude Code serves hook and tool commands from a shared per-user worker pool (claude bg-spare -> claude bg-pty-host -> claude daemon run), and a pool whose owning session has since exited survives with its top process reparented to init. A hook served by such a pool has a contiguous claude ancestry that never reaches the live session, so the check failed for the session's own hook and the script exited 0 silently. Watcher continuity then depended entirely on the synchronous guard, which blocked every turn end instead. Add a second, ancestry-independent membership proof in the lib that owns this decision, and accept either. The new proof is a conjunction: the delivered payload names a session id, the delivering session exported that same session id, the session pid it exported is exactly the pid this home's lock records, and that pid is still a live Claude process. Pid equality is stricter than ancestry membership, so a session that does not hold the lock still cannot claim the home, and separate firstmate homes on one machine stay independent. Nothing is removed: the ancestry proof and every other gate are unchanged. Add FM_AUTOARM_TRACE, an opt-in stderr diagnostic that names the gate ending a run, so an inert hook can be diagnosed under real hook conditions without changing any decision. Tests cover a hook that cannot reach its own session claiming its home, a foreign session refused, an unconfirmed or malformed identity refused, a missing or malformed recorded owner refused, and two homes on one machine staying independent. The opt-in live guard additionally fails, naming the harness and version, if Claude stops delivering the identity the proof depends on or stops matching the recorded owner.
|
Closed as superseded — this work already landed on main by another change. — Kun's Firstmate |
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
GOAL: Fix the Claude Stop-owned watcher auto-arm (bin/fm-claude-stop-autoarm.sh), which NEVER claims the home. Every turn end is blocked by the "TURN WOULD END BLIND" guard, and the captain has seen that error on every exchange for two days.
This changes firstmate's shared tracked material, so .agents/skills/firstmate-coding-guidelines/SKILL.md was read first and applied (knowledge-placement decision tree, one-owner rule, size discipline, harness-dependent-check rule, repo style rules).
ROOT CAUSE (established before this work started; it was NOT to be re-investigated): The Claude Code Stop hook does not run under its session. It runs in the daemon worker chain. Tree observed live on this machine on 2026-08-14: hook shell -> claude bg-spare -> claude bg-pty-host -> claude daemon run (PPID 1). fm_claude_stop_autoarm proved its right to act with fm_session_lock_owned_by_self (bin/fm-session-lock-lib.sh), which walks the current process ancestry and requires the pid recorded in state/.lock to be a member of it. The lock names the real terminal session (e.g. 89187), which is NOT in the daemon chain, so the check failed systematically and the script exited 0 inert, silently. Corroborating evidence: upstream PR 2388 (branch fm/fm-lock-daemon-pid of this repo, already validated) documented this same daemon chain as the suspected cause of this bug while deliberately keeping its own scope to the lock. This task is where it gets treated. Consistent symptoms on the register: the state/.claude-autoarm-epoch ledger frozen on a dead owner, no state/.claude-autoarm.lock ever created, no claim at Stop time, while a manual bin/fm-watch-arm.sh re-arm works every time.
THE REAL PROBLEM TO SOLVE - a design problem, not a patch: how can a Stop hook that runs in the daemon chain PROVE it belongs to the session that holds this home's lock?
NON-NEGOTIABLE CONSTRAINTS:
LEADS TO INVESTIGATE (not to presume, and not limiting): whether the Claude Code Stop payload's identity fields (notably a session id and the current directory) recorded at lock acquisition and compared at Stop time give a proof at least as strong as ancestry - studying what the payload actually contains on the INSTALLED version rather than assuming; whether there is a valid ancestry path not being exploited, such as an environment variable the session propagates to the hook; whether two proofs should be combined rather than one replaced.
INSTRUMENT FIRST: run bin/fm-claude-stop-autoarm.sh by hand under real conditions with traces, and show exactly which guard exits 0. The instrumented diagnosis is part of the deliverable.
ACCEPTANCE CRITERIA:
WHAT I FOUND WHILE INSTRUMENTING (refines the established root cause rather than contradicting it): Claude Code 2.1.233 was instrumented with a real Stop hook capturing payload, ancestry and environment, in both a headless
claude -psession and an interactive pty session. Every Stop hook receives CLAUDE_PID (the session process pid), CLAUDE_CODE_SESSION_ID, and a payload whose session_id equals that environment session id. The reason ancestry is not reliable is that Claude Code serves hook and tool commands from a SHARED per-user worker pool under /tmp/cc-daemon-/, and a pool whose owning session has exited survives with its top process reparented to init. Observed live:27305 1 claude bg-pty-host ... d6bfe5e1 ... versions/2.1.232,27316 27305 claude bg-spare,25610 27316 /bin/zsh -c ... bin/fm-watch-arm.sh. A command served by that pool has a contiguous claude ancestry of {27316, 27305} and no path at all to the live session whose pid the lock records. The affected home's ledger had not advanced for about fourteen hours while work was in flight.DESIGN DECISIONS AND TRADEOFFS MADE (a reviewer reading only the diff would not know these were deliberate):
VERIFICATION ALREADY PERFORMED: the daemon chain was reproduced with real processes; without exported identity the hook stays inert (the bug), with its own session's identity it claims and arms, with a foreign session's identity it still refuses. The new claim test fails on unpatched main with the captain's exact symptom (exit 0, inert) and passes with the fix. bin/fm-lint.sh is clean, bin/fm-doc-audience-check.sh is clean, and the auto-arm, session-lock-ancestry, turn-end guard, watch-arm, watcher-lock, session-start and daemon suites all pass. The live guard against real Claude Code 2.1.233 confirmed the session records itself as the home's owner, the identity it exports names that same pid, payload and environment session ids match, the ledger records outcome=rewake, and NO turn was blocked for ending blind.
DELIVERY PATH FOR THIS REPO (known constraint, accepted by Firstmate, not to be rediscovered): origin is kunchenguid/firstmate with NO write access; the machine firewall refuses pushes to master/main and refuses git rebase. Deliver like PRs 2329/2367/2387/2388/2396/2419: push ONLY the fm/fm-claude-autoarm-inert branch to the fork https://github.com/Kallas95/firstmate by explicit URL (worktree remotes unchanged), then open the upstream PR against kunchenguid/firstmate:main with gh-axi. The upstream repo runs NO CI on fork PRs, so local validation green plus the upstream PR opened is the terminal state; close the CI wait through the pipeline's supported cancellation command once the PR is open rather than waiting for checks that will never arrive.
What Changed
bin/fm-session-lock-lib.shgains a second, ancestry-independent ownership proof,fm_session_lock_owned_by_claude_hook: a conjunction requiring the delivered Stop payload to name asession_id, the delivering session to have exported that sameCLAUDE_CODE_SESSION_ID, its exportedCLAUDE_PIDto equal exactly the pid recorded in the home'sstate/.lock, and that pid to still be a live Claude process. The existing ancestry proof is unchanged; a newfm_session_lock_owned_by_this_claude_sessiondisjunction arbitrates between the two and reports the deciding member throughFM_SESSION_LOCK_PROOF.bin/fm-claude-stop-autoarm.shnow decides identity through that shared disjunction at both the admission gate and the post-recovery re-verification, so a hook served from Claude Code's shared worker pool (whose ancestry never reaches its own live session) can claim the home instead of exiting 0 inert. It also addsFM_CLAUDE_AUTOARM_TRACE, an opt-in stderr diagnostic that names the gate ending a run inert before the cycle claim; it changes no decision and is documented in the script header anddocs/configuration.md.tests/fm-claude-stop-autoarm.test.shadds five portable regressions over real processes — claim from a detached worker chain, foreign-session refusal, unconfirmed/absent/malformed delivered identity, absent/malformed recorded owner, and a secondmate home refused to the main home's session — andtests/fm-claude-stop-autoarm-live-e2e.test.shgains a live guard, placed before the model-dependent assertions, that fails by name and version if Claude stops delivering those identity fields on the synchronous or detachedasyncRewakepath.docs/watcher-continuity.md,docs/verification/supervision.md,docs/scripts.mdand the harness-adapters skill record the two-proof identity contract and the measured evidence.Risk Assessment
✅ Low: Le changement est strictement additif et fail-closed sur la porte d'identité (l'ancestry reste inchangée et prioritaire, la seconde preuve est une conjonction exigeant une égalité de pid plus stricte que l'appartenance à l'ascendance), il est couvert par cinq régressions portables sur de vrais processus incluant la contre-preuve obligatoire et l'indépendance de deux homes, et les trois points restants sont documentaires ou de robustesse d'un garde opt-in.
Testing
I reproduced the reported bug and its fix directly against the hook. Runningbin/fm-claude-stop-autoarm.shby hand under the detached worker-chain shape withFM_CLAUDE_AUTOARM_TRACE=1, the pre-fix code (bin/ restored to base f1a4af4) exits 0 silently for its own lock-owning session with no arm and no epoch ledger — the captain's exact symptom — while the patched code proves identity through the delivering Claude session, exits 2, emits the wake banner and writes outcome=rewake. The mandatory counter-proof holds in every direction: a live foreign session, an exported identity the delivered event does not corroborate, a missing lock, a malformed lock, and the main home's session firing at a secondmate home are all refused with state untouched, and the secondmate's own session still claims its own home. The three trace strings documented in docs/verification/supervision.md reproduce exactly, including the CLAUDE_PID=unset variant. The opt-in live guard against real Claude Code 2.1.233 passed in full — including the "exactly 2 hook-owned arm cycles" assertion the author flagged as fragile, which did not fail here — and it asserts no turn was blocked by TURN WOULD END BLIND. A separate isolatedclaude -pprobe with synchronous and asyncRewake Stop hooks confirms the vendor still delivers CLAUDE_PID, CLAUDE_CODE_SESSION_ID and a matching payload session_id. The targeted suites around the identity contract (auto-arm, session-lock ancestry, turn-end guard, watch-arm, watcher-lock, session-start) ran through the repo's own runner with 6 scripts and 0 failures. This is a shell/CLI change with no rendered surface, so the reviewer-visible evidence is CLI transcripts and persisted state rather than screenshots. Two environment notes with no effect on the verdict: the local firewall refusesbash tests/<x>.test.shfor any script containingchmod, so I used./bin/fm-test-run.sh; and in the headlessclaude -pprobe the session is the hook's direct parent, so ancestry carried that verdict — the detached shape is covered by the real-process reproduction and the portable suite. The worktree is clean.Evidence: Instrumented before/after reproduction and safety counter-proofs (CLI transcript)
### A. AVANT le correctif (bin/ de main, f1a4af4) - la session PROPRIÉTAIRE elle-même state/.lock = 15057 CLAUDE_PID exporté = 15057 | (aucune sortie -- silencieux) => code de sortie du hook : 0 état : .lock=15057 | cycles d'armement=0 | ledger=ABSENT ### B. APRÈS le correctif - la même session propriétaire, même chaîne détachée state/.lock = 15058 CLAUDE_PID exporté = 15058 | autoarm-trace: identity: proven by the delivering Claude session (pid 15058) | firstmate watcher wake - one supervision event needs a handling turn now. | signal: fixture watcher closed with actionable work => code de sortie du hook : 2 état : .lock=15058 | cycles d'armement=1 | ledger=epoch=2 owner_pid=15183 outcome=rewake ### C1. CONTRE-PREUVE - une session ÉTRANGÈRE vivante tente de réclamer ce home | autoarm-trace: inert: live session 15059 owns this home and neither identity proof applies (CLAUDE_PID=15069) => code de sortie du hook : 0 état : .lock=15059 | cycles d'armement=0 | ledger=ABSENT ### D. la session du home PRINCIPAL (15061) tire sur le home secondmate (.lock=15063) | autoarm-trace: inert: live session 15063 owns this home and neither identity proof applies (CLAUDE_PID=15061) => code de sortie du hook : 0 la propre session du secondmate (15063) tire ensuite sur son home : | autoarm-trace: identity: proven by the delivering Claude session (pid 15063) => code de sortie du hook : 2 ### E. Verrou absent, puis verrou malformé | autoarm-trace: inert: no usable session lock, and neither identity proof applies => code de sortie du hook : 0 ; .lock=ABSENT (aucun .lock créé) => code de sortie du hook : 0 ; .lock=not-a-pid (conservé, jamais écrasé)Evidence: Live opt-in guard against real Claude Code 2.1.233
$ FM_CLAUDE_LIVE_E2E=1 bash tests/fm-claude-stop-autoarm-live-e2e.test.sh ok - Claude 2.1.233 (Claude Code) live E2E reclaimed a stale session lock through session start, completed two tokenless Stop-owned rewake cycles, preserved the competing-live-owner boundary, and still delivers the session identity the ownership proof depends onEvidence: Real Claude Stop-hook identity, ancestry and hook run (live probe)
=== chemin de livraison : async === CLAUDE_PID exporté = 37849 CLAUDE_CODE_SESSION_ID = 278c6641-e4de-4bae-a1ea-c3c71851fdc7 payload livré = {"session_id":"278c6641-e4de-4bae-a1ea-c3c71851fdc7", ... ,"hook_event_name":"Stop","stop_hook_active":false, ...} -- ascendance réelle du processus hook (pid ppid commande) -- 40205 37849 bash .../probe.sh async 37849 37846 claude -p Reply with exactly OK and stop. Use no tools. --dangerously-skip-permissions --effort low == state/.lock écrit par la session = 37849 == autoarm-trace: identity: proven by harness ancestry firstmate watcher wake - one supervision event needs a handling turn now. == code de sortie du hook = 2 (2 = réveil livré) == == ledger state/.claude-autoarm-epoch : epoch=2 owner_pid=40274 outcome=rewake ==Evidence: Auto-arm portable suite (27 cases, owner of the changed behavior)
ok - auto-arm: claims the home from a worker chain that cannot reach its own session ok - auto-arm: a session that does not hold the lock still cannot claim the home ok - auto-arm: an unconfirmed, absent, or malformed session identity never claims the home ok - auto-arm: a missing or malformed recorded owner is refused through every identity path ok - auto-arm: two homes on one machine stay independent under the session-identity proofEvidence: Targeted suites around the identity contract
FM_TEST_END tests/fm-claude-stop-autoarm.test.sh exit=0 FM_TEST_END tests/fm-session-lock-ancestry.test.sh exit=0 FM_TEST_END tests/fm-turnend-guard.test.sh exit=0 FM_TEST_END tests/fm-watch-arm.test.sh exit=0 FM_TEST_END tests/fm-watcher-lock.test.sh exit=0 FM_TEST_END tests/fm-session-start.test.sh exit=0 FM_TEST_SUMMARY total=6 failed=0 skipped_gate=0Pipeline
Updates from git push no-mistakes
... (4 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)
🔧 Fix: guard the detached Stop path, rename autoarm trace flag
4 issues (1 warning, 3 infos) still open:
docs/verification/supervision.md:487- L'entrée de preuve atteste un passage du garde live qui ne correspond plus au test présent dans l'arbre. Le paragraphe « The live guard ran against Claude Code 2.1.233 on the same date » et sa liste « Observed: ... » ont été écrits dans d8236d1, où le garde ne mesurait que le chemin Stop SYNCHRONE. Le commit 630eb13 (tour de correction du pipeline) a ensuite ajouté 62 lignes à tests/fm-claude-stop-autoarm-live-e2e.test.sh — tout le bloc d'alarme sur le chemin asyncRewake détaché, lignes 190-218 — et n'a pas touché ce paragraphe. Le même commit a aussi réécrit les chaînes de trace citées en 476-478 sans nouvelle exécution instrumentée. Conséquence concrète : un mainteneur qui lit cette page conclut que l'alarme détachée a été exercée contre Claude Code 2.1.233, alors que c'est la seule assertion neuve couvrant le chemin sur lequel bin/fm-claude-stop-autoarm.sh tourne réellement, et qu'elle n'a jamais été exécutée. Le tier 5 de l'arbre de placement (.agents/skills/firstmate-coding-guidelines/SKILL.md:30-31) réserve cette page aux commandes et sorties EXACTES, et la règle des harness-dependent checks fait du garde live opt-in une pièce obligatoire du livrable. Deux issues acceptables : relancerFM_CLAUDE_LIVE_E2E=1 tests/fm-claude-stop-autoarm-live-e2e.test.shet enregistrer le résultat réel, ou qualifier l'entrée en disant explicitement que l'alarme du chemin détaché et les chaînes de trace actuelles n'ont pas encore été observées en live. Point supplémentaire à trancher par le propriétaire : la sonde asyncRewake ajoutée porte le nombre de hooks asyncRewake du labo à deux (l'auto-arm suivi de la sonde), alors qu'aucun fait fournisseur vérifié du dépôt n'établit que Claude Code en exécute plus d'un par Stop — docs/turnend-guard.md:52 et .agents/skills/harness-adapters/SKILL.md:207 ne documentent qu'une seule inscription asyncRewake.docs/verification/supervision.md:292- Phrase de contrat au présent devenue fausse : « Session-lock ownership inbin/fm-session-lock-lib.shis decided against a session's whole contiguous harness ancestry rather than one chosen pid ». Depuis ce changement, la propriété peut précisément être décidée par UN pid choisi : fm_session_lock_owned_by_claude_hook (bin/fm-session-lock-lib.sh:217) exigelock_pid = CLAUDE_PID, une égalité stricte, et la disjonction de bin/fm-session-lock-lib.sh:265 l'accepte comme preuve alternative. C'est exactement la même classe de péremption que le tour 2 a corrigée dans docs/scripts.md:39 et dans l'en-tête de la lib, mais ce site frère a été manqué. La correction est d'une phrase : ajouter que la propriété se décide désormais par appartenance à l'ascendance OU par l'identité de session livrée avec l'événement, et renvoyer à docs/watcher-continuity.md:15-19 qui possède le contrat, sans en recopier la substance..agents/skills/harness-adapters/SKILL.md:205- Deux faits fournisseur nouvellement vérifiés par ce travail ne sont enregistrés nulle part chez leur propriétaire. Le bloc « Primary-session guard fact » de ce skill est déjà le propriétaire des faits Claude Code vérifiés de cette exacte nature — il porte la sémantique destop_hook_activedans la charge utile Stop (208), la résolution de la racine projet (209) et l'exécution des commandes de hook via /bin/sh (210). Les deux faits manquants sont : (a) tout hook Stop reçoitCLAUDE_PIDetCLAUDE_CODE_SESSION_ID, et lesession_idde la charge utile égale l'identifiant exporté ; (b) Claude Code sert les commandes de hook et d'outil depuis un pool de travailleurs partagé par utilisateur sous /tmp/cc-daemon-<uid>/, dont le processus de tête est réparenté à init et survit à la session qui l'a démarré. Le fait (b) est le plus important car il déborde largement ce hook : il invalide toute décision fondée sur l'ascendance dans la flotte. Aujourd'hui ces deux faits n'existent que dans docs/verification/supervision.md, une page de preuves (tier 5), et dans les deux fichiers source qui les consomment — alors que l'arbre de placement les range au tier 2, le skill agent. L'intent déclare explicitement que cet arbre a été appliqué. Ajouter les deux faits, datés et versionnés comme leurs voisins, au bloc existant.bin/fm-sessionstart-run.sh:78- Note de suivi, hors périmètre déclaré, à ne pas traiter dans ce changement. Le même fait fournisseur laisse deux appelants qui décident encore sur l'ascendance seule, et le chemin y est concret.session_start_completed()appelle fm_session_lock_owned_by_self : si le hook SessionStart est servi par un pool orphelin, le prédicat échoue, la fonction rend 1, et le routageclear|compact(bin/fm-sessionstart-run.sh:117-120) relance un digest COMPLET au lieu du--reemitprévu — donc un balayage de démarrage complet à chaque /clear et chaque /compact. Ce n'est pas la panne d'origine et la direction est fail-safe, l'en-tête du fichier assume d'ailleurs la redondance comme « cheap and idempotent ». Même remarque pour bin/fm-startup-network.sh:199 et :397, qui dégradent enlocked=0plutôt que d'échouer. Aucun risque de sûreté, aucune revendication étrangère possible : je le signale uniquement pour que le capitaine sache que la deuxième preuve d'identité n'est aujourd'hui câblée que sur le hook Stop, et que ces deux sites restent sensibles au même pool si le symptôme réapparaît ailleurs. L'intent limite explicitement ce travail à l'auto-arm Stop, donc ne pas élargir ici.🔧 Fix: record the measured live-guard evidence and vendor facts
3 infos still open:
docs/verification/supervision.md:474- La seule commande de diagnostic documentée pour cette panne se bloque telle qu'écrite. La ligne 474 présenteFM_CLAUDE_AUTOARM_TRACE=1 bin/fm-claude-stop-autoarm.shcomme la façon de diagnostiquer un hook inerte, mais le hook consomme sa charge utile en ligne 107 avecPAYLOAD=$(cat 2>/dev/null || true). Lancée depuis un terminal sans redirection, la commande attend indéfiniment sur l'entrée standard : l'opérateur ne voit aucune trace tant qu'il n'a pas deviné qu'il faut envoyer Ctrl-D. L'intent fait explicitement du diagnostic instrumenté une pièce du livrable (« INSTRUMENT FIRST: run bin/fm-claude-stop-autoarm.sh by hand under real conditions with traces »), et le tier 5 de l'arbre de placement réserve cette page aux commandes EXACTES. La forme complète manque aussi le contexte que la ligne 483 suppose : il faut viser une home de fixture. Correctif d'une ligne : documenter la commande sous une forme exécutable, par exempleprintf '{"session_id":"x"}' | FM_HOME=<fixture> FM_CLAUDE_AUTOARM_TRACE=1 bin/fm-claude-stop-autoarm.sh, ou au minimum ajouter</dev/null.docs/verification/supervision.md:292- La phrase corrigée au tour 3 est exacte sur la bibliothèque mais généralise à toute la flotte une propriété qui n'appartient qu'au hook Stop de Claude. « Session-lock ownership inbin/fm-session-lock-lib.shis decided by either of two proofs » se lit comme le contrat de propriété du verrou de session en général, alors que le seul appelant de la disjonction est bin/fm-claude-stop-autoarm.sh (lignes 133 et 183). Tous les autres décident encore sur l'ascendance seule : bin/fm-lock.sh, bin/fm-sessionstart-run.sh:78, bin/fm-turnend-guard-cursor.sh:235/241/246, bin/fm-startup-network.sh:199/397. Un mainteneur qui debug le ré-emit du digest après /clear ou la fenêtre read-only du démarrage réseau conclura de cette page que la seconde preuve s'y applique déjà, ce qui est faux. Une subordonnée suffit : préciser que la disjonction est aujourd'hui câblée sur le hook Stop de Claude, les autres appelants restant sur la preuve d'ascendance.tests/fm-claude-stop-autoarm-live-e2e.test.sh:102- Le format de journal de la sonde rend l'alarme fournisseur fragile dans le sens qui accuse à tort. La sonde écritprintf 'payload=%s\n' "$PAYLOAD"et les deux blocs de vérification relisent avecsed -n 's/^payload=//p' | sed -n '1p'(lignes 168 et 207), donc seule la PREMIÈRE ligne de la charge utile est relue. J'ai vérifié empiriquement quefm_claude_payload_session_idgère parfaitement un JSON pretty-printed (il rend bienpretty-1sur un payload multiligne) : si une version future de Claude Code passe le payload Stop en multiligne, le code de production continue de fonctionner, mais le garde relit{seul, l'extraction échoue et le test accuse le fournisseur d'avoir cessé de nommer un session_id, en imprimant un payload tronqué à un seul caractère. C'est un faux positif sur la seule alarme qui protège ce chemin, et le message oriente vers la mauvaise hypothèse. Correctif local à la sonde, sans toucher aux assertions : normaliser la charge utile sur une ligne avant l'écriture, par exempleprintf 'payload=%s\n' "$(printf '%s' "$PAYLOAD" | tr -d '\n')".✅ **Test** - passed
✅ No issues found.
tests/fm-claude-stop-autoarm.test.sh— 27 cases green including the 5 new detached-chain identity casesManual instrumented reproduction:bin/fm-claude-stop-autoarm.shrun by hand under a simulated detached Claude worker chain withFM_CLAUDE_AUTOARM_TRACE=1, real live lock-owner processes, before/afterbin/swapped betweenf1a4af4and the branchCounter-proof scenarios in the same reproduction: foreign live session, payload/env session-id mismatch, missing lock, malformed lock, main-home session firing at a secondmate homeReproduced all three trace strings documented indocs/verification/supervision.md, including theCLAUDE_PID=unsetvariant viaenv -u CLAUDE_PID -u CLAUDE_CODE_SESSION_IDFM_CLAUDE_LIVE_E2E=1 bash tests/fm-claude-stop-autoarm-live-e2e.test.shagainst real Claude Code 2.1.233 — passed in fullLive probe: isolatedclaude -psession with synchronous +asyncRewakeStop hooks capturingCLAUDE_PID,CLAUDE_CODE_SESSION_ID, payloadsession_idand full process ancestry, then running the real hook./bin/fm-test-run.sh tests/fm-claude-stop-autoarm.test.sh tests/fm-session-lock-ancestry.test.sh tests/fm-turnend-guard.test.sh tests/fm-watch-arm.test.sh tests/fm-watcher-lock.test.sh tests/fm-session-start.test.sh— total=6 failed=0docs/sessionstart-nudge.md:61- Suivi hors périmètre (contradiction révélée, pas corrigée ici car elle exigerait un changement de comportement) : .agents/skills/harness-adapters/SKILL.md:213 enregistre désormais la règle générale « a hook's contiguous harness ancestry does not reliably contain its own live session and no fleet decision may assume it does », alors que docs/sessionstart-nudge.md:61-62 documente encore une décision de flotte fondée uniquement sur l'ascendance : le wrapper SessionStart (bin/fm-sessionstart-run.sh, enregistré comme hook Claude dans .claude/settings.json) marche au plus huit parents depuis son propre pid et reste silencieux seulement si state/.lock nomme un pid vivant de cette ascendance. Servi depuis le pool de workers partagé, ce hook peut manquer sa propre session et rejouer le nudge alors que fm-session-start.sh a déjà tourné. La direction d'échec est bénigne (nudge redondant, jamais un refus d'ouverture de session), donc rien n'est faux dans le code aujourd'hui décrit par ce document — mais l'invariant nouvellement écrit et cette page divergent. Le traiter demande de décider si le nudge doit adopter la seconde preuve d'identité, ce qui est un changement de comportement interdit à cette phase.docs/supervision-protocols/claude.md:13- Décision de placement assumée : docs/supervision-protocols/claude.md:13 dit toujours « If the Stop hook does not claim the home or reports an exhausted failure, inspect its registration and watcher startup path before ending blind », sans pointer vers FM_CLAUDE_AUTOARM_TRACE, qui est pourtant le diagnostic exact de ce symptôme. Je ne l'ai pas ajouté : cette surface est un contrat agent-runtime rendu dans chaque bloc de session (et figé par tests/fm-supervision-instructions.test.sh, que cette phase ne peut pas toucher), la phrase existante reste vraie, et le drapeau a déjà un propriétaire unique dans docs/configuration.md avec ses preuves dans docs/verification/supervision.md. Ajouter le pointeur ici dupliquerait un fait déjà possédé ailleurs dans une instruction toujours chargée.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.