Skip to content

[WIP] Fix: avoid re-entrancy deadlock in _resolveUtilityOverride for non-copilot vendors#316795

Draft
rwoll wants to merge 2 commits into
mainfrom
rwoll/registry-override-reentrant
Draft

[WIP] Fix: avoid re-entrancy deadlock in _resolveUtilityOverride for non-copilot vendors#316795
rwoll wants to merge 2 commits into
mainfrom
rwoll/registry-override-reentrant

Conversation

@rwoll
Copy link
Copy Markdown
Member

@rwoll rwoll commented May 16, 2026

Fixes the deadlock described in https://github.com/microsoft/vscode-copilot-evaluation/issues/3904#issuecomment-4468003704

#316534 added utility alias override settings (chat.utilityModel / chat.utilitySmallModel). When the override points to a non-copilot vendor (e.g. azure/gpt-5), _resolveUtilityOverride calls lm.selectChatModels which re-enters the language model service while the copilot provider's sequencer slot is still held. The non-copilot vendor's response can never be delivered back, deadlocking selectChatModels indefinitely.

The fix adds a duringProviderResolution flag that skips the lm.selectChatModels path during alias publishing. Non-copilot overrides are instead resolved lazily on first use via the normal getChatEndpoint path, when the copilot provider is no longer holding the sequencer.

…pilot vendors

When _registerUtilityAliasModels runs inside provideLanguageModelChatInfo
(the copilot LM provider callback), calling lm.selectChatModels for a
non-copilot vendor re-enters the language model service. The copilot
vendor's sequencer slot is still held, and the dispatcher on the main
thread is blocked waiting for copilot to finish, so the non-copilot
vendor's response can never be delivered back. This deadlocks
selectChatModels indefinitely.

The fix: add a duringProviderResolution flag that skips the
lm.selectChatModels path during alias publishing. Non-copilot overrides
are instead resolved lazily on first use (via the normal getChatEndpoint
path), when the copilot provider is no longer holding the sequencer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 16, 2026 20:34
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 attempts to avoid a language model service re-entrancy deadlock when publishing Copilot utility alias models whose override points to a non-Copilot provider.

Changes:

  • Adds getChatEndpointDuringProviderResolution to IEndpointProvider.
  • Routes utility alias registration through the new provider-resolution-safe endpoint path.
  • Skips lm.selectChatModels for non-Copilot overrides during provider resolution.
Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/common/endpointProvider.ts Adds the new endpoint provider API for provider-resolution-safe utility endpoint lookup.
extensions/copilot/src/extension/prompt/vscode-node/endpointProviderImpl.ts Implements the new lookup path and defers non-Copilot override resolution during provider callbacks.
extensions/copilot/src/extension/conversation/vscode-node/languageModelAccess.ts Uses the provider-resolution-safe lookup when publishing utility alias models.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread extensions/copilot/src/platform/endpoint/common/endpointProvider.ts
…n use, add tests

Co-authored-by: rwoll <11915034+rwoll@users.noreply.github.com>
Copilot finished work on behalf of rwoll May 16, 2026 20:54
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.

4 participants