Desktop app: worktree directory and branch names diverge, and the status bar does not follow mid-session branch changes
Environment
| | |
|---|---|
| Surface | Claude Code in the desktop app, compared against the same version in the terminal |
| Desktop app | com.anthropic.claudefordesktop 1.26832.0 (macOS) |
| Claude Code | 2.1.220 (claude --version) |
| OS | macOS 26.3.1 |
| Repo | private monorepo, several project dirs under one git root, sparse-checkout worktrees |
Three separate issues, ordered by how much they cost us. #2 and #3 are reproduced with git evidence below; #1 is observed behavior we have not instrumented.
Paths and branch names below are redacted: <proj> is our project dir, <team>/ is our required branch prefix. App-generated names are shown as-is because their shape is the point.
---
1. Status bar does not follow a branch/worktree change made during the session (observed, not instrumented)
If a branch or worktree is created mid-session — by the user via CLI, or by the agent via EnterWorktree / claude --worktree — the CLI status line follows the move. The desktop app's bottom bar does not: it stays pinned to whatever branch the session opened with.
Effect: the bar silently reports the wrong branch, and the diff count belongs to a branch we are no longer on. There is no visible signal that it went stale.
Expected: the bottom bar re-resolves the branch and worktree on change, the same way the CLI status line does.
2. Worktree directory name and branch name permanently diverge; the initial branch is left dangling
The app names the worktree directory from a random codename at creation time, then creates a different branch when the first user message arrives (slugged from that message). The directory name is never revisited, and the original branch is abandoned.
$ git worktree list --porcelain | grep -E '^(worktree|branch)' | paste - -
<proj>/.claude/worktrees/gifted-burnell-d761bd refs/heads/claude/test-70fb8b
<proj>/.claude/worktrees/<taskA>-f1b358 refs/heads/claude/<taskB>-3e4e2e
Note the second row: directory and branch are slugged from two entirely different task names.
Reflog for the first worktree, in order:
aaaaaaa HEAD@{3}: # worktree created on claude/gifted-burnell-d761bd
aaaaaaa HEAD@{2}: checkout: moving from claude/gifted-burnell-d761bd to HEAD
bbbbbbb HEAD@{1}: checkout: moving from aaaaaaa to claude/test-70fb8b
Two consequences:
claude/gifted-burnell-d761bdstill exists ataaaaaaa, owned by no worktree. Every app-created worktree leaves one of these behind.- The replacement branch is not created from the old one and not from the same commit —
aaaaaaaandbbbbbbbare three commits apart. Any commit made in the worktree before the first user message is stranded on the abandoned branch.
Expected: one worktree, one branch, one name. Either name the branch at creation and keep it, or rename the existing branch (and ideally the directory) instead of creating a second one.
3. No way to configure the claude/ branch prefix
The worktree block in .claude/settings.json accepts symlinkDirectories, sparsePaths, baseRef, bgIsolation. There is no branch-prefix key, and claude/ appears to be hardcoded.
Our repo convention allows exactly one branch prefix (<team>/), enforced in our contributing docs. Today the documented workaround is a manual git branch -m after every app-created worktree — which issue #2 then appears to undo, since the app creates a fresh claude/* branch at the first message regardless. (We have not confirmed whether the app skips the re-branch when it detects a manual rename.)
Request: a worktree.branchPrefix setting, or respect an existing branch name rather than minting a new one.
---
What works
The bottom-bar diff counter is accurate for working-tree state, not just committed state: staging a 5-line file moved it from +21 -0 to +26 -0 immediately, matching git diff --cached --shortstat. That part is fine.