Skip to content

Improve turn details for Auto model in the context of free accounts#323220

Draft
dmitrivMS wants to merge 2 commits into
mainfrom
dev/dmitriv/agent-host-auto-turn-details
Draft

Improve turn details for Auto model in the context of free accounts#323220
dmitrivMS wants to merge 2 commits into
mainfrom
dev/dmitriv/agent-host-auto-turn-details

Conversation

@dmitrivMS

Copy link
Copy Markdown
Contributor

Fixes #321032

Will show Auto (model-id) instead of Auto when model cannot be resolved (happens with free/student accounts).

Copilot AI review requested due to automatic review settings June 26, 2026 23:13
@dmitrivMS dmitrivMS added the agent-host Issues for the agent-host implementation (not the protocol) label Jun 26, 2026
@dmitrivMS dmitrivMS self-assigned this Jun 26, 2026
@dmitrivMS dmitrivMS enabled auto-merge (squash) June 26, 2026 23:13

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.

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 as ModelName + either credits or pricing, including expanding Auto to Auto (<turn model id>) when applicable.
  • Refactored AgentHostSessionHandler to use the shared formatter for TurnModelLookup.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

@dmitrivMS dmitrivMS disabled auto-merge June 26, 2026 23:21
@dmitrivMS dmitrivMS enabled auto-merge (squash) June 26, 2026 23:25
@connor4312 connor4312 disabled auto-merge June 26, 2026 23:37
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;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@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 :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's ok, I can wait.

@dmitrivMS dmitrivMS marked this pull request as draft June 26, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-host Issues for the agent-host implementation (not the protocol)

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Model selected by Auto does not show in agent host sessions

3 participants