Skip to content

fix(core): preserve explicit versioned model IDs across resolutions - #29422

Closed
Pcmhacker-piro wants to merge 1 commit into
google-gemini:mainfrom
Pcmhacker-piro:fix/preserve-explicit-model-ids
Closed

Pcmhacker-piro wants to merge 1 commit into
google-gemini:mainfrom
Pcmhacker-piro:fix/preserve-explicit-model-ids

Conversation

@Pcmhacker-piro

Copy link
Copy Markdown

Summary

Preserve explicit versioned model IDs (such as gemini-3-pro-preview and gemini-2.5-flash) instead of silently remapping them during rollout promotions. This keeps --model pinning accurate, fixes Vertex AI failures where 3.5 Flash is inaccessible, and extends the guarantees introduced in #29252.

Details

  • Separate PREVIEW_GEMINI_MODEL (gemini-3-pro-preview) from falling through into the useGemini3_1 promotion logic in packages/core/src/config/models.ts. Promotions now strictly apply to alias models (auto, pro, auto-gemini-3).
  • Remove concrete rollout promotion contexts for gemini-2.5-flash, gemini-3.5-flash, and gemini-3-pro-preview in packages/core/src/config/defaultModelConfigs.ts.
  • Fix context condition ordering in classifierIdResolutions.flash in defaultModelConfigs.ts so requestedModels matches before useGemini3_5Flash.
  • Add unit tests in packages/core/src/config/models.test.ts verifying that explicit versioned models are preserved across all flag combinations.

Related Issues

Fixes #29417
Fixes #29213
Related to #29252
Related to #28859

How to Validate

  1. Run the focused core tests:

    npm exec --workspace @google/gemini-cli-core -- vitest run src/config/models.test.ts --coverage.enabled=false

    Expected: Tests pass verifying that explicit gemini-3-pro-preview and gemini-2.5-flash remain unchanged while aliases like flash and pro promote appropriately.

  2. Verify dynamic and legacy resolution:

    • resolveModel('gemini-3-pro-preview', true) returns 'gemini-3-pro-preview'.
    • resolveModel('gemini-2.5-flash', false, false, true, config, true) returns 'gemini-2.5-flash'.
    • resolveModel('flash', false, false, true, config, true) returns 'gemini-3.5-flash'.
    • resolveModel('pro', true, false, true, config, false) returns 'gemini-3.1-pro-preview'.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed; existing documentation already specifies that --model takes precedence)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any; none)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Pcmhacker-piro
Pcmhacker-piro requested a review from a team as a code owner September 20, 2026 07:53
@github-actions github-actions Bot added the size/m A medium sized PR label Sep 20, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 64
  • Additions: +37
  • Deletions: -27
  • Files changed: 3

@google-cla

google-cla Bot commented Sep 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Pcmhacker-piro
Pcmhacker-piro force-pushed the fix/preserve-explicit-model-ids branch 2 times, most recently from c14ae8d to 54a7f92 Compare September 20, 2026 08:03
@Pcmhacker-piro
Pcmhacker-piro force-pushed the fix/preserve-explicit-model-ids branch from 54a7f92 to d8723ba Compare September 20, 2026 08:15
@Pcmhacker-piro

Copy link
Copy Markdown
Author

Hi @google-gemini team,

This PR addresses the issue identified in #29417 (and #29213) by ensuring explicit model IDs (such as gemini-3-pro-preview and gemini-2.5-flash) remain unmapped during rollout promotions, following the bot's effort analysis diagnosis. All unit tests and CLA checks are passing.

Could you please review when you have a moment? Thank you!

/gemini review

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality labels Sep 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Gemini model resolution logic to ensure that the explicit gemini-3-pro-preview model is preserved and resolved to itself instead of being redirected when useGemini3_1 is active. Additionally, it simplifies the default model configurations by removing obsolete contexts for several Gemini models, updates the flash alias configuration, and adds unit tests to validate these changes. I have no feedback to provide as the changes are clean and well-tested.

@gemini-cli

gemini-cli Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@gemini-cli

gemini-cli Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality priority/p2 Important but can be addressed in a future release. size/m A medium sized PR status/pr-nudge-sent

Projects

None yet

1 participant