Branch overview panel shows phantom branches from stale historical PRs
Description
The branch overview panel in Claude Code renders "branch sync" rows that don't correspond to any branch actually present in the repository (locally or on the remote).
Clicking the Merged action on such a phantom row opens a real but very old, long-merged PR — which strongly suggests the panel is building its branch chain from historical PR metadata returned by the GitHub API, without verifying that the baseRefName / headRefName of those PRs still exist as branches.
Reproducer
Affected repo (private) has the following current git state:
$ git branch -a | grep -E "(master|main|development)"
main
remotes/origin/HEAD -> origin/main
remotes/origin/development
There is no master branch locally or on origin (also verified against packed-refs). The repo did have a master branch years ago — it was renamed/deleted and the default branch is now main. Long-lived branches today are main and development.
Despite that, the panel renders three rows:
development ← feature/<topic>— correct (real open PR).master ← development(Merged) — phantom, clicking it opens a PR from August 2021 that targeted the now-removedmaster.main ← master(Create PR, +14942 −15146) — phantom,masterdoes not exist.
Expected
- Branch overview should reflect current git state.
- Branches that no longer exist on the remote should not be rendered as nodes in the chain.
- The default-branch chain should be derived from current refs (here:
development → main), not frombaseRefNameof stale historical PRs.
Actual
The panel appears to infer a development → master → main chain by reading historical PRs whose base/head branches have since been deleted, and confidently renders rows for those dead branches — including a Create PR button against a non-existent base, with a nonsensical diff count (+14942 / −15146) because it's diffing against something that isn't there.
Environment
- Claude Code (latest as of 2026-05-12)
- macOS Darwin 25.3.0
- Repo: private monorepo; happy to share more details privately if useful.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗