Skip to content

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
mainfrom
copilot/fix-repeated-stack-eligibility-warning
Draft

Alex Ross (alexr00) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-repeated-stack-eligibility-warning

Conversation

Copilot AI commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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.

CreatePullRequestDataModel held one repositoryName, which is the compare (fork) repo's name. The stack check also used it as the base repo's name, so it looked up microsoft/microsoft-vscode. That lookup 404s. The missing repo is then cached as inaccessible, so every later check fails immediately and warns again.

Changes

  • CreatePullRequestDataModel
    • Adds baseRepositoryName, which fires a change event when it changes.
    • The new constructor parameter defaults to repositoryName, so callers that don't pass it keep their old behavior (e.g. pr.generateTitleAndDescription).
  • CreatePullRequestHelper: seeds baseRepositoryName from pullRequestDefaults.repo.
  • CreatePullRequestViewProvider
    • Keeps baseRepositoryName updated when the base is detected or picked:
      • onBaseBranchDetected now receives the full base RemoteInfo instead of just the owner;
      • the base path of processRemoteAndBranchResult sets it.
    • Uses baseRepositoryName for every stack eligibility check:
      • the model onDidChange handler;
      • setDefaultCompareBranch;
      • the compare path of processRemoteAndBranchResult.
    • The onDidChange handler also uses it to find the base remote it sends to the webview. A change to baseRepositoryName alone now triggers that lookup too.
// before
{ owner: this.model.baseOwner, repositoryName: this.model.repositoryName }
// after
{ owner: this.model.baseOwner, repositoryName: this.model.baseRepositoryName }

Tests

Four new tests in createPRViewProvider.test.ts set up a fork fork/test-fork of github/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 / getBaseGitHubRepo
  • getLabelOptions
  • the template repo: value
  • mergeQueueMethodForBranch
  • findIssueContext
  • the model's owner-only baseRemoteName lookup

@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 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
@alexr00
Alex Ross (alexr00) requested a balanced review from Copilot and removed request for Alex Ross (alexr00) December 4, 2026 16:03

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.

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
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 baseRepositoryName to the PR creation model and update base selection logic to keep it in sync.
  • Use baseRepositoryName (instead of the fork’s repositoryName) 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;
Comment thread src/github/createPRViewProvider.ts Outdated
}

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)!;
Comment thread src/github/createPRViewProvider.ts Outdated
}

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);
Comment thread src/github/createPRViewProvider.ts Outdated
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
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.

Repeated stack eligibility warning when creating PRs

3 participants