Skip to content

Prevent the Active Pull Request view from disappearing - #8878

Open
Alex Ross (alexr00) with Copilot wants to merge 8 commits into
mainfrom
copilot/fix-github-pull-request-icon-disappearance
Open

Prevent the Active Pull Request view from disappearing#8878
Alex Ross (alexr00) with Copilot wants to merge 8 commits into
mainfrom
copilot/fix-github-pull-request-icon-disappearance

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The Active Pull Request view could disappear when branch resolution selected a newer merged PR or when virtual repositories could not persist PR metadata.

  • PR selection

    • Keep explicitly checked-out PRs authoritative for their local branch.
    • Prefer open PRs over newer merged or closed PRs.
  • Polling resilience

    • Re-resolve missing metadata for active PRs.
    • Preserve the active view when refresh fails transiently on an unchanged branch.
  • Regression coverage

    • Cover explicit checkout, stacked PR selection, and non-persistent metadata scenarios.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI and others added 5 commits August 6, 2026 08:43
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix disappearing GitHub pull request icon in VS Code toolbar Prevent the Active Pull Request view from disappearing Aug 6, 2026
@alexr00
Alex Ross (alexr00) marked this pull request as ready for review August 7, 2026 16:13
Copilot AI lite review requested due to automatic review settings August 7, 2026 16:13
@alexr00
Alex Ross (alexr00) enabled auto-merge (squash) August 7, 2026 16:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses cases where the Active Pull Request view can disappear by tightening PR selection (explicit checkout remains authoritative; open PRs are preferred) and making polling/metadata resolution more resilient when local PR metadata is missing or transient refresh fails.

Changes:

  • Update ReviewManager.validateState to (a) keep explicitly checked-out PRs authoritative for their branch and (b) retain the active PR view when metadata refresh fails transiently on an unchanged branch.
  • Update GitHubRepository.getPullRequestForBranch GraphQL query + selection logic to prefer open PRs over newer merged/closed PRs from the same head ref.
  • Add regression tests covering explicit checkout authority, missing metadata recovery, transient refresh failure, and open-vs-merged PR preference.
Show a summary per file
File Description
src/view/reviewManager.ts Adjusts branch/PR resolution and polling behavior to prevent the Active PR view from being cleared in more cases.
src/test/view/reviewManager.test.ts Adds regression tests for explicit checkout authority and metadata recovery/retention during polling.
src/test/github/githubRepository.test.ts Adds test verifying open PRs are preferred over newer merged PRs for the same branch.
src/github/queriesLimited.gql Extends PullRequestForHead query to include an openPullRequests alias for OPEN state results.
src/github/queriesExtra.gql Same PullRequestForHead query extension for the “extra” schema variant.
src/github/queries.gql Same PullRequestForHead query extension for the main schema.
src/github/graphql.ts Updates PullRequestsResponse typing to include openPullRequests.
src/github/githubRepository.ts Combines/dedupes open + all PR nodes and prefers an open PR when selecting the PR for a branch.
src/@types/vscode.proposed.chatSessionsProvider.d.ts Makes promo.endsAt optional in proposed VS Code typings.
src/@types/vscode.proposed.chatParticipantPrivate.d.ts Adds proposed typings related to Voice Mode input and voice progress streaming.

Review details

  • Files reviewed: 8/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/view/reviewManager.ts
Comment on lines +646 to +652
let switchedToPullRequest: PullRequestModel | undefined;
if (this._switchedToPullRequest && this._switchedToPullRequestBranch && this._switchedToPullRequestBranch === branch.name) {
switchedToPullRequest = this._switchedToPullRequest;
} else {
this._switchedToPullRequest = undefined;
this._switchedToPullRequestBranch = undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github pull request icon keep disappearing from the vscode tool bar (left pane)

3 participants