fix(spawn): poll for a genuine isolated worktree, not just a differing path#414
Open
edugomz wants to merge 1 commit into
Open
fix(spawn): poll for a genuine isolated worktree, not just a differing path#414edugomz wants to merge 1 commit into
edugomz wants to merge 1 commit into
Conversation
…g path The post-treehouse-get worktree-detection loop accepted the first pane path that differed from the project directory. A brand-new pane can transiently report an unrelated pre-shell-init cwd before it ever reaches the project directory, which also differs and was wrongly latched onto, tripping the isolation guard against a path that was never the real worktree. Poll until the reported path itself resolves to a genuine, isolated git worktree instead, via a predicate shared with the final fatal check.
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
treehouse getworktree-detection loop inbin/fm-spawn.shaccepted the first pane path that merely differed from the project directory.tmuxcommands independent of any firstmate code (a fresh pane briefly reports the multiplexer's default directory for ~0.2-0.4s before settling), so this is a general timing race, not environment-specific.spawn_worktree_ok, a predicate shared with the existing fatalvalidate_spawn_worktreecheck), instead of accepting the first path that merely differs from the project directory.Test plan
tests/fm-spawn-worktree-race.test.shusing a fake tmux that scripts the exact transient-then-project-then-worktree sequence; fails against the pre-fix code, passes against the fix.fm-spawn-batch,fm-spawn-dispatch-profile,fm-tangle-guard,fm-backend*).shellcheck -x bin/fm-spawn.shclean.