Repository navigation
fix(#909): resolveLocksDir resolves against the shared git checkout root, not cwd - #918
Merged
admarble merged 2 commits intoAug 8, 2026
Conversation
…oot, not cwd acquiring a lock from a subdirectory (or a linked worktree) was a silent no-op: pre-tool.sh's checkout guard reads .sequant/locks from the command's git toplevel, while resolveLocksDir resolved it against process.cwd(). The two only agreed when the CLI ran from the repository root. Resolves via `git rev-parse --path-format=absolute --git-common-dir`, which also unifies a linked worktree with the main checkout's locks dir (both lock types need to be visible from any worktree). Falls back to today's cwd-relative behavior outside a git repository. SEQUANT_LOCKS_DIR and an explicit locksDir option keep top priority, unchanged. No call-site changes needed -- LockManager/CheckoutLock construction is the single choke point every consumer (status, merge, resume, run-orchestrator, locks) already goes through.
…, class coverage - Drop the --path-format=absolute dependency (Git >=2.31): plain --git-common-dir (Git >=2.5) resolved by hand via resolve(cwd, out) works identically and doesn't silently re-open the bug on an older git, where the flag would fail into the same catch as "not a repo". - Add an end-to-end integration test that drives the real built CLI to acquire the checkout lock from a subdirectory with no SEQUANT_LOCKS_DIR override, then runs the real pre-tool.sh hook against it -- the literal scenario from the bug report, not just the unit that fixes it. Mutation-verified: fails against the pre-fix behavior, passes against the fix. - Add LockManager/CheckoutLock class-level tests (not just the bare resolveLocksDir function) so CheckoutLock's use of the fix is exercised directly instead of relying on "it imports the same function" by inspection.
admarble
deleted the
feature/909-fix-locks-locks-dir-is-cwd-relative-while-the-
branch
August 8, 2026 09:17
7 tasks
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.
Summary
resolveLocksDirresolved.sequant/locksagainstprocess.cwd(), whilepre-tool.sh's checkout guard reads it from the command's git toplevel — the two only agreed when the CLI ran from the repository root, so acquiring a lock from a subdirectory was a silent no-op with zero protection.git rev-parse --path-format=absolute --git-common-dir, which also unifies a linked worktree with the main checkout's locks dir (deliberately chosen over the issue's own--show-toplevelfix sketch — see rationale in the CHANGELOG entry and QA notes). Falls back to today's cwd-relative behavior outside a git repository.status,merge,resume,run-orchestrator,locks) already routes through this one function.AC Coverage
resolveLocksDirresolves against the shared git checkout root, notprocess.cwd()SEQUANT_LOCKS_DIRand the explicitlocksDiroption keep top priorityTest plan
npm run build— cleannpm run lint— cleannpx vitest run src/lib/locks/— 155 passed (58 unit + 4 new AC tests + checkout-lock + other integration)LockManager/CheckoutLockconsumers (status,resume,run-orchestrator,locksCLI integration) — 211 passed totalCloses #909
🤖 Generated with Claude Code