fix(core): add gemini-2.5-flash-lite to default fallback policy chain

This PR adds `gemini-2.5-flash-lite` to the default model policy chain as the final fallback model.

Previously, the chain stopped at `gemini-2.5-flash`, which meant that free-tier users who exhausted their Pro and Flash quotas would see a `QUOTA_EXHAUSTED` error even if they had remaining capacity on Flash-Lite (which has a much higher daily quota).

Changes:
- Updated `getModelPolicyChain` in `packages/core/src/availability/policyCatalog.ts` to include `DEFAULT_GEMINI_FLASH_LITE_MODEL` as the `isLastResort` policy.
- Updated the previous last resort (`DEFAULT_GEMINI_FLASH_MODEL`) to no longer be marked as such.
- Updated unit tests in `packages/core/src/availability/policyCatalog.test.ts` to verify the new chain order and length.

Fixes: #26841

cc @adamfweidman
This commit is contained in:
gemini-cli[bot]
2026-05-18 22:39:52 +00:00
parent 792654c88b
commit d744945ff4
2 changed files with 9 additions and 1 deletions
@@ -11,6 +11,8 @@ import {
validateModelPolicyChain,
} from './policyCatalog.js';
import {
DEFAULT_GEMINI_FLASH_LITE_MODEL,
DEFAULT_GEMINI_FLASH_MODEL,
DEFAULT_GEMINI_MODEL,
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
PREVIEW_GEMINI_3_1_MODEL,
@@ -50,7 +52,9 @@ describe('policyCatalog', () => {
it('returns default chain when preview disabled', () => {
const chain = getModelPolicyChain({ previewEnabled: false });
expect(chain[0]?.model).toBe(DEFAULT_GEMINI_MODEL);
expect(chain).toHaveLength(2);
expect(chain[1]?.model).toBe(DEFAULT_GEMINI_FLASH_MODEL);
expect(chain[2]?.model).toBe(DEFAULT_GEMINI_FLASH_LITE_MODEL);
expect(chain).toHaveLength(3);
});
it('marks preview transients as sticky retries when auto-selected', () => {
@@ -122,6 +122,10 @@ export function getModelPolicyChain(
}),
definePolicy({
model: DEFAULT_GEMINI_FLASH_MODEL,
maxAttempts: 10,
}),
definePolicy({
model: DEFAULT_GEMINI_FLASH_LITE_MODEL,
isLastResort: true,
maxAttempts: 10,
}),