Skip to content

Prevent orphaned promises when resolving utility models#317100

Open
vritant24 wants to merge 6 commits into
mainfrom
dev/vritatnt24/orphanedPromise
Open

Prevent orphaned promises when resolving utility models#317100
vritant24 wants to merge 6 commits into
mainfrom
dev/vritatnt24/orphanedPromise

Conversation

@vritant24
Copy link
Copy Markdown
Member

No description provided.

vritant24 and others added 2 commits May 18, 2026 10:55
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>
Copilot AI review requested due to automatic review settings May 18, 2026 17:57
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.

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 Throttler and 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

Comment thread extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts Outdated
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's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/conversation/vscode-node/test/languageModelAccess.test.ts:341

  • firstRefresh is a Promise<void>, so a successful raceTimeout(firstRefresh, ...) also returns undefined. 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

vritant24 and others added 2 commits May 18, 2026 11:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@vritant24 vritant24 marked this pull request as ready for review May 18, 2026 21:01
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.

3 participants