fix(coord): the shim ran the CALLER's checkout, so stale worktrees got no coordination - #55
Merged
Conversation
…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.
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.
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
cwdset to thesweepworktree: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.
inert-outside-a-repostill passes15 tests,
ruffandmypyclean.Note
#52merged while its test legs were still running — branch protection has no required status checks (protect-mainruleset has zero; legacy protection has one context that never reports). That's not what caused this bug, but it's why a defect reachedmainbefore CI had a chance to say anything.🤖 Generated with Claude Code