Repository navigation
fix(bin): accept tagged Windows session-lock holders - #7746
Conversation
…st and Claude auto-arm On Git Bash the session lock records its holder as a tagged win:<pid> (kunchenguid#6300), but four readers still passed that value to the numeric-only fm_pid_identity and fm_pid_alive: fm_supervision_host_main_key produced no key, fm_autoarm_claim_next pinned no lock-holder identity and dropped owner_session_id, fm_autoarm_claim_open rejected the non-numeric lock so a live claim never read as open, and fm_autoarm_midturn_healthy read a live holder as lapsed. Add fm_session_pid_alive and fm_session_pid_identity beside the tagged-pid contract in fm-session-lock-lib.sh. A tagged pid is answered from the Windows process table; every other value falls straight through to the existing numeric helpers, so POSIX behaviour is unchanged. The claim read-back checks the lock shape with fm_session_pid_valid. tests/fm-session-lock-windows-consumers.test.sh covers each reader on a faked Git Bash host, including an exited holder, a reissued Windows pid, and the tag off Windows, plus a parity case proving untagged values get exactly the numeric helpers' answers. Fixes kunchenguid#7739
…res to copy fm-session-lock-lib.sh alongside fm-supervision-engine-lib.sh in all three affected paths. The focused host/latch tests and tests/fm-session-lock-windows-consumers.test.sh pass; the full afk-return suite exceeded the 180s local timeout after earlier cases passed
|
CI on a7d42e3: 18 of 19 checks pass; Behavior portable serial 1 was cancelled at the 30-minute job limit, the known upstream portable-serial timeout that also cancelled on upstream main's runs for 147b267 and 842eab1. The first CI round on 2f85082 had three failures, each reproduced locally on the branch and on upstream main 147b267:
Both serial 3 and serial 4 pass on a7d42e3. |
|
Speaking as Kun's firstmate: thank you @ironerumi, this is a tidy, well-tested fix and it follows the plan from #7739 closely. What I checked on head
VISION.md:
Contract-class (mine): restore. Tagged Windows session locks are an existing, specified path (#6300), and these readers broke it. Unconfigured POSIX runs are unchanged. Status:
|
|
Thanks for the review. Here is what the real Git Bash run showed, and why it can't produce the evidence you asked for on this base. Run on Why: on main, What we do have: the same reader change runs in our fork (ironerumi/firstmate) on top of a lock-publish fallback for non-symlink filesystems. On that build (
Before this change, 3a, 3b and 3c failed on that box. So live Git Bash evidence for this PR on upstream main is blocked by the core lock, not by the readers. If it's useful, I can open a separate issue and PR that upstream the lock-publish fallback, so Git Bash homes can take the session lock at all. After that, this PR can be re-proven live on Windows without fork code. |
|
Speaking as Kun's firstmate: this is merged. Thank you @ironerumi — really appreciate you taking the time on this. Thanks also for the honest Git Bash write-up. The readers are proven on your fork build (3a/3b/3c fail before and pass after), and on upstream the run stops earlier, at the |
Intent
Open the upstream pull request for #7739, which the maintainer confirmed against main 842eab1 and labelled ready-for-pr. On Windows/Git Bash the session lock records its holder as a tagged
win:<pid>(#6300), but three readers still pass the raw lock value into the numeric-onlyfm_pid_alive/fm_pid_identityinbin/fm-wake-lib.sh:fm_supervision_host_main_key(bin/fm-supervision-engine-lib.sh) gets no key, so attended wakes go to main;fm_autoarm_claim_nextrecords no lock-holder identity and dropsowner_session_id; andfm_autoarm_claim_openrejects a non-numeric lock, so a live Claude Stop auto-arm claim is never seen as open and the next firing double-arms. The maintainer asked for the Cygwin-fake tests, real Git Bash evidence for the three readers, untagged values falling straight through to the current helpers so POSIX stays unchanged, and submission throughgit push no-mistakes.What Changed
win:<pid>support for the supervision-host session key and Claude auto-arm claim consumers.Risk Assessment
✅ Low: The change is contained to the existing Windows session-lock boundary, routes all four affected readers through it, preserves numeric fallback behavior, and adds behavioral fake-Cygwin coverage.
Testing
Drove the real lock, supervision, and auto-arm shell libraries with disposable Cygwin/MINGW and POSIX boundaries and captured the focused behavior log. The focused scenarios passed, but the explicit real Git Bash evidence requirement could not be exercised because this host is Darwin and has no Windows compatibility runtime; an adjacent supervision-host suite also exceeded the command timeout.
Evidence: Windows session-lock consumer behavior
Source: Windows session-lock consumer behavior
Readers fixed
All four numeric-only readers of the session lock now go through
fm_session_pid_identity/fm_session_pid_aliveinbin/fm-session-lock-lib.sh:fm_supervision_host_main_key,fm_autoarm_claim_next,fm_autoarm_claim_open, andfm_autoarm_midturn_healthy, which the issue triage also lists among the verified numeric-only readers.A tagged
win:<pid>is decoded only on a Cygwin-family host; every untagged value goes unchanged to the existingfm_pid_identity/fm_pid_alive, and the parity case intests/fm-session-lock-windows-consumers.test.shasserts identical exit codes and output for live, dead, empty, non-numeric, and off-Windows tagged values.Windows evidence
Real Git Bash cannot run on the Darwin host that validated this head.
Evidence: the Cygwin-fake checks in
tests/fm-session-lock-windows-consumers.test.shplus the reporter's real MINGW64 run of the same reader fix on fork commit 55cb6d4 (session lockwin:12864; each reader failed before the fix and passed after).fm_autoarm_midturn_healthyhas fake-only evidence.A real Git Bash run on this exact head will be posted as a PR comment.
Against unfixed
origin/mainbin/, each Cygwin-fake reader case fails: no main-session key for a livewin:7204holder, the auto-arm claim dropsowner_session_id, and mid-turn health reads a live holder as unhealthy.Known unrelated flake
tests/fm-supervision-host.test.shcasetest_undelivered_dialog_is_fed_again_on_the_next_turn(mirror boundary) is load-sensitive on a heavily loaded macOS host (load average about 20).On this branch it failed once in the full suite and 1 of 3 isolated reruns; on unchanged
origin/mainbin/it failed 3 of 3 isolated reruns under the same load, so it is not caused by this change.Every other case in that suite passed on this branch.
Fixes #7739
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
git-bash.exe,bash.exe,cygpath, orwsl.exe) to provide that platform boundary. Re-run the three-reader scenarios on a Windows host with Git for Windows/Git Bash, or explicitly accept the Cygwin-fake evidence only.bash tests/fm-session-lock-windows-consumers.test.shbash tests/fm-session-lock-ancestry.test.shbash tests/fm-claude-stop-autoarm.test.shbash tests/fm-supervision-host.test.sh(timed out at 180 seconds)command -v git-bash.exe bash.exe cygwin mintty cygpath pwsh.exe wsl.exegit status --short✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.