Skip to content

Use provider ordering in chat model picker#307742

Open
kevin-m-kent wants to merge 4 commits intomicrosoft:mainfrom
kevin-m-kent:kevin-m-kent/model-picker-ordering
Open

Use provider ordering in chat model picker#307742
kevin-m-kent wants to merge 4 commits intomicrosoft:mainfrom
kevin-m-kent:kevin-m-kent/model-picker-ordering

Conversation

@kevin-m-kent
Copy link
Copy Markdown

Summary

  • add vendorPriority to the proposed chat provider model metadata and plumb it through the extension host
  • use vendorPriority when sorting promoted and other models in the chat model picker
  • keep top-level promotion manifest-driven so featured models still come from the existing models control manifest

Testing

  • built OSS dev locally with Copilot Chat from source and verified provider ordering in the picker while manifest-featured models stayed at the top level

kevin-m-kent and others added 3 commits April 3, 2026 17:39
Add vendorPriority field to the language model metadata API surface,
allowing extensions to specify a numeric priority for vendor-based
ordering in the chat model picker. When set, models are sorted by
vendorPriority before falling back to the existing alphabetical
vendor/name ordering.

This applies to the promoted section, other models section, and
flat view sort in chatModelPicker.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When models have vendorPriority set, they are automatically placed
in the promoted section of the picker (above Other Models) and sorted
by their priority value.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove vendorPriority-based auto-promotion so the picker relies on
VS Code's existing models control manifest for featured models,
while still using vendorPriority for ordering within promoted and
other model lists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 3, 2026 22:31
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 introduces a new vendorPriority metadata field for proposed chat language models and uses it to influence sorting in the chat model picker so providers/models can be ordered more intentionally.

Changes:

  • Added optional vendorPriority to the proposed LanguageModelChatInformation API and to internal model metadata.
  • Plumbed vendorPriority through the extension host model metadata mapping.
  • Updated chat model picker sorting to consider vendorPriority in promoted, grouped, and flat list scenarios.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatProvider.d.ts Adds the proposed vendorPriority field to the public API surface (proposal).
src/vs/workbench/contrib/chat/common/languageModels.ts Adds vendorPriority to internal model metadata interface.
src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.ts Uses vendorPriority in model sorting logic for promoted/other/flat lists.
src/vs/workbench/api/common/extHostLanguageModels.ts Plumbs vendorPriority from extension-provided model info into internal metadata.
product.json Adds an extensionsGallery configuration block (appears unrelated to PR goal).

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.ts:362

  • The promoted-items comparator only uses name as the final tie-breaker. If two promoted models share the same display name (common across vendors), the comparator can return 0 and leave ordering dependent on input order, which may vary and cause UI jitter. Consider adding vendor (and/or id/identifier) as additional tie-breakers so the sort defines a total, deterministic ordering.
					// Use vendorPriority if available
					const aVP = a.kind === 'available' ? a.model.metadata.vendorPriority : undefined;
					const bVP = b.kind === 'available' ? b.model.metadata.vendorPriority : undefined;
					if (aVP !== undefined || bVP !== undefined) {
						const aPrio = aVP ?? Number.MAX_SAFE_INTEGER;
						const bPrio = bVP ?? Number.MAX_SAFE_INTEGER;
						if (aPrio !== bPrio) {
							return aPrio - bPrio;
						}
					}
					const aName = a.kind === 'available' ? a.model.metadata.name : a.entry.label;
					const bName = b.kind === 'available' ? b.model.metadata.name : b.entry.label;
					return aName.localeCompare(bName);
  • Files reviewed: 4/5 changed files
  • Comments generated: 2

product.json Outdated
Comment on lines 159 to 164
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"itemUrl": "https://marketplace.visualstudio.com/items",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"controlUrl": ""
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This change adds an extensionsGallery configuration pointing at the public VS Marketplace for Code - OSS. That’s unrelated to the PR’s stated goal (chat model picker ordering) and can significantly change product behavior/distribution expectations. If this wasn’t intentional, please revert this hunk; if it was intentional, it should be split into a dedicated PR with rationale and any required follow-up changes.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Comment on lines +342 to +359
// Render promoted section: available first, then by vendor priority, then alphabetically by name
if (promotedItems.length > 0) {
promotedItems.sort((a, b) => {
const aAvail = a.kind === 'available' ? 0 : 1;
const bAvail = b.kind === 'available' ? 0 : 1;
if (aAvail !== bAvail) {
return aAvail - bAvail;
}
// Use vendorPriority if available
const aVP = a.kind === 'available' ? a.model.metadata.vendorPriority : undefined;
const bVP = b.kind === 'available' ? b.model.metadata.vendorPriority : undefined;
if (aVP !== undefined || bVP !== undefined) {
const aPrio = aVP ?? Number.MAX_SAFE_INTEGER;
const bPrio = bVP ?? Number.MAX_SAFE_INTEGER;
if (aPrio !== bPrio) {
return aPrio - bPrio;
}
}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

vendorPriority introduces new ordering behavior in the picker, but there doesn’t appear to be a test that asserts ordering when priorities are present (only the existing alphabetical behavior when priorities are undefined). Please add/extend model picker tests to cover at least: (1) promoted section ordering by priority, and (2) non-promoted ordering by priority with fallback behavior.

This issue also appears on line 350 of the same file.

Copilot uses AI. Check for mistakes.
Drop the accidental product.json change from the branch so the PR only
contains the model picker ordering work. The product.json override was
only needed for local OSS testing and should not ship in the PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants