Fix Agents model picker hiding custom endpoint BYOK models in session-targeted pools by Dengjun21 · Pull Request #343172 · microsoft/vscode · GitHub
Skip to content

Fix Agents model picker hiding custom endpoint BYOK models in session-targeted pools - #343172

Open
Dengjun21 wants to merge 2 commits into
microsoft:mainfrom
Dengjun21:fix/custom-endpoint-agent-picker
Open

Dengjun21 wants to merge 2 commits into
microsoft:mainfrom
Dengjun21:fix/custom-endpoint-agent-picker

Conversation

@Dengjun21

Copy link
Copy Markdown

Summary

When a chat session is scoped to a specific session type, the model picker was filtering to only models that explicitly target that session. This unintentionally dropped valid unscoped BYOK/custom-endpoint models from the Agents model list, even though they were still available in editor mode.

This made custom endpoint models appear unavailable in the WSL agent flow even though they were otherwise valid.

Fix

  • Keep session-targeted models as the preferred subset for a session
  • Preserve valid unscoped BYOK/custom-endpoint models in that same session pool
  • Keep the existing session-scoping rules in place for wrong-session models

This is a narrow fix in the model filtering layer and does not change broader provider or endpoint behavior.

Why this is safe

  • The fix only affects the session-scoped model picker
  • Session-targeted models still win when present
  • Wrong-session models remain filtered out
  • Unscoped BYOK/custom-endpoint models remain selectable when valid

Validation

  • Confirmed the model filter still prefers session-targeted models
  • Confirmed valid BYOK/custom-endpoint models remain visible in the Agents picker
  • Confirmed existing session isolation behavior remains intact

Screenshot
image

Session-scoped model filtering kept only models targeting the session type, which hid unscoped BYOK/custom-endpoint models from the Agents model picker even though they stayed selectable elsewhere.

Keep session-targeted models first, but also offer valid unscoped BYOK models, and treat them as valid for the session in isModelValidForSession. Mode and inline-chat capability filtering now applies to session-targeted models too.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 09:17
@Dengjun21

Copy link
Copy Markdown
Author

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Fixes session-scoped model filtering so unscoped BYOK/custom-endpoint models remain visible/selectable alongside session-targeted models, preventing them from disappearing in Agents flows (e.g., WSL) when a session type is enforced.

Changes:

  • Update session-scoped filtering to return session-targeted models first, then unscoped BYOK models that are selectable and compatible with the current mode/location.
  • Update session validity rules to treat unscoped BYOK models as valid when a session has targeted models.
  • Expand/enable tests to cover the new BYOK-in-session behavior and mode/location compatibility.
File Description
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​input/​chatInputModelUtils.ts Adjusts session-scoped filtering/validation to include unscoped BYOK models alongside session-scoped models.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​input/​chatInputModelUtils.test.ts Enables an existing test and adds coverage for unscoped BYOK models in session-scoped pools.

Review effort: Lite

@@ -37,10 +42,22 @@ export function filterModelsForSession(
location: ChatAgentLocation,
): ILanguageModelChatMetadataAndIdentifier[] {
if (sessionType && sessionType !== 'local' && hasModelsTargetingSession(models, sessionType)) {
Comment on lines +52 to 58
const byokScoped = models.filter(entry =>
!entry.metadata?.targetChatSessionType &&
isByokModel(entry.metadata) &&
entry.metadata?.isUserSelectable !== false &&
isModelSupportedForMode(entry, currentModeKind) &&
isModelSupportedForInlineChat(entry, location)
);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants