fix(server): a branch checked out in the terminal updates the branch label right away

A checkout made outside T3 Code, such as `git switch -c` in the integrated
terminal, calls no refresh RPC, and the background poll only reread local
status when ahead/behind counts moved. A new branch without an upstream
stayed labelled with the old branch until something else refreshed it.

Each status subscription now shares a per-checkout watch on the directory
holding its HEAD file (resolved with `git rev-parse --git-path HEAD`, so
linked worktrees work). A HEAD change rereads remote status without a fetch
and local status, and publishes them in one snapshot so the new branch is
never paired with the previous branch's PR or counts. The watch ends with
its last subscriber. The poll now rereads local status as a fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47c65ce325Julius Marminge committed on 10/22/2026, 1:37:51 AMparent039cae3
3 files changedLine totals unavailable