PR status card disappears after `git branch -m` on session auto-branch

Resolved 💬 3 comments Opened Apr 25, 2026 by richburdon Closed Apr 29, 2026

Summary

Claude Code's PR/CI status card (the chip rendered in the input-area UI alongside the model/permissions row) disappears whenever the session's auto-created branch is renamed via git branch -m, and never recovers — even after a PR is opened from the renamed branch.

Repro

  1. Start a fresh session in a project that has the auto-worktree convention enabled. The harness creates a worktree at .claude/worktrees/<adjective>-<word>-<hex>/ on branch claude/<adjective>-<word>-<hex>.
  2. Per the standard "rename to a task slug" guidance (which the global Claude CLAUDE.md actively recommends), run from inside that worktree:

``
git branch -m claude/<task-slug>
``

  1. Continue working, push the branch, open a PR with gh pr create.

Expected: the PR status card appears in the UI, tracking the new branch's PR (URL, CI state).

Actual: the card never appears. Subsequent calls to gh pr create and <pr-created>...</pr-created> tags emitted by the assistant do not surface a card. Closing/reopening the session doesn't recover it. The PR itself is fine on GitHub; only the UI card is broken.

Probable cause

The UI seems to look up the session's PR by the original auto-branch name (claude/<adjective>-<word>-<hex>), not by the worktree path or the current branch. Once git branch -m runs, that key no longer matches anything on the remote, so the lookup permanently fails.

Why this matters

The rename flow is explicitly recommended in the default global instructions Anthropic ships:

Propose a task-relevant branch rename before doing any work … On confirmation, run git branch -m claude/<slug>. … The on-disk worktree directory keeps its random name; that's cosmetic. Everything that matters (git log, GitHub, PRs, gh pr list) reflects the new branch name.

So users who follow the recommended workflow lose the status card on every meaningful task — exactly the workflow the card is most useful for. Users who don't rename get the card but pollute their PR list with claude/charming-morse-7ed375-style branch names.

Suggested fixes (any of)

  1. Key the status card off the worktree path (which is stable) instead of the branch name.
  2. Update the lookup to follow git branch -m events (e.g. by listening to local branch changes and updating the cached identity).
  3. If neither is feasible, update the recommended-flow guidance in the default global instructions to either (a) discourage git branch -m for the auto-branch, or (b) clearly state that renaming costs the status card.

Workaround

For a given session, leaving the auto-branch name alone (and pushing the PR from claude/<adjective>-<word>-<hex>) keeps the card. There's no in-session recovery once the rename has happened.

Environment

  • Claude Code Desktop, Opus 4.7 (1M context).
  • macOS, observed across multiple sessions and projects.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗