Skip to content

fix: handle abort() promise rejection in CopilotCLISession (fixes #316429)#316435

Open
vs-code-engineering[bot] wants to merge 1 commit into
mainfrom
fix/copilot-abort-unhandled-rejection-316429-74372bee986dd426
Open

fix: handle abort() promise rejection in CopilotCLISession (fixes #316429)#316435
vs-code-engineering[bot] wants to merge 1 commit into
mainfrom
fix/copilot-abort-unhandled-rejection-316429-74372bee986dd426

Conversation

@vs-code-engineering
Copy link
Copy Markdown
Contributor

Summary

The Session.abort() method from @github/copilot/sdk returns a Promise<void> that can reject with an AbortError. All four call sites in CopilotCLISession discarded this promise without handling potential rejections, causing the AbortError to surface as an unhandled rejection in error telemetry. The error spiked 18x in extension version 0.48.0 (2 → 36 users).

Fixes #316429
Recommended reviewer: @DonJayamanne

Culprit Commit

No single culprit commit — the unhandled abort() promise is a pre-existing pattern. The spike in v0.48.0 correlates with increased usage or SDK changes in the @github/copilot npm update.

Code Flow

sequenceDiagram
    participant User as User (cancel)
    participant Session as CopilotCLISession
    participant SDK as Session.abort()
    User->>Session: Cancel request
    Session->>SDK: abort() returns Promise
    Note over SDK: Promise rejects with AbortError
    Note over Session: Promise not caught - unhandled rejection
Loading

Affected Files

File Role Evidence
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts root cause L932, L934, L1051, L1057: abort() called without handling returned Promise

How the Fix Works

Added .catch() to all four abort() call sites. The AbortError is expected from intentional cancellation — the bug is the unhandled promise, not the error itself.

Generated by errors-fix · ● 113.5M ·

…6429)

Session.abort() returns a Promise<void> that can reject with AbortError.
All four call sites discarded this promise, causing unhandled rejections
that surfaced in error telemetry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 15:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@vs-code-engineering vs-code-engineering Bot marked this pull request as ready for review May 14, 2026 15:50
@vs-code-engineering vs-code-engineering Bot enabled auto-merge (squash) May 14, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] [Error] [GitHub.copilot-chat] unhandlederror-This operation was aborted

2 participants