Repository navigation
Check stack eligibility in the base repository when the fork has a different name - #9149
Draft
Alex Ross (alexr00) with Copilot wants to merge 3 commits into
Draft
Alex Ross (alexr00) with Copilot wants to merge 3 commits into
Alex Ross (alexr00) with Copilot wants to merge 3 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: alexr00 <[email protected]>
Copilot
AI
changed the title
[WIP] Fix repeated stack eligibility warning when creating PRs
Check stack eligibility in the base repository when the fork has a different name
Nov 2, 2026
Alex Ross (alexr00)
requested
a balanced review from Copilot
and removed request for
Alex Ross (alexr00)
December 4, 2026 16:03
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
8 open issues
TheonDidChangehandler updatesbaseBranchonly whenbaseOwnerorbaseRepositoryName… · NewalwaysCalledWithExactlymakes these tests brittle if the implementation starts doing additional… · NewrepositoryNameis now ambiguous next tobaseRepositoryName(it effectively represents the… · New The PR description’s Not addressed section listsgetBaseRemote/getBaseGitHubRepo,… · New The PR description’s Not addressed section listsgetBaseRemote/getBaseGitHubRepo,… · New The PR description’s Not addressed section listsgetBaseRemote/getBaseGitHubRepo,… · New The PR description’s Not addressed section listsgetBaseRemote/getBaseGitHubRepo,… · New The PR description’s Not addressed section listsgetBaseRemote/getBaseGitHubRepo,… · New
What changed in this PR
Fixes incorrect stack-eligibility lookups when creating PRs from forks whose repository name differs from the base repository by tracking the base repository name separately from the compare repository name.
Changes:
- Add
baseRepositoryNameto the PR creation model and update base selection logic to keep it in sync. - Use
baseRepositoryName(instead of the fork’srepositoryName) for stack eligibility checks and related base-repo lookups. - Add tests covering stack eligibility checks across multiple paths when base/compare repo names differ.
| File | Description |
|---|---|
| src/view/createPullRequestHelper.ts | Seeds the model with the base repository name from defaults. |
| src/view/createPullRequestDataModel.ts | Introduces baseRepositoryName and atomic base updates via setBase. |
| src/github/createPRViewProvider.ts | Switches stack checks and base lookups to use baseRepositoryName; updates base-detection wiring. |
| src/commands.ts | Passes the base repo name into the model constructor. |
| src/test/github/createPRViewProvider.test.ts | Adds regression tests for forks with differing base/compare repo names. |
Review effort: Lite
Comment on lines
+694
to
698
| if (e.baseOwner || e.baseRepositoryName) { | ||
| const gitHubRemote = this._folderRepositoryManager.findRepo(repo => compareIgnoreCase(repo.remote.owner, this.model.baseOwner) === 0 && compareIgnoreCase(repo.remote.repositoryName, this.model.baseRepositoryName) === 0)?.remote; | ||
| baseRemote = gitHubRemote ? serializeRemoteInfo(gitHubRemote) : undefined; | ||
| baseBranch = this.model.baseBranch; | ||
| } |
| it('checks stack eligibility in the base repository when the repository changes while creating', async function () { | ||
| const getCandidate = sinon.stub(baseRepository, 'getStackCandidate').resolves(candidate); | ||
| const posted = nextPost(); | ||
|
|
Comment on lines
+47
to
+50
| constructor(private readonly folderRepositoryManager: FolderRepositoryManager, baseOwner: string, baseBranch: string, compareOwner: string, compareBranch: string, public readonly repositoryName: string, baseRepositoryName: string = repositoryName) { | ||
| super(); | ||
| this._baseOwner = baseOwner; | ||
| this._baseRepositoryName = baseRepositoryName; |
| } | ||
|
|
||
| private async getBaseRemote(): Promise<GitHubRemote> { | ||
| return (await this._folderRepositoryManager.getGitHubRemotes()).find(remote => compareIgnoreCase(remote.owner, this.model.baseOwner) === 0 && compareIgnoreCase(remote.repositoryName, this.model.repositoryName) === 0)!; |
| } | ||
|
|
||
| private getBaseGitHubRepo(): GitHubRepository | undefined { | ||
| return this._folderRepositoryManager.gitHubRepositories.find(repo => compareIgnoreCase(repo.remote.owner, this.model.baseOwner) === 0 && compareIgnoreCase(repo.remote.repositoryName, this.model.repositoryName) === 0); |
| let newLabels: DisplayLabel[] = []; | ||
|
|
||
| const labelsToAdd = await vscode.window.showQuickPick<vscode.QuickPickItem & { name: string }>( | ||
| getLabelOptions(this._folderRepositoryManager, this.labels, this.model.baseOwner, this.model.repositoryName).then(options => { |
| }, user?.login); | ||
| } | ||
|
|
||
| private async lookupTemplateValue<T>(name: string, lookup: () => Promise<T>): Promise<T | undefined> { |
| this.getMergeConfiguration(result.remote.owner, result.remote.repositoryName), | ||
| this.getTitleAndDescription(compareBranch, this.model.baseBranch), | ||
| this._folderRepositoryManager.mergeQueueMethodForBranch(this.model.baseBranch, this.model.baseOwner, this.model.repositoryName)]); | ||
| let autoMergeDefault = false; |
Copilot stopped reviewing on behalf of
Alex Ross (alexr00) due to an error
December 4, 2026 16:24
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.



Creating a PR from a fork whose name differs from the base repo (e.g.
me/microsoft-vscode→microsoft/vscode) shows "Unable to check pull request stack eligibility: Unable to find the selected base repository." on every PR.CreatePullRequestDataModelheld onerepositoryName, which is the compare (fork) repo's name. The stack check also used it as the base repo's name, so it looked upmicrosoft/microsoft-vscode. That lookup 404s. The missing repo is then cached as inaccessible, so every later check fails immediately and warns again.Changes
CreatePullRequestDataModelbaseRepositoryName, which fires a change event when it changes.repositoryName, so callers that don't pass it keep their old behavior (e.g.pr.generateTitleAndDescription).CreatePullRequestHelper: seedsbaseRepositoryNamefrompullRequestDefaults.repo.CreatePullRequestViewProviderbaseRepositoryNameupdated when the base is detected or picked:onBaseBranchDetectednow receives the full baseRemoteInfoinstead of just the owner;processRemoteAndBranchResultsets it.baseRepositoryNamefor every stack eligibility check:onDidChangehandler;setDefaultCompareBranch;processRemoteAndBranchResult.onDidChangehandler also uses it to find the base remote it sends to the webview. A change tobaseRepositoryNamealone now triggers that lookup too.Tests
Four new tests in
createPRViewProvider.test.tsset up a forkfork/test-forkofgithub/test. Each covers one path that checks stacks and asserts that the lookup targets the base repo and no warning is shown.Not addressed
These spots still look up the base repo by the fork's name or owner. They don't cause this warning, so they are left for a follow-up:
getBaseRemote/getBaseGitHubRepogetLabelOptionsrepo:valuemergeQueueMethodForBranchfindIssueContextbaseRemoteNamelookup