fix(core): handle non-string model flags in resolution (#26069)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Adib234
2026-04-28 13:11:15 -04:00
committed by GitHub
parent 58a57b72ae
commit b0ffa3b51e
4 changed files with 128 additions and 4 deletions
+8 -1
View File
@@ -841,9 +841,16 @@ export async function loadCliConfig(
);
const defaultModel = PREVIEW_GEMINI_MODEL_AUTO;
const specifiedModel =
const rawModel =
argv.model || process.env['GEMINI_MODEL'] || settings.model?.name;
// Ensure specifiedModel is a string (e.g. if yargs parsed multiple --model as an array)
const specifiedModel = Array.isArray(rawModel)
? String(rawModel.at(-1) ?? '').trim() || ''
: rawModel === undefined
? undefined
: String(rawModel ?? '').trim() || '';
const resolvedModel =
specifiedModel === GEMINI_MODEL_ALIAS_AUTO
? defaultModel