Skip to content

fix(core): preserve explicit Gemini 3 Pro preview model IDs - #29420

Closed
FanouZeng-TT wants to merge 1 commit into
google-gemini:mainfrom
FanouZeng-TT:fix-explicit-pro-preview-model
Closed

FanouZeng-TT wants to merge 1 commit into
google-gemini:mainfrom
FanouZeng-TT:fix-explicit-pro-preview-model

Conversation

@FanouZeng-TT

Copy link
Copy Markdown

Summary

An explicit --model gemini-3-pro-preview is silently rewritten to gemini-3.1-pro-preview whenever the Gemini 3.1 rollout (useGemini3_1) is enabled. Only the auto/pro aliases should follow the rollout — a user who pins an explicit version should get that version.

Details

The rewrite happened on two independent paths, both fixed here:

  • Legacy resolver (resolveModel) grouped PREVIEW_GEMINI_MODEL into the same switch case as PREVIEW_GEMINI_MODEL_AUTO, so the explicit ID fell through into the 3.1 upgrade. It now has its own case that pins the ID; the existing hasAccessToPreview=false → gemini-2.5-pro downgrade is preserved.
  • Dynamic model configuration (defaultModelConfigs) remapped the explicit gemini-3-pro-preview key through useGemini3_1 contexts. Those contexts are removed from the explicit key, and the classifier pro tier gains an explicit requestedModels: ['gemini-3-pro-preview'] anchor so it stays pinned too.

Two call sites used the explicit model ID as an internal placeholder for "the current Pro rollout target" — they must keep following the rollout:

  • getModelPolicyChain (availability catalog) now derives the rollout Pro model inline from useGemini31/useCustomToolModel instead of calling resolveModel with the explicit ID.
  • The preview / auto-preview model chains select the pro alias (matching the existing lite chain's use of the flash-lite alias) rather than a hard-coded versioned ID.

Related Issues

Fixes #29417

How to Validate

npm ci
npm run build --workspace @google/gemini-cli-core
npm run test:ci --workspace @google/gemini-cli-core
npm run typecheck

Targeted regressions (red before the fix, green after):

cd packages/core
../../node_modules/.bin/vitest run \
  src/config/models.test.ts \
  src/core/geminiChat.test.ts \
  src/availability/policyCatalog.test.ts \
  src/availability/policyHelpers.test.ts
  • resolveModel/dynamic parity: explicit gemini-3-pro-preview (with and without custom tools) stays pinned when useGemini3_1=true; the auto/pro aliases still upgrade to gemini-3.1-pro-preview[-customtools]; hasAccessToPreview=false still downgrades to gemini-2.5-pro.
  • Request boundary: GeminiChat.sendMessageStream sends gemini-3-pro-preview unchanged with the rollout enabled.
  • Availability catalog/chain and classifier-tier parity remain intact.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed) — not needed (internal resolver behavior)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any) — none; behavior only changes for the previously-broken explicit-ID case
  • Validated on required platforms/methods:
    • MacOS
      • npm run

🤖 Generated with Claude Code

@FanouZeng-TT
FanouZeng-TT requested a review from a team as a code owner September 20, 2026 03:50
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where explicit requests for the 'gemini-3-pro-preview' model were being incorrectly rewritten to Gemini 3.1 versions when the rollout was enabled. By separating the handling of explicit model IDs from automatic aliases, the changes ensure that users who pin a specific model version maintain that selection, while general aliases continue to benefit from the intended rollout upgrades.

Highlights

  • Explicit Model Pinning: Modified the model resolver and configuration to ensure that explicit requests for 'gemini-3-pro-preview' remain pinned to that version, preventing them from being automatically upgraded to Gemini 3.1 during the rollout.
  • Rollout Logic Decoupling: Decoupled the Gemini 3.1 rollout logic from explicit model IDs, ensuring that only generic 'auto' or 'pro' aliases are subject to automatic version upgrades.
  • Availability Catalog Updates: Updated the availability catalog to derive rollout-specific models inline, ensuring consistent behavior for internal model chains while preserving user-requested model pinning.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@github-actions github-actions Bot added the size/m A medium sized PR label Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 128
  • Additions: +106
  • Deletions: -22
  • Files changed: 5

@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.

@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 modifies the model resolution logic to ensure that explicit requests for the gemini-3-pro-preview model remain pinned to that specific version instead of automatically upgrading to Gemini 3.1. The Gemini 3.1 rollout is now restricted to model aliases (such as pro and auto). This is implemented by updating resolveModel in models.ts, adjusting the default model configurations in defaultModelConfigs.ts to use the pro alias in preview chains, and updating the policy catalog. Corresponding unit tests have been added to verify the pinning behavior and alias rollouts. I have no further feedback to provide as the implementation is clean and well-tested.

@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
@FanouZeng-TT
FanouZeng-TT force-pushed the fix-explicit-pro-preview-model branch from 2db5738 to 31b4a98 Compare September 20, 2026 03:53
@gemini-cli gemini-cli Bot added the area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality label Sep 20, 2026
An explicit `--model gemini-3-pro-preview` was silently rewritten to
`gemini-3.1-pro-preview` while the Gemini 3.1 rollout was enabled, in both
the legacy resolver and the dynamic model configuration. Only the `auto`
and `pro` aliases should follow the rollout.

- Pin the explicit Pro preview model ID in `resolveModel`, keeping the
  existing preview-access downgrade to `gemini-2.5-pro`.
- Stop remapping the explicit model ID in `defaultModelConfigs` and keep
  the `useGemini3_1` contexts scoped to aliases and classifier tiers.
- Select the Pro rollout default in the availability catalog and the model
  chains from the alias, so internal rollout selection stays separate from
  a user-pinned version.
- Cover the request boundary so `GeminiChat` keeps sending the explicit ID.

Fixes google-gemini#29417
@FanouZeng-TT
FanouZeng-TT force-pushed the fix-explicit-pro-preview-model branch from 31b4a98 to fbcd441 Compare September 23, 2026 03:32
@FanouZeng-TT

Copy link
Copy Markdown
Author

Gentle follow-up: I've rebased this onto the latest main. The rebase had one conflict in packages/core/src/availability/policyCatalog.ts, where the rollout-default selection now resolves through resolveModel; I kept the catalog's own alias-based selection so that pinning the explicit ID inside resolveModel doesn't also suppress the Gemini 3.1 rollout for the auto/pro aliases.

Everything is green on the new head (fbcd441): check-changes, size-label and cla/google all pass, and the targeted suites are 293 passed. Would a maintainer have a moment to take a look?

@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/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 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

Development

Successfully merging this pull request may close these issues.

bug(core): explicit --model gemini-3-pro-preview silently rewritten to gemini-3.1-pro-preview

1 participant