Improve turn details for Auto model in the context of free accounts#323220
Draft
dmitrivMS wants to merge 2 commits into
Draft
Improve turn details for Auto model in the context of free accounts#323220dmitrivMS wants to merge 2 commits into
dmitrivMS wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves how agent-host session turns render response “details” when the synthetic Auto model was selected but the concrete per-turn model id cannot be resolved to a registered model (common for free/student accounts). This makes the UI show Auto (<resolved-model-id>) rather than losing the model details.
Changes:
- Added
formatTurnResponseDetails()(and supporting helpers/types) to format the response footer asModelName+ either credits or pricing, including expandingAutotoAuto (<turn model id>)when applicable. - Refactored
AgentHostSessionHandlerto use the shared formatter forTurnModelLookup.toResponseDetails. - Added unit tests covering Auto-expansion, pricing/credits formatting, and unknown-model behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Adds shared formatting helpers for turn response details and the Auto model id constant. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Switches turn response footer formatting to the shared helper. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.ts | Reuses the Auto model id constant when computing Auto-specific UI metadata. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Adds unit tests for the new response-details formatter. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Low
connor4312
reviewed
Jun 26, 2026
Comment on lines
+169
to
+211
| /** The agent host's synthetic "Auto" model id; each turn's `usage.model` reports the model it resolved to. */ | ||
| const AGENT_HOST_AUTO_MODEL_ID = 'auto'; | ||
|
|
||
| /** Minimal model metadata needed to render a turn's response footer (kept small for unit testing). */ | ||
| export interface ITurnResponseModel { | ||
| readonly name: string; | ||
| readonly id: string; | ||
| readonly pricing?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Formats a turn's response footer: the model display name plus usage metadata (credits or pricing). | ||
| * `model` is the resolved language model and `rawModelId` is the turn's `usage.model`. When Auto ran, | ||
| * the turn reports the concrete model it resolved to (e.g. `raptor-mini`), shown as `Auto (raptor-mini)`. | ||
| * Returns `undefined` when the model is unknown. | ||
| */ | ||
| export function formatTurnResponseDetails( | ||
| model: ITurnResponseModel | undefined, | ||
| rawModelId: string | undefined, | ||
| usage: UsageInfo | undefined, | ||
| ): string | undefined { | ||
| if (!model) { | ||
| return undefined; | ||
| } | ||
| const displayName = formatTurnModelName(model, rawModelId); | ||
| const credits = usageInfoToChatUsage(usage)?.copilotCredits; | ||
| if (credits !== undefined) { | ||
| const formatted = formatCopilotCredits(credits); | ||
| const creditDetails = formatted === '1' | ||
| ? localize('agentHost.responseDetails.credit', "{0} credit", formatted) | ||
| : localize('agentHost.responseDetails.credits', "{0} credits", formatted); | ||
| return [displayName, creditDetails].join(' • '); | ||
| } | ||
| return [displayName, model.pricing].filter(Boolean).join(' · '); | ||
| } | ||
|
|
||
| /** Expands the synthetic Auto model to `Auto (<resolved model id>)` when the turn reported one. */ | ||
| function formatTurnModelName(model: ITurnResponseModel, rawModelId: string | undefined): string { | ||
| if (model.id === AGENT_HOST_AUTO_MODEL_ID && rawModelId && rawModelId !== AGENT_HOST_AUTO_MODEL_ID) { | ||
| return localize('agentHost.responseDetails.autoModel', "{0} ({1})", model.name, rawModelId); | ||
| } | ||
| return model.name; | ||
| } |
Member
There was a problem hiding this comment.
@dmitrivMS I suggest that after landing #323211, we instead use the message.model (user-picked model) vs message.usage.model (usage-billed model) to do this in a generic way, rather than hardcoding auto.
Feel free to merge and we can take it as a followup, or wait for it to go in :)
Contributor
Author
There was a problem hiding this comment.
That's ok, I can wait.
connor4312
approved these changes
Jun 26, 2026
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.
Fixes #321032
Will show
Auto (model-id)instead ofAutowhen model cannot be resolved (happens with free/student accounts).