Fix offline BYOK state management#318187
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes offline BYOK state propagation in the chat workbench by making github.copilot.hasByokModels rely on configured BYOK provider groups after extensions are registered (to avoid stale “user selectable” signals), while still supporting an optimistic pre-registration signal for startup. It also adds an extension-host notification path so extensions can observe chat model availability changes via vscode.lm.onDidChangeChatModels.
Changes:
- Update
HasByokModelsContributionto treat configured non-Copilot provider groups as authoritative post-extension registration, ignoring potentially stale context-key signals. - Add workbench → extension host bridging for chat model changes by introducing
$onChatModelsChangeand wiring it toILanguageModelsService.onDidChangeLanguageModels. - Expand/adjust unit tests to cover new BYOK state behavior (optimistic pre-registration updates and stale-signal suppression post-registration).
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/hasByokModelsContribution.test.ts | Adds test coverage for new BYOK state rules (configured groups vs. pre-scan signal, stale signal handling). |
| src/vs/workbench/contrib/chat/browser/hasByokModelsContribution.ts | Updates BYOK context-key computation strategy and introduces product-quality fallback for early config reads. |
| src/vs/workbench/api/common/extHostLanguageModels.ts | Implements $onChatModelsChange to fire the extension-host change event for vscode.lm.onDidChangeChatModels. |
| src/vs/workbench/api/common/extHost.protocol.ts | Extends the ext host protocol contract with $onChatModelsChange. |
| src/vs/workbench/api/browser/mainThreadLanguageModels.ts | Wires ILanguageModelsService.onDidChangeLanguageModels to $onChatModelsChange for extensions. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
vijayupadya
approved these changes
May 25, 2026
dileepyavan
pushed a commit
that referenced
this pull request
May 27, 2026
* Fix offline BYOK state management Co-authored-by: Copilot <copilot@github.com> * PR feedback --------- Co-authored-by: Copilot <copilot@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 some scenarios where adding/removing BYOK models while signed out was not propagating state to the chat.