Repository navigation
Conversation
The session lock identifies its owner by process ancestry, but ancestry is not a stable session identity. Claude Code serves one session's hooks and tool calls from more than one worker pool, and a pool whose top process has been reparented to init yields a contiguous harness run that never reaches the session's own lineage. A session that acquired the lock through a pool that could reach it is then refused its own home for the rest of its life: bin/fm-session-start.sh prints "another live firstmate session holds the lock (pid N); operate read-only until resolved" and skips every mutating step. Record the acquiring session's identity beside the lock, and accept it as a second proof of ownership in addition to the ancestry proof, which is left unchanged. A lock carrying no binding keeps exactly its previous behavior, as does any harness that exposes no session identity. The added proof is strictly narrower than it first appears: the recorded session must match, the binding must name exactly the pid the lock records, that pid must still be a live harness, and the claimed session process must be corroborated by the current process's own ancestry. That last conjunct is load-bearing rather than defensive - a session identity travels down every child of a tool call, so without it any process launched from the owner's environment could claim the home, which the existing concurrency guard in tests/fm-session-start.test.sh caught. tests/fm-session-lock-identity.test.sh pins both directions and is red without this change. tests/fm-sessionstart-hook-live-e2e.test.sh gains the vendor half, because whether a harness supplies a usable session identity at all can only be proven against the real harness.
This was referenced Aug 24, 2026
|
Closed as superseded — this work already landed on main via #4894. — 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: after a compaction, a firstmate session that ALREADY holds the fleet lock believed it was read-only for the rest of its life. Fix that false refusal without creating a single false success.
The task began deliberately as INSTRUCT-BEFORE-FIX: a decisive measurement was required before any code was written. That measurement was taken and CORRECTED the original premise, and the scope was then rebounded by the requester. Both facts are accepted context, not drift.
What the measurement established (real Claude Code, no stub, 2.1.232 and 2.1.233, six session opens covering startup, resume, clear and a real /compact): inside the SessionStart hook, CLAUDE_PID is always the session pid, the payload always carries a session_id byte-equal to the exported CLAUDE_CODE_SESSION_ID, and the hook runs as a direct child of the session, so the ancestry proof already passes there. There is therefore NO universal "after every /compact" defect, and a foreground session is never refused at its own session open. This bounds the fix and is what makes it safe.
The real occurrence, measured from the refused session itself: a firstmate session hosted in a Claude Code background job has its calls served by a reparented worker pool (claude bg-spare 27316 under claude bg-pty-host 27305, PPID 1). fm_harness_ancestry_pid returns 27305 while state/.lock names 89187, a value that same session wrote earlier through a DIFFERENT pool whose claude daemon run 18151 had PPID exactly 89187. So bin/fm-session-start.sh prints "another live firstmate session holds the lock (pid 89187); operate read-only until resolved" and skips every mutating step. The central fact: the same session produces two different ancestry identities depending on which pool serves the call, and once the pool that could reach it is reparented it can never again prove it owns its own lock.
Accepted approach, explicitly required by the requester: a DURABLE SESSION-IDENTITY BINDING in the lock record, independent of ancestry and independent of the unmerged upstream PR 2424. At acquisition, also record the owner's session identity when the harness exposes one; at verification, accept ownership when the current process's session identity is the one the lock records, IN ADDITION TO the existing ancestry proof, which must remain unchanged. Stay compatible with a legacy pid-only lock and with any harness exposing no session identity - in those cases behavior must be identical to today.
Explicit exclusions the requester ruled out, which must NOT be reintroduced: do NOT employ fm_session_lock_owned_by_claude_hook or stack on PR 2424 (that proof requires CLAUDE_PID == lock pid, which the passing ancestry match on the SessionStart path already implies, so it adds no recognition); do NOT rewrite the write-side sense owned by PR 2388 (fm-lock-daemon-pid), which must be able to coexist; do NOT merge local main into this branch - the upstream base is correct for this PR.
Implementation decisions made while doing the work. state/.lock must stay a bare numeric pid because several readers parse it as exactly that, so the binding lives in an adjacent state/.lock.session file recording pid= and session=, accepted only when its pid equals the current lock pid. The identity proof is a conjunction: a harness session identity is present; it is CORROBORATED by the current process's own ancestry; the lock holds a numeric pid; the binding names exactly that pid; the recorded session equals this process's session; and the lock pid is still a live harness. On acquisition the stale binding is discarded before the new one is written, and a process whose identity is only inherited declines to publish, so a recycled pid can never meet a foreign session id. Publication failure is deliberately non-fatal: the home simply keeps ancestry-only behavior.
The corroboration conjunct was added in response to a real false success that the EXISTING concurrency guard in tests/fm-session-start.test.sh caught: without it, forty distinct sessions sharing one inherited CLAUDE_CODE_SESSION_ID were all admitted. A session identity travels down every child of a tool call, so a crewmate launched on a harness that does not overwrite these variables would otherwise carry its launching session's identity. Corroboration is membership of the harness-reported served-session process in the current ancestry - deliberately NOT equality with the lock pid, because the whole point is that ancestry reaches the pool while never reaching the pid the lock records.
Scope bound deliberately chosen: the disjunction is applied only to the session-start ownership gates (bin/fm-lock.sh acquire, bin/fm-sessionstart-run.sh, bin/fm-startup-network.sh). The Claude Stop auto-arm and the Cursor turn-end guard were intentionally left untouched because PR 2424 owns that file and stacking on it was excluded.
Non-negotiable safety requirement, proven in both directions by tests: a session that really holds the lock is recognized from a reparented pool (red today); a foreign session, an absent, malformed or legacy lock, a stale binding, a dead owner, and an inherited environment all continue to fail closed (green today, must stay green); two firstmate homes on one machine stay independent. The mandatory regression is red without the fix and green with it, verified under both the system bash 3.2.57 and GNU bash 5.3.9 on Linux.
A defect in my own test was found and fixed along the way: its end-to-end case named a pid that happens to exist on this host, so it passed for the wrong reason; it now uses real live background processes and is hermetic.
Because the verdict comes from vendor-emitted environment, this is a harness-dependent check: tests/fm-session-lock-identity.test.sh pins the logic portably with a deterministic process table, and tests/fm-sessionstart-hook-live-e2e.test.sh was extended to prove the vendor half against the real harness, with the dated result recorded in docs/verification/supervision.md.
Repo conventions that were applied: .agents/skills/firstmate-coding-guidelines/SKILL.md was read and followed - one sentence per line in tracked Markdown, plain dashes, no agent co-author, shellcheck-clean bin scripts via bin/fm-lint.sh, tests colocated in tests/ as .test.sh, and raw incident evidence kept out of the repo with only distilled current facts in the maintainer-verification record.
Delivery: this branch must go to the fork Kallas95/firstmate by explicit URL and open a PR against kunchenguid/firstmate:main; upstream runs no CI on fork PRs, so local green plus an opened PR is the terminal state.
What Changed
bin/fm-session-lock-lib.shgains a durable session-identity binding beside the fleet lock:fm_session_lock_publish_identityrecordspid=/session=in an adjacentstate/.lock.sessionfile (sostate/.lockstays a bare numeric pid), discarding any stale record first and declining to publish an identity this process only inherited.fm_session_lock_owned_by_session_identityaccepts ownership only as a conjunction - a harness session identity is present, is corroborated by the served-session pid being a member of this process's own harness ancestry (fm_harness_session_is_ours), the lock holds a numeric pid, the binding names exactly that pid, the recorded session equals this process's, and the lock pid is still a live harness. The ancestry proof is unchanged and now shares a newfm_harness_ancestry_containshelper;fm_session_lock_owned_by_current_sessionis the ancestry-OR-identity disjunction.bin/fm-lock.shacquire (both the plain-file and the pre-existing-lock branch) and thefm_session_lock_owned_by_selfcall sites inbin/fm-sessionstart-run.shandbin/fm-startup-network.sh- now consult that disjunction, so a session served by a reparented worker pool is recognised as its own lock's owner instead of being told to operate read-only. The Stop auto-arm and Cursor turn-end guard still ask for ancestry only; a legacy pid-only lock, a harness exposing no session identity, and a failed publication all fall back to exactly the previous ancestry-only behaviour.tests/fm-session-lock-identity.test.sh, which drives the library behind a deterministic fakepsshaped like the measuredbg-spare/bg-pty-hostpool and runs the realbin/fm-lock.shover genuinely live background pids, and registers it inbin/fm-test-run.sh.tests/fm-sessionstart-hook-live-e2e.test.shnow also records, per real session open, the payloadsession_id, the exportedCLAUDE_CODE_SESSION_ID,CLAUDE_PID, and whether corroboration holds;docs/verification/supervision.mdrecords those measurements plus the reparented-pool row and its scope limits, anddocs/scripts.mdupdates the library's description.Risk Assessment
✅ Low: Le changement est purement additif et fail-closed par construction : la nouvelle conjonction d'acceptation repose sur une liaison que seul le chemin d'écriture déjà vérifié de fm-lock.sh (sous CLAIM_LOCK) peut produire, l'épreuve d'ascendance reste intacte et prioritaire, la portée est bornée aux trois portes nommées par l'intention, le comportement des verrous légataires et des harnais sans identité de session est identique à aujourd'hui, les tests couvrent les deux sens, et la seule lacune résiduelle (prémisse CLAUDE_PID non mesurée sur le chemin du hook) est désormais explicitement documentée comme non couverte - du confinement honnête autorisé par le requérant, qui ne peut pas dégrader le comportement actuel.
Testing
J'ai d'abord reproduit l'incident tel qu'un utilisateur le vit : dans un lab avec de vrais processus vivants imitant le pool réparenté mesuré (claude bg-spare sous claude bg-pty-host, PPID 1), le vrai bin/fm-session-start.sh affiche au commit de base « another live firstmate session holds the lock » et la bannière READ-ONLY pour la session qui détient pourtant le lock, alors qu'avec le fix la même situation donne « lock acquired: harness pid N » sans bannière ; dans les deux sens, une session étrangère et un environnement de session seulement hérité restent refusés. La régression obligatoire tests/fm-session-lock-identity.test.sh est rouge au commit de base et verte avec le fix, et j'ai vérifié sur le vrai harness Claude Code 2.1.233 (depuis cette session) que la corroboration passe, que l'acquisition écrit bien state/.lock en pid nu plus la liaison state/.lock.session, et que sans CLAUDE_CODE_SESSION_ID aucune liaison n'est écrite — comportement legacy identique. Côté absence de faux succès, le garde de concurrence existant de tests/fm-session-start.test.sh (47 assertions vertes) devient rouge avec « produced 40 winners » dès que je retire le conjoint de corroboration par mutation, ce qui prouve que c'est bien lui qui tient la propriété. Les suites des sites d'appel et des chemins volontairement laissés intacts (ancestry, startup-network, sessionstart-nudge, turnend-guard, claude-stop-autoarm, cursor-primary) sont toutes vertes sous le bash système 3.2.57 de l'hôte ; le volet GNU bash 5 sur Linux revendiqué par l'intent appartient à la CI distante (ubuntu-latest), et le guard live tests/fm-sessionstart-hook-live-e2e.test.sh n'a pas été relancé car il est opt-in et consomme de vrais tours de modèle sur claude/codex/pi — j'ai couvert sa moitié risquée autrement, par la mesure directe sur le harness réel et par la vérification portable de son extraction de session_id. Aucun test n'a échoué et le worktree est resté propre.
Evidence: Section LOCK du digest SessionStart, avant/après, pour la même session revenue par le pool réparenté
=== AVANT (commit de base f1a4af4) === $ bin/fm-session-start.sh LOCK -------------------------------------------------------------------------------- error: another live firstmate session holds the lock (pid 31167); operate read-only until resolved ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ● READ-ONLY SESSION - FLEET LOCK OWNERSHIP WAS NOT VERIFIED ● error: another live firstmate session holds the lock (pid 31167); operate read-only until resolved ● Skipping every mutating step: PR-check migration, stale Herdr child cleanup, ● secondmate convergence, secondmate liveness, pending remote handoff retry, ● X-mode artifacts, fleet sync, and wake-queue drain. Detect-only bootstrap ● diagnostics and the rest of this read-only-safe digest still ran below. ● Operate read-only until this resolves - do not spawn, steer, merge, or ● otherwise mutate fleet state from this session. ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ === APRES (commit 4ccfcf7) === $ bin/fm-session-start.sh LOCK -------------------------------------------------------------------------------- lock acquired: harness pid 34756 === Garde-fous, identiques dans les deux sens === --- session ETRANGERE par le meme pool --- error: another live firstmate session holds the lock (pid 34756); operate read-only until resolved code de sortie = 1 --- identite de session seulement HERITEE par l'environnement --- error: another live firstmate session holds the lock (pid 34756); operate read-only until resolved code de sortie = 1 state/.lock = 34756Evidence: Transcript complet AVANT le fix (acquisition, retour par pool réparenté, digest, garde-fous)
Evidence: Transcript complet APRÈS le fix, avec le contenu de state/.lock.session
--- 1. la session prend le fleet lock (pool qui atteint la session) --- $ bin/fm-lock.sh lock acquired: harness pid 34756 state/.lock = 34756 state/.lock.session = pid=34756 session=bebaa84f-3b50-4abc-8d29-6c2751cc722c --- 2. MEME session, apres compaction, servie par le pool reparente --- $ bin/fm-lock.sh lock acquired: harness pid 34756 code de sortie = 0Evidence: Régression obligatoire : rouge sans le fix
# bin/fm-session-lock-lib.sh + bin/fm-lock.sh remis a la version du commit de base f1a4af4 $ bash tests/fm-session-lock-identity.test.sh fm_session_lock_owned_by_session_identity: command not found not ok - the session that acquired the lock was not recognized by its recorded identity exit=1Evidence: Régression obligatoire : verte avec le fix
$ bash tests/fm-session-lock-identity.test.sh (avec le fix, commit 4ccfcf7) ok - session-lock identity: the session that owns the lock is recognized from a reparented worker pool ok - session-lock identity: a foreign session and an identity-less process still fail closed ok - session-lock identity: an inherited session environment neither proves nor binds ownership ok - session-lock identity: absent, malformed, legacy, stale-bound, and dead-owner locks all fail closed ok - session-lock identity: two firstmate homes on one machine stay independent ok - session-lock identity: publishing replaces any previous binding instead of inheriting it ok - session-lock identity e2e: acquire binds the session, readmits it from a reparented pool, and still refuses a foreign or inherited one exit=0Evidence: Test de mutation : sans le conjoint de corroboration, le garde de concurrence existant tombe
# Mutation: fm_harness_session_is_ours() { return 0; } -> le conjoint de corroboration est retire $ bash tests/fm-session-start.test.sh (garde de concurrence existant) ok - session start stays read-only when lock ownership cannot be published ok - locked session start freezes trace context and lock refusal leaves it unchanged not ok - concurrent session-lock acquisition produced 40 winners exit=1Evidence: Mesure sur le vrai harness Claude Code 2.1.233 (appel outil de cette session)
claude --version : 2.1.233 (Claude Code) CLAUDE_CODE_SESSION_ID : 0c16dcc9...1e6dcfb36965 (masque) CLAUDE_PID : 68376 ps -o args= -p CLAUDE_PID : claude -p --verbose --output-format stream-json ... ancetrage harness contigu (fm_harness_ancestry_pids) : 68376 claude -p --verbose --output-format stream-json ... fm_harness_ancestry_pid (pid ecrit dans state/.lock) : 68376 fm_harness_session_identity : presente fm_harness_session_is_ours : OUI - le processus de session servi par ce pool est bien dans mon propre ancetrageEvidence: bin/fm-lock.sh sur le vrai harness : liaison écrite, et compatibilité legacy sans identité de session
--- A. harness exposant une identite de session --- $ bin/fm-lock.sh lock acquired: harness pid 68376 state/.lock = 68376 state/.lock.session = pid=68376 session=0c16dcc9... (masque) $ bin/fm-lock.sh status lock: held by live harness pid 68376 --- B. harness NEXPOSANT AUCUNE identite de session (compat legacy) --- $ env -u CLAUDE_CODE_SESSION_ID bin/fm-lock.sh lock acquired: harness pid 68376 state/.lock = 68376 state/.lock.session = absent -> comportement identique a avant le changementEvidence: Harnais d'évidence utilisé pour reproduire le pool réparenté (rejouable)
Evidence: Sortie complète de tests/fm-session-start.test.sh avec le fix (47 assertions)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
docs/verification/supervision.md:86- La prémisse porteuse du correctif n'est couverte par aucune mesure enregistrée.fm_harness_session_is_ours(bin/fm-session-lock-lib.sh:217) exige queCLAUDE_PIDappartienne à l'ascendance harnais courante ; dans la configuration réellement défaillante (poolclaude bg-spare/bg-pty-hostreparenté), cette ascendance vaut [27316, 27305] et n'atteint jamais 89187. Le correctif ne fonctionne donc que siCLAUDE_PIDy nomme un processus du pool. La ligne 86 l'affirme comme un fait (« from that poolCLAUDE_PIDnames the pool process »), mais le tableau enregistré aux lignes 71-78 ne contient que des ouverturesSessionStartoù le processus servant EST la session, c'est-à-dire précisément le chemin dont les lignes 84 disent qu'il n'a jamais besoin du correctif. SiCLAUDE_PIDnommait 89187 depuis ce pool,fm_harness_session_is_oursrenverrait faux, le refus « operate read-only » persisterait, et rien ne le détecterait :tests/fm-session-lock-identity.test.shencode l'hypothèse dans sonpsdéterministe (il passe$spare_pidenCLAUDE_PID, ligne 360) ettests/fm-sessionstart-hook-live-e2e.test.shn'atteint jamais un pool reparenté. Corollaire sur le même bloc : la ligne 90 dit que le guard live « refreshes the vendor half of this record » et invite à le lancer « before trusting the table above », alors qu'il ne peut pas rafraîchir la seule affirmation qui décide de l'efficacité du correctif. À confirmer par l'auteur : soit consigner leCLAUDE_PIDmesuré depuis le pool bg-spare comme une ligne du tableau, soit restreindre la portée de la phrase 90.bin/fm-lock.sh:65- La liaison n'est publiée qu'au moment où le verrou est réécrit (ligne 128), jamais sur le chemin rapideold == me. Séquence concrète : une session détient déjà le verrou écrit avant ce changement (fichierstate/.locksans.lock.sessionadjacent) ; après mise à jour du code, son prochain session-start (compact, clear) atteint la ligne 65, sort enexit 0et ne publie rien ; un appel ultérieur servi par un pool reparenté ne trouve aucune liaison, échoue au point 4 de la conjonction et retombe sur le refus read-only — exactement le défaut visé. Cette session ne guérit jamais de son vivant : elle ne réécrira le verrou que si le pid propriétaire meurt. La lacune est limitée à la fenêtre de migration (toute session ouverte après le changement se lie normalement au démarrage), mais elle signifie que l'utilisateur qui a rapporté l'incident doit rouvrir une session pour bénéficier du correctif. Publier aussi sur ce chemin serait sûr — quandold == me,meest un harnais vivant de notre propre ascendance, donc aucune reprise concurrente n'est possible — mais c'est une décision de portée qui appartient à l'auteur.bin/fm-claude-stop-autoarm.sh:107- Résidu explicitement assumé par l'intention, consigné ici uniquement pour visibilité. La session débloquée par ce changement obtient bien un session-start mutant complet, mais son hook Stop reste inerte :fm_session_lock_owned_by_selféchoue depuis le pool,LOCK_PID(89187) est numérique etfm_harness_pid_alivele trouve vivant, donc le script sort en 0 avant tout armement — ni auto-arm ni rewake. Le même invariant violé (ascendance ≠ identité de session) reste donc atteignable sur ce chemin frère. L'intention exclut nommément ce fichier (« PR 2424 owns that file and stacking on it was excluded »), donc aucune action n'est demandée ici ; c'est le point de raccordement naturel d'un suivi une fois la PR 2424 fusionnée.tests/fm-sessionstart-hook-live-e2e.test.sh:170- Le nouveau sondage de corroboration sourcefm-session-lock-lib.shdepuis le lab, maismake_lab(lignes 120-123) ne lie quefm-startup-network.sh,fm-timeout-lib.sh,fm-wake-lib.shetfm-session-lock-lib.sh— jamaisfm-cursor-lib.sh, que la lib source inconditionnellement à sa ligne 17. Lesourceinterne échoue donc, les fonctions restent définies (pas deset -e) etfm_cursor_process_matchesest absente : chaque processus non-harnais de la marche d'ascendance sort en « command not found » (127), ce qui se comporte aujourd'hui comme un non-appariement, donc le résultat est correct par accident. La fragilité est réelle car l'assertionassert_session_identityéchoue en dur surcorroborated != yeset attribuerait alors un défaut de câblage du lab au comportement du vendeur. Ajouterln -sf "$ROOT/bin/fm-cursor-lib.sh" "$lab/bin/fm-cursor-lib.sh"àmake_labsupprime la dépendance implicite (le préexistantfm-startup-network.shdu lab charge la même lib et souffre du même trou).bin/fm-session-lock-lib.sh:224- Simplification et coût. La boucle « ce pid est-il dans l'ascendance ? » (while IFS= read -r pid+ heredoc<<EOF) existe désormais en trois exemplaires identiques :fm_harness_ancestry_pid(137),fm_session_lock_owned_by_self(170) etfm_harness_session_is_ours(224) ; un helperfm_harness_ancestry_contains <pid>les couvre toutes. Effet de bord mesurable :fm_session_lock_owned_by_current_sessionrelance intégralementfm_harness_ancestry_pids(jusqu'à 2pspar saut, 16 sauts) une seconde fois viafm_harness_session_is_ours, etfm-lock.shen déclenche encore une à sa ligne 73 — soit deux à trois marches complètes là où une seule suffit, la liste étant invariante dans un même processus. Mémoriser le résultat dans une variable de portée fichier (invalidée par$$) supprime ces forks sur le chemin chaud du session-start, sans aucun changement de comportement.🔧 Fix: bound pool premise, share ancestry helper, wire lab cursor lib
1 info still open:
tests/fm-session-lock-identity.test.sh:273- Les trois processus d'arrière-plansleep 300créés parspawn_live_pid(lignes 342-344) ne sont réclamés qu'au tout dernier moment du chemin heureux, ligne 386.fail()(tests/lib.sh:44) faitexit 1immédiatement, et le seul trap EXIT installé est celui detests/lib.sh:109, qui n'appelle quefm_test_cleanup(suppression du répertoire temporaire) et ignoreE2E_PIDS. Séquence concrète : l'assertion ligne 351 (« le verrou n'a pas enregistré le pid de session ») échoue ->failsort -> les troissleep 300survivent cinq minutes, orphelins.bin/fm-test-run.shne tue aucun groupe de processus (aucunsetsid,kill -<signal>de groupe, ni timeout de groupe), donc rien ne les récupère. Le commentaire de tests/lib.sh:57 énonce précisément la convention manquante : « A test file that needs extra teardown (e.g. killing a daemon) should define its own EXIT trap and call fm_test_cleanup from inside ». Correctif mécanique : après la définition dereap_live_pids, installertrap 'reap_live_pids; fm_test_cleanup' EXIT. Aucun blocage du runner n'est en jeu (stdin/stdout dessleepsont redirigés vers /dev/null) ; l'impact se limite à des processus résiduels après un échec.✅ **Test** - passed
✅ No issues found.
env bash tests/fm-session-lock-identity.test.sh— 7 cas verts avec le fix (commit 4ccfcf7)Rouge sans le fix :bin/fm-session-lock-lib.sh+bin/fm-lock.shremis à la version du commit de base f1a4af4, puisenv bash tests/fm-session-lock-identity.test.sh→not ok - the session that acquired the lock was not recognized by its recorded identity(exit 1), fichiers restaurés ensuiteTranscript produit avant/après : harnaislock-reparented-pool-lab.shreproduisant le pool réparenté mesuré (3 vrais processus vivants + table de processus déterministe), pilotant le vraibin/fm-lock.shpuis le vraibin/fm-session-start.sh(section LOCK et bannière READ-ONLY)Garde-fous dans le même harnais : session étrangère par le même pool → refus exit 1 ; identité de session seulement héritée par l'environnement (ancêtrage propre) → refus exit 1 ; le lock reste sur son propriétaire d'origineMesure sur le vrai harness Claude Code 2.1.233 depuis cette session :fm_harness_ancestry_pids,fm_harness_ancestry_pid,fm_harness_session_identity,fm_harness_session_is_ours→ corroboration vraiebin/fm-lock.shetbin/fm-lock.sh statussur le vrai harness dans un home jetable :state/.lockreste un pid nu,state/.lock.sessionportepid=/session=, réacquisition par la même session acceptéeCompatibilité legacy sur le vrai harness :env -u CLAUDE_CODE_SESSION_ID bash bin/fm-lock.sh→ lock pris, aucunstate/.lock.sessionécritenv bash tests/fm-session-start.test.sh— 47 assertions vertes, dont le garde de concurrenceconcurrent session-lock acquisition admits exactly one live harnessTest de mutation : ajout temporaire defm_harness_session_is_ours() { return 0; }en fin debin/fm-session-lock-lib.sh(conjoint de corroboration retiré) →not ok - concurrent session-lock acquisition produced 40 winners, puisgit checkout -- bin/fm-session-lock-lib.shenv bash tests/fm-session-lock-ancestry.test.sh— la preuve d'ancêtrage historique reste inchangée et verteenv bash tests/fm-startup-network.test.sh— site d'appelfm_session_lock_owned_by_current_session(start/run)env bash tests/fm-sessionstart-nudge.test.sh— site d'appelbin/fm-sessionstart-run.shenv bash tests/fm-turnend-guard.test.shetenv bash tests/fm-claude-stop-autoarm.test.sh— chemins volontairement non touchés, toujours vertsenv bash tests/fm-cursor-primary.test.sh— chemin Cursor non touché, toujours vertVérification portable de l'extractionsession_idajoutée au recorder du live e2e, sur charge utile compacte, espacée, indentée et sanssession_idgit status --porcelainvide après nettoyage, aucun processussleep 300résidueldocs/fm-test-portable-shards.md:72- docs/fm-test-portable-shards.md's "Portable serial CI shards" table records 15/18/17/19 scripts (69 total) for portable-serial-1of4..4of4, but the lane currently derives 25/30/28/28 (111). This drift predates the branch by roughly 41 scripts: the base commit already had 146 tests against a table snapshotted at the 2026-08-02 hint refresh. This change adds one more test to that lane, nudging the count further without causing the discrepancy. Refreshing it is out of scope here because the documented procedure requires downloading fm-test-timing-portable-serial-* artifacts from a green CI run and replacing the portable_serial_weight_hints table in bin/fm-test-run.sh, which is a code change this documentation phase must not make. Nothing is unsafe meanwhile: the coverage guard keeps the partition complete and disjoint whatever the hints say, so a stale hint costs shard balance, not coverage. Worth a follow-up that re-runs the hint refresh and updates the table.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.