Session branch chip is stale — shows branch from session start, not current HEAD
Summary
The session header chip in Claude Code (Cowork sessions specifically) shows the branch the session was bound to at creation time, and does not refresh when the branch is renamed, deleted, or when HEAD moves to a different branch during the session.
Environment
- Claude Code (Cowork session, via Claude Desktop / web UI)
- Host repo: standard git repo, single or multiple worktrees
Steps to reproduce
- Start a Claude Code / Cowork session inside a worktree currently on branch
feature-xyz. - During the session, delete
feature-xyzlocally and on the remote (e.g., after merging it intomainand cleaning up). - Check out a different branch —
develop,main, etc. — and continue work. - Look at the session header chip (the
main ← feature-xyzstyle chip).
Expected
Chip reflects the current HEAD. For example, after checking out develop following a branch delete, the chip should show develop (or main ← develop if it also tracks a target branch).
Actual
Chip still shows the original feature-xyz branch from session creation time, even though:
- The branch no longer exists locally (
git branchdoesn't list it) - The branch no longer exists on remote (
git ls-remotedoesn't list it) - Git itself has no trace of it (checked
for-each-ref,packed-refs,reflog,.git/info/refs)
Impact
Minor — mostly cosmetic confusion. Git CLI operations (commit / push / merge) work correctly because they ignore the chip. But the UI sows doubt about where work is actually landing, and made me second-guess whether my cleanup had succeeded.
Suggested fix
Poll git symbolic-ref --short HEAD (or git branch --show-current) on a short interval, or subscribe to file-system events on .git/HEAD, and update the chip. Fall back to the short commit SHA when in detached HEAD. VS Code's source-control view does this.
Workaround
Starting a new Claude Code session in the current worktree rebinds the chip correctly.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗