fix(availability): add flash-lite as last-resort in preview policy chain

Auto (Gemini 3) mode used Pro → Flash with Flash as isLastResort.
When Flash quota is exhausted, the CLI had nowhere to fall back to.

Add Flash Lite (gemini-3.1-flash-lite-preview when Gemini 3.1 is enabled,
gemini-2.5-flash-lite otherwise) as the new isLastResort, demoting Flash
to an intermediate step. Users no longer need to manually switch models
when Flash is exhausted — Auto mode will silently continue on Flash Lite.
This commit is contained in:
kazuki 2026-04-20 17:00:02 +09:00
parent 97037243ff
commit 6060ca2bc1

View file

@ -14,6 +14,7 @@ import {
DEFAULT_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_MODEL,
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
PREVIEW_GEMINI_FLASH_MODEL,
PREVIEW_GEMINI_MODEL,
resolveModel,
@ -89,9 +90,13 @@ export function getModelPolicyChain(
options.useGemini31FlashLite,
options.useCustomToolModel,
);
const flashLiteModel = options.useGemini31FlashLite
? PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL
: DEFAULT_GEMINI_FLASH_LITE_MODEL;
return [
definePolicy({ model: previewModel }),
definePolicy({ model: PREVIEW_GEMINI_FLASH_MODEL, isLastResort: true }),
definePolicy({ model: PREVIEW_GEMINI_FLASH_MODEL }),
definePolicy({ model: flashLiteModel, isLastResort: true }),
];
}