Files
gemini-cli/packages
gemini-cli[bot] f146618b6b fix(core): route personal OAuth users to stable models for auto aliases
This PR implements auth-aware model routing to prevent 404/400 errors for users using personal OAuth (`oauth-personal`).

### Problem
When using the `auto-gemini-3` model alias with personal OAuth, the CLI occasionally resolves it to `gemini-3-pro-preview`. However, many personal accounts do not have access to this specific preview model, leading to API errors (404/400). Currently, the CLI only falls back to stable models if the user has NO access to ANY preview models, which is too broad if they have access to older preview models but not the latest ones.

### Solution
- Added `authType` to the `ModelResolutionContext` and `ModelCapabilityContext`.
- Updated `ModelConfigService` to support conditions based on `authType`.
- Modified `DEFAULT_MODEL_CONFIGS` and `settings.schema.json` to explicitly route `oauth-personal` users to stable models (e.g., `gemini-2.5-pro`) for `auto` and `pro` aliases.
- Updated `resolveModel` to pass the current `authType` to the resolution engine.

These changes ensure that personal OAuth users always get a working stable model by default, while API key and Vertex AI users can still access the latest previews.

Fixes: #26857

cc @NTaylorMullen
2026-05-15 21:42:45 +00:00
..