fix(web): stop opening base checkout for unprovisioned worktree threads - #1766
Merged
Merged
Conversation
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.
What
Previously, the chat header's Open In button and the Thread Overview local-path row computed their directory as
thread.worktree_path ?? workspace.path. For amode: \"worktree\"thread,worktree_pathisnullduring the provisioning window, so the fallback silently opened the base checkout instead of the thread's worktree. Reproduced with Zed: its workspace DB recorded an open of the base directory even though the thread record held the correct worktree path.Both call sites now use a shared
resolveThreadDirPathhelper inapps/web/src/lib/worktree.ts: worktree threads get their worktree path ornull(button disabled, overview shows "Unavailable"), and direct threads keep the workspace fallback. Verified with new unit tests for the helper and HeaderActions cases asserting a worktree thread without a path no longer resolves the workspace directory.Why
Opening the user's configured editor on a worktree thread should always land in that thread's worktree. Falling back to the base checkout made the editor open a different working tree than the one the user is in, so edits could silently land on the wrong files.
UI Changes
Behavioral only: the Open In button is now disabled and the overview shows "Unavailable" for a worktree thread whose path has not been provisioned, instead of pointing at the base checkout. No layout or visual changes.
Config Changes
None.
Review Notes
None.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.