Skip to content

Make auto have provider affiniy#4072

Merged
lramos15 merged 3 commits intomainfrom
lramos15/level-bird
Feb 27, 2026
Merged

Make auto have provider affiniy#4072
lramos15 merged 3 commits intomainfrom
lramos15/level-bird

Conversation

@lramos15
Copy link
Member

Copilot AI review requested due to automatic review settings February 27, 2026 18:38
@lramos15 lramos15 enabled auto-merge February 27, 2026 18:38
@lramos15 lramos15 self-assigned this Feb 27, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 27, 2026
Copy link
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 pull request implements provider affinity for auto mode model selection to provide a more consistent user experience when auto mode tokens refresh. The PR adds a modelProvider field to the IChatEndpoint interface and updates all endpoint implementations to populate this field. The core logic change is in AutomodeService, which now prefers models from the same provider when refreshing tokens, falling back to the first available model only when no same-provider model is available.

Changes:

  • Added modelProvider field to IChatEndpoint interface to track the vendor/provider of each endpoint
  • Updated AutomodeService to implement provider affinity logic that prefers same-provider models during token refresh
  • Removed dependency on server-provided selected_model in favor of client-side model selection based on available models and provider affinity
  • Added comprehensive test coverage for provider affinity behavior including first mint, token refresh with affinity, fallback scenarios, and caching

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/platform/networking/common/networking.ts Added modelProvider field to IChatEndpoint interface
src/platform/endpoint/vscode-node/extChatEndpoint.ts Implemented modelProvider getter that returns languageModel.vendor
src/platform/endpoint/node/chatEndpoint.ts Added modelProvider property mapped from modelMetadata.vendor
src/platform/endpoint/node/automodeService.ts Core logic changes: removed selected_model dependency, added _findFirstAvailableModel and _findSameProviderModel helper methods, implemented provider affinity in both router and non-router code paths
src/platform/endpoint/node/autoChatEndpoint.ts Updated to pass modelProvider from wrapped endpoint to model metadata
src/platform/endpoint/common/endpointProvider.ts Added vendor field to IModelAPIResponse interface
src/platform/endpoint/test/node/*.ts Updated test endpoints to include vendor field in model information
src/platform/endpoint/node/proxy*.ts Updated proxy endpoints to include vendor field (set to model name or specific values like 'xtab')
src/platform/endpoint/node/test/automodeService.spec.ts Added comprehensive tests for provider affinity behavior, removed selected_model from mock responses, added afterEach hook for timer cleanup
src/platform/endpoint/node/test/copilotChatEndpoint.spec.ts Added vendor field to test model metadata fixtures
src/extension/test/vscode-node/endpoints.test.ts Added vendor field to fake model metadata
src/extension/test/node/notebookPromptRendering.spec.ts Added modelProvider field to mock endpoint
src/extension/prompt/vscode-node/endpointProviderImpl.ts Added vendor field to overridden chat model metadata
src/extension/externalAgents/node/oaiLanguageModelServer.ts Added modelProvider getter to StreamingPassThroughEndpoint
src/extension/conversation/vscode-node/remoteAgents.ts Added vendor field when creating remote agent endpoints
src/extension/byok/node/test/*.spec.ts Added vendor field to test model metadata
src/extension/byok/common/byokProvider.ts Added vendor field mapped from providerName in resolveModelInfo
src/extension/agents/claude/node/claudeLanguageModelServer.ts Added modelProvider getter to ClaudeStreamingPassThroughEndpoint
src/extension/xtab/node/*.ts Added vendor field set to 'xtab' for xtab endpoints
Comments suppressed due to low confidence (1)

src/platform/endpoint/node/test/automodeService.spec.ts:343

  • The call to vi.useRealTimers() at line 343 is redundant because there's already an afterEach hook at line 87 that calls vi.useRealTimers() after every test. This duplicate call should be removed to avoid confusion and maintain consistency with the testing pattern.
			vi.useRealTimers();

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@lramos15 lramos15 modified the milestones: February 2026, March 2026 Feb 27, 2026
@lramos15 lramos15 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit dbe242d Feb 27, 2026
19 checks passed
@lramos15 lramos15 deleted the lramos15/level-bird branch February 27, 2026 19:16
mexicodxnmexico-create added a commit to mexicodxnmexico-create/vscode-copilot-chat that referenced this pull request Feb 28, 2026
* Revert "cli - do not trust empty changes (microsoft/vscode#297975) (microsoft#4036)" (microsoft#4063)

This reverts commit 420c26f.

* Run command tool should include command result (microsoft#4061)

* Run command tool should include command result
Part of microsoft/vscode#298181

* CCR feedback

* Support CAPI WebSocket connections (microsoft#4068) (microsoft#4069)

* Add a maximum date of the comparison commit for the 1p repo telemetry info (microsoft#3774)

* initial passes with copilot before testing

* only pass on successful date

* add tests for new functionality

* return tooOld for all date failures

* remove extra logging, info is already in telemetry and may be too noisy

* fix test that used custom repo mock

---------

Co-authored-by: Ian Huff <ianhuff@Mac.home>
Co-authored-by: Ian Huff <ianhuff@Ians-MacBook-Pro-2.local>

* 0.39.0 (microsoft#4057)

* Make auto have provider affiniy (microsoft#4072)

* Pipe vendor from CAPI through to chat endpoint

* Adopt discussed auto mode behavior

* Update src/platform/endpoint/node/test/automodeService.spec.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Hold external repo info telemetry (microsoft#4075)

* Hold external repo info telemetry

* Update src/extension/prompt/node/repoInfoTelemetry.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test to reflect no external telemetry for non-internal users

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* pass in the URL for the proxy to the CLI session (microsoft#4070)

* Update telemetry pkg (microsoft#4078)

* Merge agents and chatsession folder (microsoft#4058)

* Remove duplicated memory tool in picker (microsoft#4079)

* fixes microsoft/vscode#297010

* address feedback

* 🎨 Palette: Add aria-busy state to webview loading container

💡 What: Toggles `aria-busy` attribute on the `solutionsContainer` during async loading phases.
🎯 Why: To prevent screen reader users from experiencing silent, disorienting DOM changes when dynamic webview content updates.
♿ Accessibility: Improves loading state communication to assistive technologies.

Co-authored-by: mexicodxnmexico-create <245638303+mexicodxnmexico-create@users.noreply.github.com>

* Background - clean worktree changes cache at the end of the turn (microsoft#4083)

* 🎨 Palette: Add aria-busy state to webview loading container

💡 What: Toggles `aria-busy` attribute on the `solutionsContainer` during async loading phases.
🎯 Why: To prevent screen reader users from experiencing silent, disorienting DOM changes when dynamic webview content updates.
♿ Accessibility: Improves loading state communication to assistive technologies.

Co-authored-by: mexicodxnmexico-create <245638303+mexicodxnmexico-create@users.noreply.github.com>

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
Co-authored-by: Alex Ross <38270282+alexr00@users.noreply.github.com>
Co-authored-by: Christof Marti <chrmarti@microsoft.com>
Co-authored-by: Ian Huff <ian.huff@gmail.com>
Co-authored-by: Ian Huff <ianhuff@Mac.home>
Co-authored-by: Ian Huff <ianhuff@Ians-MacBook-Pro-2.local>
Co-authored-by: Ben Villalobos <bevillal@microsoft.com>
Co-authored-by: Logan Ramos <loganramos@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Zhichao Li <57812115+zhichli@users.noreply.github.com>
Co-authored-by: Aaron Munger <2019016+amunger@users.noreply.github.com>
Co-authored-by: Vijay Upadya <41652029+vijayupadya@users.noreply.github.com>
Co-authored-by: Don Jayamanne <don.jayamanne@outlook.com>
Co-authored-by: SteVen Batten <sbatten@microsoft.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: mexicodxnmexico-create <245638303+mexicodxnmexico-create@users.noreply.github.com>
Co-authored-by: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com>
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