claude-code - 💡(How to fix) Fix Desktop app: VS Code button opens original directory after creating worktree mid-session [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45202Fetched 2026-04-09 08:10:54
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×5renamed ×1
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • 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

  1. Open Claude Code desktop app in a git repository (e.g., /path/to/repo)
  2. 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>
  3. Confirm the session is operating in the worktree (pwd shows worktree path, file operations target worktree)
  4. Click the "Open in VS Code" button in the desktop app
  5. Actual: VS Code opens at /path/to/repo (original directory)
  6. 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 /ide CLI command not matching cwd after worktree change
  • #42742 — /clear resets 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

extent analysis

TL;DR

The "Open in VS Code" button in the Claude Code desktop app needs to be updated to reflect the current worktree directory when the session's working directory changes mid-session.

Guidance

  • The issue seems to be related to the desktop app not updating its internal state when the working directory changes to a worktree mid-session.
  • To verify the issue, follow the steps to reproduce and check if the pwd command shows the correct worktree path while the "Open in VS Code" button still opens VS Code at the original directory.
  • A potential workaround could be to restart the session after creating/entering a worktree, as the issue only occurs when the working directory changes mid-session.
  • Reviewing related issues (#31567, #42742, #28248) may provide insight into similar directory state issues and potential solutions.

Example

No code snippet is provided as the issue is related to the desktop app's behavior and not a specific code implementation.

Notes

The issue may be related to how the desktop app handles directory changes mid-session, and fixing this may require updates to the app's internal state management.

Recommendation

Apply workaround: Restart the session after creating/entering a worktree, as this allows the "Open in VS Code" button to work correctly. This is a temporary solution until the underlying issue with the desktop app's directory state management is addressed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING