Skip to content

Fix offline BYOK state management#318187

Merged
dmitrivMS merged 2 commits into
mainfrom
dev/dmitriv/byok-state-management
May 25, 2026
Merged

Fix offline BYOK state management#318187
dmitrivMS merged 2 commits into
mainfrom
dev/dmitriv/byok-state-management

Conversation

@dmitrivMS
Copy link
Copy Markdown
Contributor

Fixes some scenarios where adding/removing BYOK models while signed out was not propagating state to the chat.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings May 25, 2026 05:09
@dmitrivMS dmitrivMS enabled auto-merge (squash) May 25, 2026 05:09
@dmitrivMS dmitrivMS self-assigned this May 25, 2026
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 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 HasByokModelsContribution to 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 $onChatModelsChange and wiring it to ILanguageModelsService.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

Comment thread src/vs/workbench/api/browser/mainThreadLanguageModels.ts
@dmitrivMS dmitrivMS merged commit 20ed2bc into main May 25, 2026
25 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/byok-state-management branch May 25, 2026 07:15
@vs-code-engineering vs-code-engineering Bot added this to the 1.123.0 milestone 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>
@dmitrivMS dmitrivMS added the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label May 27, 2026
@vs-code-engineering vs-code-engineering Bot added release-cherry-pick Automated cherry-pick between release and main branches and removed ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-byok release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants