fix: improve implicit queue path resolution in worktrees - #2
Merged
Conversation
DerekStride
force-pushed
the
worktree-aware
branch
from
March 17, 2026 03:45
7673b37 to
fc3c6f0
Compare
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
This changes implicit queue path resolution to follow git worktree semantics instead of treating the default queue path as purely cwd-relative.
Resolution order is now:
--queueexactlySQ_QUEUE_PATHexactly.sift/issues.jsonlgit-dir != git-common-dir), mirror that same upward search in the main worktree<cwd>/.sift/issues.jsonl.sift/issues.jsonlunder the current directoryWhy
The old default of
.sift/issues.jsonlworked like a cwd-relative path. That caused two problems:sqfrom a nested directory could accidentally create a new queue instead of finding an existing project or subproject queueImplementation notes
--show-toplevel--git-dir--git-common-dirgitExamples
Simple linked-worktree example
Consider:
/projects/sq/projects/sq.feature/projects/sq.feature/projects/sq/.sift/issues.jsonlsqfirst checks the linked worktree itself:/projects/sq.feature/.sift/issues.jsonlIf that file does not exist, it mirrors the cwd into the main worktree and checks:
/projects/sq/.sift/issues.jsonlSince that queue exists,
squses/projects/sq/.sift/issues.jsonl.Example: Nested Directories
For linked worktrees,
git rev-parse --git-dirandgit rev-parse --git-common-dirdistinguish whether the current checkout is the main worktree or a linked one.Consider:
/trees/feature/repo/trees/feature/src/packages/alpha/clientFirst,
sqsearches upward in the current worktree for the nearest existing queue:/trees/feature/src/packages/alpha/client/.sift/issues.jsonl/trees/feature/src/packages/alpha/.sift/issues.jsonl/trees/feature/src/packages/.sift/issues.jsonl/trees/feature/src/.sift/issues.jsonl/trees/feature/.sift/issues.jsonlThat covers the nested-directory case: if a narrower queue already exists in the current worktree, it will be found and used.
If none of those exist and this is a linked worktree,
sqmirrors the relative pathsrc/packages/alpha/clientinto the main worktree and performs the same upward search there:/repo/src/packages/alpha/client/.sift/issues.jsonl/repo/src/packages/alpha/.sift/issues.jsonl/repo/src/packages/.sift/issues.jsonl/repo/src/.sift/issues.jsonl/repo/.sift/issues.jsonlIf
/repo/src/packages/.sift/issues.jsonlexists, that file is used.If nothing exists in either place,
sqfalls back to the current working directory:/trees/feature/src/packages/alpha/client/.sift/issues.jsonl