feat(copilotcli): Add auto model configuration#311780
Merged
DonJayamanne merged 8 commits intomainfrom Apr 22, 2026
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “auto” model support for Copilot CLI and introduces a user setting to enable/disable exposing that option through the language model provider, addressing #311779.
Changes:
- Add
github.copilot.chat.cli.autoModel.enabledsetting (default:true) and wire it into Copilot CLI model resolution/model listing. - Update
CopilotCLIModelsto cache resolvedLanguageModelChatInformationand prepend anautoentry when enabled. - Expand vitest coverage around model resolution and
provideLanguageModelChatInformationbehaviors (auth/no-auth, pending fetch, auth changes, setting toggle).
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/configuration/common/configurationService.ts | Adds a new advanced config key for enabling/disabling the auto model option in Copilot CLI. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts | Implements the auto model entry, caches resolved model infos, and applies the new setting in the LM provider surface. |
| extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotCliModels.spec.ts | Adds/updates tests for auto model resolution, provider behaviors, and the new config setting. |
| extensions/copilot/package.nls.json | Adds localized description string for the new setting. |
| extensions/copilot/package.json | Exposes the new setting in the extension’s configuration contribution. |
Copilot's findings
Comments suppressed due to low confidence (3)
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts:106
resolveModelshort-circuitsautoby returning the original input string (preserving casing/whitespace). Callers (e.g. prompt-file model resolution) expect a canonical model id; returningAuto/AUTOcan leak through to SDK selection and fail if the SDK expectsauto. Trim/lowercase first, and return the canonical'auto'id when enabled.
async resolveModel(modelId: string): Promise<string | undefined> {
if (modelId.toLowerCase() === 'auto' && this.configurationService.getConfig(ConfigKey.Advanced.CLIAutoModelEnabled)) {
return modelId;
}
const models = await this.getModels();
modelId = modelId.trim().toLowerCase();
return models.find(m => m.id.toLowerCase() === modelId || m.name.toLowerCase() === modelId)?.id;
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts:167
provideLanguageModelChatInformationreturns_resolvedModelInfosas-is once fetched, so togglingchat.cli.autoModel.enabledat runtime won’t take effect (auto may remain present/absent until an auth change). Consider filtering/prependingautoon each call based on the current setting, or listen for configuration changes to rebuild_resolvedModelInfosand fire_onDidChange.
provideLanguageModelChatInformation: async (_options, _token) => {
const autoModelEnabled = this.configurationService.getConfig(ConfigKey.Advanced.CLIAutoModelEnabled);
if (!this._authenticationService.anyGitHubSession || !this._resolvedModelInfos) {
return autoModelEnabled ? [buildAutoModel()] : [];
}
return this._resolvedModelInfos;
},
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts:206
- When
chat.cli.autoModel.enabledis disabled,_buildModelInfosno longer marks any SDK model as default (isDefaultis omitted for all non-auto models). This can result in no default model being surfaced to the language model service. Preserve the previous behavior by marking the first SDK model as default when auto is disabled (and ensure only one model is default at a time).
private _buildModelInfos(models: CopilotCLIModelInfo[]): vscode.LanguageModelChatInformation[] {
const isReasoningEffortEnabled = this.configurationService.getConfig(ConfigKey.Advanced.CLIThinkingEffortEnabled);
const isAutoModelEnabled = this.configurationService.getConfig(ConfigKey.Advanced.CLIAutoModelEnabled);
const modelsInfo: vscode.LanguageModelChatInformation[] = models.map((model, index) => {
const multiplier = model.multiplier === undefined ? undefined : `${model.multiplier}x`;
return {
id: model.id,
name: model.name,
family: model.id,
version: '',
maxInputTokens: model.maxInputTokens ?? model.maxContextWindowTokens,
maxOutputTokens: model.maxOutputTokens ?? 0,
multiplier,
multiplierNumeric: model.multiplier,
isUserSelectable: true,
configurationSchema: isReasoningEffortEnabled ? buildConfigurationSchema(model) : undefined,
capabilities: {
imageInput: model.supportsVision,
toolCalling: true
},
targetChatSessionType: 'copilotcli'
};
});
if (isAutoModelEnabled) {
modelsInfo.unshift(buildAutoModel(models[0]));
}
return modelsInfo;
- Files reviewed: 5/5 changed files
- Comments generated: 2
Contributor
roblourens
approved these changes
Apr 21, 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.
Co-authored-by: Copilot copilot@github.com
Fixes #311779