Skip to content

Fix unhandled rejections from "upstream ref ... is not a GitHub repo"#8730

Merged
alexr00 merged 2 commits into
mainfrom
copilot/fix-vscode-hanging-issue
May 8, 2026
Merged

Fix unhandled rejections from "upstream ref ... is not a GitHub repo"#8730
alexr00 merged 2 commits into
mainfrom
copilot/fix-vscode-hanging-issue

Conversation

Copilot AI commented May 7, 2026

Copy link
Copy Markdown
Contributor

When a workspace's branch upstream points at a non-GitHub remote (e.g., a parent folder with a non-GitHub origin), getPullRequestDefaults() throws BadUpstreamError. Two callers fail to handle this, producing repeated unhandled promise rejections in the Debug Console — matching the screenshot in the issue and likely correlating with the reported VS Code unresponsiveness, since the chat context provider re-fires on many events.

Changes

  • src/lm/pullRequestContextProvider.tsWorkspaceContextProvider.provideWorkspaceChatContext awaited getPullRequestDefaults() per folder with no try/catch. Wrap it, skip the offending folder, and debug-log its URI. This is the first stack in the screenshot:

    at getOrigin → getPullRequestDefaults → provideWorkspaceChatContext
    
  • src/view/treeNodes/categoryNode.ts — The catch handler did e.response.status === 422, which throws TypeError for any error lacking .response (e.g. BadUpstreamError propagated from extractRepoFromQuery). Because the throw occurs inside the catch, it escapes as a second unhandled rejection (the getPullRequestsForQuery stack in the screenshot). Optional-chained the access:

    if (this.isCopilot && (e?.response?.status === 422) && e.message?.includes('the users do not exist')) {

Copilot AI changed the title [WIP] Fix sporadic VSCode hangs during extension development Fix unhandled rejections from "upstream ref ... is not a GitHub repo" May 7, 2026
Copilot finished work on behalf of alexr00 May 7, 2026 12:11
Copilot AI requested a review from alexr00 May 7, 2026 12:11
@alexr00 alexr00 marked this pull request as ready for review May 8, 2026 12:37
Copilot AI review requested due to automatic review settings May 8, 2026 12:37
@alexr00 alexr00 enabled auto-merge (squash) May 8, 2026 12:38

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 prevents repeated unhandled promise rejections when a workspace folder’s current branch upstream points to a non-GitHub remote, improving stability (especially for frequently re-triggered chat context collection).

Changes:

  • Guarded WorkspaceContextProvider.provideWorkspaceChatContext against getPullRequestDefaults() failures by catching and skipping problematic folders with a debug log.
  • Made the Copilot-specific error filter in CategoryTreeNode resilient to errors that don’t have an HTTP response object by optional-chaining the status/message access.
Show a summary per file
File Description
src/lm/pullRequestContextProvider.ts Catches failures from getPullRequestDefaults() to avoid unhandled rejections during workspace chat context generation.
src/view/treeNodes/categoryNode.ts Prevents a secondary exception inside a catch block by optional-chaining e.response.status (and message access).

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@alexr00 alexr00 merged commit 14b6c05 into main May 8, 2026
10 checks passed
@alexr00 alexr00 deleted the copilot/fix-vscode-hanging-issue branch May 8, 2026 14:19
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.

vscode hangs: "the upstream ref origin/master for branch master is not a github repo"

4 participants