Skip to content

Multi-root workspace: PRs resolved by number + remote name only, so "Open Changes" loads the wrong repo's PR (empty diffs) #9179

Open

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

  1. 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.
  2. 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions