Repository navigation
Description
Environment
- Extension: GitHub Pull Requests 0.176.1
- VS Code: 1.145.2
- OS: macOS 27.2
Setup
A multi-root workspace with seven folders, each its own git repository with a single GitHub remote named origin (different GitHub repositories, same owner). Several repositories have PRs with the same number.
Steps to reproduce
- Open a multi-root workspace where repository A and repository B both have a PR numbered N. In A it is merged; in B it is open.
- In the Pull Requests view, under repository B, open PR #N and choose Open Changes.
Expected
The diffs for repository B's PR #N.
Actual
The changes list shows the right file names, but every diff is empty. The log shows the extension treating the PR as merged (it is A's #N that is merged), followed by a content lookup failure for every file:
[info] [PullRequestModel] PR is merged, fetching all file changes
[error] [PR] Cannot find content for document pr:/path/to/repoB/Makefile?{"baseCommit":"0ec1b76…","headCommit":"5f17020…","isBase":true,"fileName":"Makefile","prNumber":63,"status":3,"remoteName":"origin"}
Both commits exist in repository B's local clone (git cat-file -t returns commit). The pr: URI identifies the PR only by prNumber and remoteName, and every folder's remote is named origin, so the PR appears to be resolved against the first folder that has a #N.
Related symptom on window reload
After a reload, a previously viewed PR is restored before the repositories have opened, and the lookup falls back to the first folder:
[info] [Activation] Found 0 repositories during activation
[info] [FolderRepositoryManager+-1] GitHubRepository not found: owner/repoC
...
[error] [GitHubRepository+0] Error querying GraphQL API (PullRequest): GraphQL error: Could not resolve to a PullRequest with the number of 40.
Here PR #40 belongs to repoC, but it is queried against folder +0 (a different repository). This happened even after closing all PR tabs before the reload.
Related issues
- Approve and resolve act on the wrong folder when a repository and its worktrees are open in one window #8969 has the same root cause in a different setup: with a repository and its worktrees open, the overview binds to "the first folder with that remote" rather than the folder the clicked node belongs to. This report is the separate-repositories case. There the
pr:document URI carries onlyprNumber+remoteName, so PRs with the same number in different repositories collide. - Multi-root workspaces with two projects checked out to branches with open PRs either shows errors or misleading information #3490 (closed, 2022) covered earlier multi-root mismatches.
Notes
- Folder-manager indexes (
+0,+1, …) change between reloads, so any state keyed by index can point at a different repository after a reload. - Workaround: open the repository in its own single-folder window to review its PRs.
- Suggested fix: include the repository identity (owner/name or folder root URI) in the
pr:URI query and in persisted PR state, and resolve against that instead of the first folder manager with a matching remote name.
Activity