# \[Bug\]: Sidebar thread label keeps the branch stamped at thread creation after the session switches worktree and branch · Issue \#11078 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/issues/11078)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: backlog

Priority: 0

## Description

[Discussion and activity](https://git.cafe/pingdotgg/t3code/issues/11078)

---

### Before submitting

- [x] I searched existing issues and did not find a duplicate.
- [x] 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

1. Open a project that has several git worktrees under `.claude/worktrees/`.
2. 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`.
3. In the thread, have the agent switch into an existing worktree (the `EnterWorktree`
   tool with a `path`) and then `git checkout main` there.
4. 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: <version>
- 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

```shell

```

### Screenshots, recordings, or supporting files

_No response_

### Workaround

_No response_
