Skip to content

Don't surface merge-base enrichment failures as error popups#8769

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-error-fetching-pr-merge-base
Draft

Don't surface merge-base enrichment failures as error popups#8769
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-error-fetching-pr-merge-base

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

Opening certain PRs (notably cross-fork PRs with divergent histories, or where a fork has been deleted) shows an intrusive popup even though the underlying data is non-fatal enrichment:

Fetching Pull Request merge base failed: Not Found - https://docs.github.com/rest/commits/commits#compare-two-commits

FolderRepositoryManager.fulfillPullRequestMissingInfo calls repos.compareCommits purely to populate pullRequest.mergeBase. A 404 from that endpoint is a legitimate outcome for some cross-repo PRs, but the previous catch block surfaced it via vscode.window.showErrorMessage.

Changes (src/github/folderRepositoryManager.ts)

  • Isolate the compareCommits failure. Wrap just that call in its own try/catch, log via Logger.warn, and fall back to pullRequest.base.sha for mergeBase — the same fallback already used in pullRequestModel.getFileChangesInfo and the Server Error branch of compareCommits in loggingOctokit.ts.
  • Downgrade the outer catch from showErrorMessage to Logger.error. The whole method is best-effort enrichment; failures shouldn't block or distract from the PR view.
if (!pullRequest.mergeBase) {
    try {
        const { data } = await octokit.call(octokit.api.repos.compareCommits, { /* ... */ });
        pullRequest.mergeBase = data.merge_base_commit.sha;
    } catch (e) {
        Logger.warn(`Fetching Pull Request merge base failed: ${formatError(e)}`, this.id);
        pullRequest.mergeBase = pullRequest.base.sha;
    }
}

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error fetching pull request merge base Don't surface merge-base enrichment failures as error popups Jun 3, 2026
Copilot AI requested a review from alexr00 June 3, 2026 14:20
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.

Error commits#compare-two-commits not found during PR view

2 participants