Skip to content

fix(coord): the shim ran the CALLER's checkout, so stale worktrees got no coordination - #55

Merged
wshallwshall merged 1 commit into
mainfrom
claude/inter-session-communication-3f85ea
Jul 29, 2026
Merged

fix(coord): the shim ran the CALLER's checkout, so stale worktrees got no coordination#55
wshallwshall merged 1 commit into
mainfrom
claude/inter-session-communication-3f85ea

Conversation

@wshallwshall

Copy link
Copy Markdown
Collaborator

The bug, shipped in #52 an hour ago

The hook shim resolved git rev-parse --show-toplevel — the worktree the session is sitting in — and ran that checkout's script.

A worktree on a branch predating a coordination change has none of those scripts. The shim found nothing and exited 0. That session got no banner and no collision gate, and nothing reported the absence.

Silence is indistinguishable from "no collisions" — the same shape as the bug this whole layer exists to fix.

Caught by actually using it

Immediately after install, I ran the user-level shim with cwd set to the sweep worktree:

scripts/coord/overlap.ps1            ABSENT
scripts/hooks/collision_gate.ps1     ABSENT
scripts/coord/session-registry.ps1   ABSENT

That branch predates the merge. It ran the previous banner protocol and no gate at all — while reporting nothing wrong.

Fix

The shim resolves the primary checkout (via --git-common-dir), which tracks main, so every session runs the same current code whatever branch it's on. The calling worktree stays as a fallback for layouts where the primary is absent.

Coordination is infrastructure and has to be uniform. Two sessions running different versions of the collision protocol is precisely the drift the shared liveness fence was consolidated to prevent — and it's worse here, because the divergence is invisible from both sides.

Verification

The new test builds a primary holding the script plus a worktree deliberately without it, and asserts the shim reaches the primary's copy.

Mutation Expected Result
revert the shim to cwd-resolution (the shipped bug) new test reds, others hold ✅ reds; inert-outside-a-repo still passes

15 tests, ruff and mypy clean.

Note

#52 merged while its test legs were still running — branch protection has no required status checks (protect-main ruleset has zero; legacy protection has one context that never reports). That's not what caused this bug, but it's why a defect reached main before CI had a chance to say anything.

🤖 Generated with Claude Code

…t no coordination

Shipped in #52 and wrong. The hook shim resolved `git rev-parse --show-toplevel`, i.e.
the worktree the session is sitting in, and ran that checkout's script. A worktree on a
branch that predates a coordination change has none of those scripts -- so the shim
found nothing and exited 0. That session got no banner and no collision gate, and
NOTHING REPORTED THE ABSENCE. Silence is indistinguishable from "no collisions", which
is the same shape as the bug this whole layer exists to fix.

Measured immediately after installing: the `sweep` worktree sits on a branch older than
the merge and has no overlap.ps1 or collision_gate.ps1 at all, so it ran the previous
protocol for the banner and no gate whatsoever.

Coordination is INFRASTRUCTURE and has to be uniform. Two sessions running different
versions of the collision protocol is exactly the drift the shared liveness fence was
consolidated to prevent -- and it is worse here, because the divergence is invisible
from both sides. The shim now resolves the PRIMARY checkout (via --git-common-dir),
which tracks main, so every session runs the same current code whatever branch it is
on. The calling worktree stays as a fallback for layouts where the primary is absent.

The new test builds a primary holding the script plus a worktree deliberately WITHOUT
it, and asserts the shim reaches the primary's copy. Verified by mutation: reverting the
shim to cwd-resolution reds it, so it pins the behaviour rather than the script merely
running.
@wshallwshall
wshallwshall merged commit 43093cf into main Jul 29, 2026
32 checks passed
@wshallwshall
wshallwshall deleted the claude/inter-session-communication-3f85ea branch July 29, 2026 22:03
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.

1 participant