fix: handle abort() promise rejection in CopilotCLISession (fixes #316429)#316435
Open
vs-code-engineering[bot] wants to merge 1 commit into
Open
fix: handle abort() promise rejection in CopilotCLISession (fixes #316429)#316435vs-code-engineering[bot] wants to merge 1 commit into
vs-code-engineering[bot] wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Session.abort()method from@github/copilot/sdkreturns aPromise<void>that can reject with anAbortError. All four call sites inCopilotCLISessiondiscarded this promise without handling potential rejections, causing theAbortErrorto 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:
@DonJayamanneCulprit 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/copilotnpm 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 rejectionAffected Files
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.tsabort()called without handling returned PromiseHow the Fix Works
Added
.catch()to all fourabort()call sites. The AbortError is expected from intentional cancellation — the bug is the unhandled promise, not the error itself.