From d744945ff406c721da9b1a88aec9a6a3ab25b492 Mon Sep 17 00:00:00 2001 From: "gemini-cli[bot]" Date: Mon, 18 May 2026 22:39:52 +0000 Subject: [PATCH] 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 --- packages/core/src/availability/policyCatalog.test.ts | 6 +++++- packages/core/src/availability/policyCatalog.ts | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/src/availability/policyCatalog.test.ts b/packages/core/src/availability/policyCatalog.test.ts index 04e35018d5..a926a6ea2f 100644 --- a/packages/core/src/availability/policyCatalog.test.ts +++ b/packages/core/src/availability/policyCatalog.test.ts @@ -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', () => { diff --git a/packages/core/src/availability/policyCatalog.ts b/packages/core/src/availability/policyCatalog.ts index a5694e94b8..811c81fa87 100644 --- a/packages/core/src/availability/policyCatalog.ts +++ b/packages/core/src/availability/policyCatalog.ts @@ -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, }),