Prevent orphaned promises when resolving utility models#317100
Open
vritant24 wants to merge 6 commits into
Open
Prevent orphaned promises when resolving utility models#317100vritant24 wants to merge 6 commits into
vritant24 wants to merge 6 commits into
Conversation
Coalesce background utility alias refreshes and bind them to the contribution lifecycle so stalled endpoint resolution cannot leave orphaned promises after disposal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover coalescing concurrent utility alias refreshes and cancelling pending refresh work on dispose, including cleanup for deliberately stalled test promises. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Copilot language model utility-alias refresh handling to avoid leaving test/background refresh promises pending after disposal.
Changes:
- Wraps utility override refreshes in a
Throttlerand cancellation-aware waits. - Adds/updates tests covering teardown and disposal cancellation behavior.
Show a summary per file
| File | Description |
|---|---|
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts |
Adds throttled, cancellation-aware utility alias override refresh logic. |
extensions/copilot/src/extension/conversation/vscode-node/test/languageModelAccess.test.ts |
Adds test coverage for cancelled/coalesced background refreshes and cleans up a stalled test promise. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
extensions/copilot/src/extension/conversation/vscode-node/test/languageModelAccess.test.ts:341
firstRefreshis aPromise<void>, so a successfulraceTimeout(firstRefresh, ...)also returnsundefined. This makes the success assertion fail even when cancellation worked; race a promise that resolves to an explicit truthy sentinel instead.
const settledFirstRefresh = await raceTimeout(firstRefresh, 2_000);
assert.ok(settledFirstRefresh, 'expected the superseded stalled refresh to resolve after cancellation');
- Files reviewed: 2/2 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
justschen
approved these changes
May 18, 2026
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.
No description provided.