[Bug]: Sidebar thread label keeps the branch stamped at thread creation after the session switches worktree and branch
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
What happens
The branch label (and the linked-MR badge) on a thread row in the sidebar is the branch
the thread started on. If the session later moves to a different worktree and checks out
a different branch, the row keeps showing the original value for the rest of the thread's
life. There is no refresh, and nothing in the row hints that it is a historical value.
Steps to reproduce
- Open a project that has several git worktrees under
.claude/worktrees/. - Start a thread from the main checkout while it is on some branch — here
fix/preview-uri-expiry-retry, which had a linked MR!164. - In the thread, have the agent switch into an existing worktree (the
EnterWorktree
tool with apath) and thengit checkout mainthere. - Look at the thread's row in the sidebar.
Notes
This looks like the exact divergence PR #8126 ("fix(web): sidebar follows a worktree
thread's live branch", closed unmerged 2026-08-25) described: the sidebar renders
thread.branch from persistent storage while the thread view uses the live
gitStatus.refName. That PR's own "Deviations" section notes that other thread-level
features still key off the stamped branch — which would explain the MR badge too.
Related: #8204, #8209.
Practical impact: with several worktrees open per project, the sidebar is not a reliable
answer to "where is this session working" — it silently reports a stale location.
Environment
- T3 Code:
- macOS 15 (Darwin 25.6.0), Apple silicon
- Project hosted on a self-hosted GitLab (MRs, not GitHub PRs)
Expected behavior
The row shows the branch the session is actually on — main, in the worktree it moved
into — or at minimum stops asserting a branch it is no longer on.
Actual behavior
The row still reads fix/preview-uri-expiry-... with the #164 badge, while the session
is in .claude/worktrees/home-screen-figma-design-8d2b90 on main. Verified from inside
the thread:
$ pwd
/Users/…/ggg-app-prometheus/.claude/worktrees/home-screen-figma-design-8d2b90
$ git rev-parse --abbrev-ref HEAD
main
!164 has also been merged and its remote branch deleted since the thread started, and
the badge still shows it — possibly the same root cause, since the MR is resolved from the
same stamped branch.
Impact
Major degradation or frequent failure
Version or commit
No response
Environment
No response
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the sidebar thread row's use of persistent thread.branch and compare it with the thread view's live gitStatus.refName after EnterWorktree(path) and git checkout. Reproduce the listed worktree scenario, then verify that the row and linked-MR badge follow the active worktree and branch rather than the creation-time branch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, gitlab, typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100