[BUG] "View PR" button sticks to the first PR when a session creates multiple PRs across different branches
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In a Claude Code session that creates multiple pull requests on different branches, the "View PR" (PRを表示) button stays pinned to the first PR — even after that PR is merged and a newer PR is created later in the same session on a different branch. The button opens a merged PR with a "Merged" badge, and there is no way to reach the newer open PR from the button. Users have to copy the new PR URL out of Claude's chat text manually.
Confirmed on both the Claude Code mobile app and the web UI.
This looks related to but distinct from several previously auto-closed reports:
- #30757 — stale PR link after branch switch (Closed, Not Planned)
- #11161 — "View PR" routes to merged PR when reusing the same branch name (Closed, Not Planned)
- #34042 — duplicate of #30757
- #15313 — mobile variant, duplicate of #11161
Those reports all frame the root cause as "branch-name cache not invalidated." My repro uses different branch names, which rules out branch-name caching as the explanation. The only state shared between the two PRs in my repro is the Claude Code session ID itself, which strongly suggests the UI caches a session_id → pr_number mapping at the first create_pull_request tool use and never re-resolves it.
TUI already received a parallel fix in #24834 ("only show open PRs", completed Feb 2026). The mobile app and web UI have not.
Workarounds I tried from inside the session that did not work:
- Calling
mcp__github__update_pull_requeston the newer PR to make it the most recent GitHub tool call. - Removing the
https://claude.ai/code/session_...link from the merged PR's body so a body-scan would only match the newer PR.
Neither had any effect on the button target, consistent with server-side caching of the session → PR mapping.
What Should Happen?
The "View PR" button should open the most recently created PR associated with the current session, preferring open PRs over merged ones.
Specifically:
- Re-resolve the session → PR mapping on every
create_pull_request/update_pull_requesttool use, not cache at first call. - Prefer the most recently created PR whose head branch matches any branch the session has pushed to (not just the currently checked-out one).
- Prefer open PRs over closed/merged ones.
- If only merged PRs exist, hide the button or label it explicitly (e.g. "View merged PR #N") so users aren't surprised.
A merged PR is a historical commit, not an actionable PR — linking the "View PR" button to it is strictly misleading.
Error Messages/Logs
(No error output — this is a UI routing bug, not a crash or tool failure. The GitHub MCP tools succeed and return the correct PR URLs; only the "View PR" UI button resolves to the wrong PR.)
Steps to Reproduce
- Start a new Claude Code session. Ask it to fix something small. Claude creates a branch (e.g.
claude/feature-a), pushes it, and callsmcp__github__create_pull_request. PR #N is created and appears as the target of the "View PR" button. ✅ correct at this point.
- Review and merge PR #N on GitHub (outside Claude).
- In the same Claude Code session, ask Claude to do an unrelated task. Claude checks out
main, creates a different branch (e.g.claude/feature-b), pushes it, and callsmcp__github__create_pull_requestagain. PR #N+1 is created and is in the "open" state. Claude's chat output contains the correct URLhttps://github.com/OWNER/REPO/pull/N+1.
- Tap/click the "View PR" (PRを表示) button at the bottom of the conversation screen.
Expected: browser opens PR #N+1 (open).
Actual: browser opens PR #N (merged). The merged PR page loads with a "Merged" badge. PR #N+1 is unreachable from the button.
Key detail for reproduction: the two branches must have different names (claude/feature-a vs claude/feature-b), to distinguish this from the branch-name cache bug reported in #11161 / #30757. No branch reuse, no branch rename, no git push --force.
Reproduced on both:
- Claude Code mobile app (iOS)
- Claude Code web UI (browser)
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
/A — mobile app / web UI bug, not CLI
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Important: this bug is NOT in the Claude Code CLI. It is in the Claude Code Android mobile app and the web UI (claude.ai/code) accessed via Chrome on Android. The CLI-specific fields above (Claude Code Version, Terminal/Shell, Operating System) do not apply — I filled them in only because they are required. The bug_report.yml template does not currently have a good path for reporting non-CLI bugs; you may want to add a separate template for mobile/web.
Reproduced on
- Claude Code Android mobile app
- Claude Code web UI via Chrome on Android (claude.ai/code)
Both surfaces show identical behavior. iOS and desktop browsers not tested.
Related auto-closed issues (branch-name cache framing, all closed Not Planned)
- #30757 — Desktop app shows stale PR link after branch switch
- #11161 — "View PR" routes to merged PR when reusing branch name
- #34042 — duplicate of #30757
- #15313 — mobile variant, duplicate of #11161
This report is distinct
All of the above frame the root cause as "branch-name cache not invalidated." My reproduction uses two different branch names (claude/feature-a and claude/feature-b), which rules out branch-name caching as the explanation. The only shared state between the two PRs is the Claude Code session ID — strongly suggesting a cached session_id → pr_number mapping that is set at the first create_pull_request tool use and never re-resolved.
TUI already has a parallel fix
#24834 ("Footer shows closed/merged PR indicator — should only display open PRs") was completed Feb 2026 for TUI. The Android app and web UI have not received the equivalent treatment.
Workarounds attempted (none worked)
- Calling
mcp__github__update_pull_requeston the newer PR to make it the most recent GitHub tool call. - Removing the
https://claude.ai/code/session_...link from the merged PR's body.
Consistent with server-side caching of the session → PR mapping, not a body-scan at click time.
Please do not auto-close as duplicate
All four related reports were auto-closed due to 60-day inactivity, not because they were fixed. Please read the "This report is distinct" note above before closing this as a duplicate of them.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗