[BUG] Desktop branch/worktree indicator not updated after EnterWorktree — shows main-checkout branch while session cwd is correctly in the worktree
Preflight
- Searched existing issues. The only prior reports are #50921 (closed not planned — auto-closed for inactivity; body was a single
/feedbackline with no repro) and #57251 (closed as a duplicate of #50921, which is itself dead). Refiling with a full repro per #50921's close note: "Please open a new issue if this is still relevant."
What's Wrong?
After the EnterWorktree tool switches the session into a git worktree on a different branch, the Claude Code UI repo/branch indicator (the <repo> <branch> chip) keeps displaying the main checkout's branch. The session's runtime cwd is correct — pwd and git rev-parse confirm the switch — so this is purely a stale UI indicator, not a cwd problem.
This is the inverse of #65554 (where /desktop transfer drops the runtime cwd itself). Here the runtime is right and only the displayed branch is wrong.
Steps to Reproduce
- Main checkout is on branch
A(e.g.feat/260605-10-06-settlement). EnterWorktreeinto a worktree on branchB(e.g.feat/260605-10-00-tran-lifecycle, under<repo>/.claude/worktrees/<name>). Tool returns "The session is now working in the worktree".- Verify the runtime actually switched:
pwd→ the worktree pathgit rev-parse --abbrev-ref HEAD→B✅
- Look at the Desktop UI chip → it still shows
<repo> A. ❌
Expected behavior
The branch/worktree indicator shows branch B, matching the live cwd / git rev-parse --abbrev-ref HEAD. It should refresh on both EnterWorktree and ExitWorktree.
Actual behavior
The chip stays on A (the main-checkout branch) for the entire time the session is inside the worktree, and never refreshes when entering or leaving the worktree.
Impact
Actively misleading. Combined with #65554, neither the transcript nor the UI chip can be trusted to tell which branch is live, so a user/model relying on the chip can edit or commit believing they are on a branch they are not on — a wrong-branch hazard. Distinct from #60097, which is about there being no indicator at all; here an indicator exists but reports the wrong branch.
Related
- #50921 — Status bar not updating after EnterWorktree (CLOSED, not planned; empty one-liner) — the canonical-but-dead report.
- #57251 — same symptom, well-described ("UI branch indicator, worktree sidebar continues to show the original/previous worktree and never updates"); CLOSED as a duplicate of #50921.
- #60097 —
[Desktop]no worktree/cwd indicator (feature request to add one). This report is different: the indicator exists but is stale/wrong. - #65554 —
/desktoptransfer drops the runtime cwd (cwd actually wrong). This report: cwd correct, indicator wrong — the inverse.
Suggested fix
Recompute the branch/worktree indicator from the session's live cwd on each EnterWorktree / ExitWorktree (and ideally on any cwd change), rather than caching the branch at session start / reading it from the main checkout.
Environment
- Claude Code CLI 2.1.165
- Claude Desktop app 1.11187.1
- macOS 15.7.4 (24G517), Apple Silicon
- Repo uses git
separate-git-dir; worktrees under<repo>/.claude/worktrees/<name>; multiple concurrent worktrees on different feature branches
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗