Desktop app: VS Code button opens original directory after creating worktree mid-session
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When using the Claude Code desktop app and creating/entering a worktree mid-session (e.g., by asking Claude to "work in a worktree"), the "Open in VS Code" button in the desktop app UI continues to open VS Code at the original session directory instead of the current worktree directory.
The session itself correctly operates in the worktree (all file operations, pwd, etc. resolve to the worktree path), but the desktop app's VS Code button is not aware of the directory change.
Notably, if you start a new session directly in a worktree directory, the VS Code button works correctly — it only fails to update when the working directory changes to a worktree mid-session.
What Should Happen?
After the session's working directory changes to a worktree, the desktop app's "Open in VS Code" button should update to open VS Code at the new worktree path.
Steps to Reproduce
- Open Claude Code desktop app in a git repository (e.g.,
/path/to/repo) - During the session, ask Claude to create/enter a worktree (e.g., "work in a worktree" or "create a worktree for this task"). The session moves to
.claude/worktrees/<name> - Confirm the session is operating in the worktree (
pwdshows worktree path, file operations target worktree) - Click the "Open in VS Code" button in the desktop app
- Actual: VS Code opens at
/path/to/repo(original directory) - Expected: VS Code opens at
/path/to/repo/.claude/worktrees/<name>(worktree directory)
Is this a regression?
I don't know
Platform
macOS (desktop app connecting to remote Linux machine over SSH)
Related Issues
- #31567 (closed) — similar issue with
/ideCLI command not matching cwd after worktree change - #42742 —
/clearresets working directory when inside a worktree (related directory state issue) - #28248 — permission scoping shows main worktree path instead of current worktree path
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗