Skip to content

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

Merged
alexr00 merged 5 commits into
mainfrom
copilot/fix-error-fetching-pr-merge-base
Jul 16, 2026
Merged

Don't surface merge-base enrichment failures as error popups#8769
alexr00 merged 5 commits into
mainfrom
copilot/fix-error-fetching-pr-merge-base

Conversation

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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

@alexr00 alexr00 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alexr00
alexr00 marked this pull request as ready for review July 16, 2026 09:16
Copilot AI review requested due to automatic review settings July 16, 2026 09:16

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.

Pull request overview

This PR reduces user-facing noise when best-effort PR enrichment fails, specifically avoiding intrusive error popups when computing a pull request’s merge base via the GitHub compare-commits API (which can legitimately 404 for some cross-fork/deleted-fork scenarios).

Changes:

  • Wraps the repos.compareCommits call in a dedicated try/catch, logging a warning and falling back to pullRequest.base.sha when merge-base computation fails.
  • Downgrades the outer method-level failure handling from vscode.window.showErrorMessage to Logger.error to keep enrichment failures non-intrusive.
Show a summary per file
File Description
src/github/folderRepositoryManager.ts Makes merge-base enrichment failure non-blocking and non-intrusive by logging and falling back instead of showing error popups.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Low

Copilot AI review requested due to automatic review settings July 16, 2026 09:25

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.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@alexr00
alexr00 merged commit f620787 into main Jul 16, 2026
8 checks passed
@alexr00
alexr00 deleted the copilot/fix-error-fetching-pr-merge-base branch July 16, 2026 09:33
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

4 participants