Prevent the Active Pull Request view from disappearing - #8878
Open
Alex Ross (alexr00) with Copilot wants to merge 8 commits into
Open
Prevent the Active Pull Request view from disappearing#8878Alex Ross (alexr00) with Copilot wants to merge 8 commits into
Alex Ross (alexr00) with Copilot wants to merge 8 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
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
Alex Ross (alexr00)
approved these changes
Aug 7, 2026
Alex Ross (alexr00)
marked this pull request as ready for review
August 7, 2026 16:13
Alex Ross (alexr00)
enabled auto-merge (squash)
August 7, 2026 16:13
Contributor
There was a problem hiding this comment.
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.validateStateto (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.getPullRequestForBranchGraphQL 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 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Polling resilience
Regression coverage