Skip to content

fix(web): stop opening base checkout for unprovisioned worktree threads - #1766

Merged
chuks-qua merged 1 commit into
mainfrom
fix/worktree-open-in-base-checkout
Sep 25, 2026
Merged

chuks-qua merged 1 commit into
mainfrom
fix/worktree-open-in-base-checkout

Conversation

@chuks-qua

@chuks-qua chuks-qua commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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 a mode: \"worktree\" thread, worktree_path is null during 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 resolveThreadDirPath helper in apps/web/src/lib/worktree.ts: worktree threads get their worktree path or null (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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@chuks-qua
chuks-qua merged commit ef615bd into main Sep 25, 2026
6 checks passed
@chuks-qua
chuks-qua deleted the fix/worktree-open-in-base-checkout branch September 25, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant