Repository navigation
Model router: display name, context size, and a quieter routing line - #347474
Merged
Bhavya U (bhavyaus) merged 4 commits intoNov 10, 2026
Merged
Conversation
A model router file can now set `display-name`, which the model picker and the chat's routing line show in place of the file name. Router notices use the same label. A route, or the whole router, can set `context-size: default | long`. `long` runs a model on its larger context window when it offers one, and a chat that is on a long window keeps one. The routing line shows the size the router asked for, such as "1M". The check tool lists each model's context sizes and whether the larger one is billed at a higher rate. A router with `switching: first-turn` routes only a chat's first turn. Later turns no longer show a "stayed on" line, or a "picking a model" line while the turn starts. Co-authored-by: Copilot <[email protected]>
… pending routing row A chat that a router put on a long context window now keeps it when another router picks the next model, and after a turn on a model that has only one context size. The window is read from the chat's routed turns instead of from the latest pick alone; a model the user picks by hand still resets it. A "picking a model" row that is already showing now settles when a first-turn router keeps the chat's pick. Before, the kept pick was dropped and the row stayed until the response ended, which happened for chats whose last pick predates the first-turn-only flag or whose router was changed to `switching: first-turn`. Co-authored-by: Copilot <[email protected]>
Michael Lively (Yoyokrazy)
previously approved these changes
Nov 10, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved routing and pricing defects can hide fresh model-selection progress, unexpectedly shrink chat context windows, and misreport cheaper long-context pricing as more expensive.
3 open issues
What changed in this PR
Extends experimental YAML model routers for Agent Host Copilot chats with clearer names, context-window controls, and quieter routing feedback.
Changes:
- Adds
display-nameand router-level or per-routecontext-sizeoptions. - Carries context choices through routing history and displays requested sizes in chat.
- Suppresses repeated first-turn routing rows and adds parser, routing, tool, and accessibility coverage.
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts |
Tests settled first-turn router detection. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts |
Tests pending-row settlement for retained picks. |
src/vs/workbench/contrib/chat/test/browser/accessibility/chatResponseAccessibleView.test.ts |
Tests accessible context-size descriptions. |
src/vs/workbench/contrib/chat/common/chatService/chatService.ts |
Adds context size to routing UI data. |
src/vs/workbench/contrib/chat/common/chatAutoModeExplainability.ts |
Formats context sizes in routing text. |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAutoModeResolutionContentPart.ts |
Detects context-size changes when rendering. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts |
Adds settled-pick detection and pending-row support. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts |
Applies labels, context sizes, and routing-row suppression. |
src/vs/platform/agentHost/test/node/copilotModelRouterTools.test.ts |
Tests context-size and pricing output. |
src/vs/platform/agentHost/test/node/copilotModelRouter.test.ts |
Tests display names and long-window continuity. |
src/vs/platform/agentHost/test/common/modelRouter.test.ts |
Tests new YAML fields and context-size validation. |
src/vs/platform/agentHost/node/copilot/copilotModelRouterTools.ts |
Reports context choices and long-context pricing indicators. |
src/vs/platform/agentHost/node/copilot/copilotModelRouter.ts |
Applies context choices and records routing metadata. |
src/vs/platform/agentHost/node/copilot/copilotBuiltinSkills.ts |
Documents the new router options. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Uses router display names in the model picker. |
src/vs/platform/agentHost/common/state/sessionState.ts |
Extends routing metadata with labels and context choices. |
src/vs/platform/agentHost/common/modelRouter.ts |
Parses and resolves display names and context sizes. |
src/vs/platform/agentHost/common/meta/vscode/agentUsageMeta.ts |
Validates and reads the new routing metadata. |
Review effort: Balanced
…e routing row A chat counts as being on a long context window when its model ran on the larger window by default, not only when a route asked for it. The routed info now records that the turn ran on the larger window, separately from the size the router asked for, so a later route with `context-size: default` no longer shrinks such a chat. A route that sets no size on a model that already defaults to the larger window is left without an explicit size. The check tool reports `longContextCostsMore` only when a long-context price is higher than its standard one. Long-context prices are published whenever they differ, including when they are lower. The "picking a model" row is no longer hidden after the user picked a model by hand, or selected another router, since the router's pick. The host routes afresh in those cases, and the client now follows the same rule. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 10, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
After a host restart, a turn sent while the router file is invalid can be mistaken for a manual model choice, causing the next route to shrink a previously selected long context window.
1 open issue
3 resolved since last review
Review effort: Balanced
Bhavya U (bhavyaus)
enabled auto-merge (squash)
November 10, 2026 22:58
Bhavya U (bhavyaus)
deleted the
bhavyaus/model-router-display-name-context-size
branch
November 10, 2026 22:59
Bhavya U (bhavyaus)
added a commit
that referenced
this pull request
Nov 11, 2026
…routed turn (#347522) * Model router: keep a long context window across a restart after an unrouted turn A turn sent on a model router that makes no pick (an invalid or missing file, no available models, a failed routing call) runs on the chat's current model. While the host is running, the turn's selection is still the router, so the chat's long context window and the router's last pick both hold. After a host restart the provider restores the turn with the model it ran on as its selection, which read as a model the user picked by hand: the next routed turn could shrink the window and route afresh. The turn's usage now records the router it asked for, the same way a routed turn's usage records the pick, so it is saved with the turn and restored with it. Reading a chat's long window and its last pick treats such a turn as a router turn. Follow-up to a review comment on #347474. Co-authored-by: Copilot <[email protected]> * Model router: read an unrouted restored turn's router in the chat too The chat decides whether a first-turn router's pick is settled the way the host does. After a restart, a turn that asked for the router and got no pick has the model it ran on as its selection, so the chat read it as a model picked by hand and could show a "picking a model" row and a "stayed on" line for a router that was not picking again. It now reads the router from the turn's usage, as the host does. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
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.

Additions to model routers (
.model-router.yaml, behindchat.copilot.modelRouter.enabled).Changes
display-name. A router file can set the name the model picker shows in place of its file name. The chat's routing line and the router's notices use the same name.context-size: default | long. A route, or the whole router, can ask for a model's larger context window. It applies only to models that offer two sizes; a route that asks forlongon a model with one size gets a warning fromcheck_model_routerand is left alone. The routing line shows the size the router asked for, such as "1M". The check tool lists each model's context sizes and whether the larger one is billed at a higher rate.switching: first-turnrouter. Such a router routes only the first turn, so later turns no longer show a "stayed on" line, or a "picking a model" row while the turn starts. Routers withswitching: autoare unchanged.How to test
chat.copilot.modelRouter.enabledand add a router under~/.agents/model-routers/withdisplay-name: My Router, andcontext-size: longon a route whose model offers two context sizes.