[WIP] Fix: avoid re-entrancy deadlock in _resolveUtilityOverride for non-copilot vendors#316795
Draft
rwoll wants to merge 2 commits into
Draft
[WIP] Fix: avoid re-entrancy deadlock in _resolveUtilityOverride for non-copilot vendors#316795rwoll wants to merge 2 commits into
rwoll wants to merge 2 commits into
Conversation
…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>
Contributor
There was a problem hiding this comment.
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
getChatEndpointDuringProviderResolutiontoIEndpointProvider. - Routes utility alias registration through the new provider-resolution-safe endpoint path.
- Skips
lm.selectChatModelsfor 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
…n use, add tests Co-authored-by: rwoll <11915034+rwoll@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.
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),_resolveUtilityOverridecallslm.selectChatModelswhich 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, deadlockingselectChatModelsindefinitely.The fix adds a
duringProviderResolutionflag that skips thelm.selectChatModelspath during alias publishing. Non-copilot overrides are instead resolved lazily on first use via the normalgetChatEndpointpath, when the copilot provider is no longer holding the sequencer.