Fix sorting of duplicate git configs#8764
Open
Copilot wants to merge 5 commits into
Open
Conversation
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 issue with PRs not shown in panel for manually-created worktree
Fix wrong PR matched for worktree branches with cross-branch upstream
Jun 1, 2026
alexr00
approved these changes
Jun 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses incorrect pull request association in certain Git configurations by improving how branch→PR metadata is selected when duplicate git config entries exist, and adds/updates tests and vendored proposed VS Code API typings.
Changes:
- Fix
getMatchingPullRequestMetadataForBranchto prefer the most recent PR association when multiple metadata entries exist for the same branch. - Add a unit test covering the duplicate-config-entry scenario.
- Update proposed VS Code chat API
.d.tsfiles (new properties/interfaces).
Show a summary per file
| File | Description |
|---|---|
| src/github/pullRequestGitHelper.ts | Updates selection logic for branch-associated PR metadata when duplicate config entries exist. |
| src/test/github/pullRequestGitHelper.test.ts | Adds a unit test ensuring the highest PR number is preferred when duplicates exist. |
| src/@types/vscode.proposed.chatSessionsProvider.d.ts | Adds new proposed chat session option fields/interfaces. |
| src/@types/vscode.proposed.chatParticipantPrivate.d.ts | Adds proposed quota snapshot types and a chat.updateQuotas API surface. |
Copilot's findings
- Files reviewed: 2/4 changed files
- Comments generated: 1
amunger
requested changes
Jun 3, 2026
| /** | ||
| * A snapshot of quota usage for a single category (chat, completions, premium chat). | ||
| */ | ||
| export interface ChatQuotaSnapshot { |
There was a problem hiding this comment.
are these API changes supposed to be here?
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.
PRs disappear from the panel when the workspace folder is a manually-created git worktree (e.g.
git worktree add -b feature-foo <path> origin/develop). Repo discovery is actually fine — VS Code's git extension follows the.gitpointer →commondirchain correctly — but two bugs in PR matching cause the active PR to resolve to the wrong (closed) PR and clear the panel.getUpstreamUrlAndNameuses upstream name as PR head refgit worktree add -b feature-foo <path> origin/developsets:So
branch.upstream.name === "develop", and the extension was querying GitHub withheadRefName: "develop"— matching an unrelated closed PR rather than the open PR forfeature-foo. The fix prefers the local branch name when it differs from the tracked upstream, since that is whatgit pushuses by default and what GitHub'sheadRefNamewill be:getMatchingPullRequestMetadataForBranchsort orderThe duplicate-entry handling added in #8063 used
(a, b) => b.value < a.value ? 1 : -1, which sorts ascending, so it always returned the oldest PR association instead of the most recent. Lexicographic comparison ofowner#name#5vsowner#name#42is also wrong across digit counts. Now parses the trailing PR number and sorts numerically descending.Other
pullRequestGitHelper.test.tscovering the duplicate-config-entry case.vscode.proposed.chatSessionsProvider.d.tswith hyphens to unblock thehygienepre-commit hook.