Skip to content

feat(models): support Gemini 3.1 Pro Preview and fixes#19676

Merged
sehoon38 merged 4 commits intomainfrom
sehoon/gemini_31
Feb 20, 2026
Merged

feat(models): support Gemini 3.1 Pro Preview and fixes#19676
sehoon38 merged 4 commits intomainfrom
sehoon/gemini_31

Conversation

@sehoon38
Copy link
Copy Markdown
Contributor

@sehoon38 sehoon38 commented Feb 20, 2026

Summary

Cherry-picked 4 commits from hotfix/v0.30.0-preview.2/fix-bug to support Gemini 3.1 features and fixes.

Details

This PR brings in support for Gemini 3.1 Pro Preview, including active model filtering and custom tool model support for API key users. It also includes a fix for isActiveModel to return false for unknown models.

Related Issues

Fixes #19678

How to Validate

Run the following tests:

npm test -w @google/gemini-cli -- src/ui/components/ModelDialog.test.tsx
npm test -w @google/gemini-cli-core -- src/config/models.test.ts

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

…ing (#125)

* feat(core,ui): support Gemini 3.1 Pro Preview and active model filtering

* fix(core,ui): use optional chaining for config methods to support mocks

* fix(core): clear stale authType in refreshAuth to avoid incorrect model resolution

* do not show gemini 3.1 model when users do not have access to gemini 3.1 in stats
* feat(models): add support for Gemini 3.1 and custom tool models

* test(routing): fix classifier and numerical classifier strategy tests

* test(routing): add Gemini 3.1 tests for classifier strategy

* fix(models): correctly filter active Gemini 3.1 models

* fix(routing): ensure useCustomToolModel is only true when Gemini 3.1 is enabled

* fix(test-utils): prevent double newline in lastFrame() on Windows

* fix(test-utils): surgically fix double newline in lastFrame() on Windows

* use custom_tools_model string for api key only

* fix(ui): correct useCustomToolModel logic and update tests

* fix(ui): correct useCustomToolModel logic in StatsDisplay

* fix(routing): ensure test models are active and sync useCustomToolModel logic
* only use customtoolmodel for api key users

* use displaystring for showing model in about
@sehoon38 sehoon38 requested a review from a team as a code owner February 20, 2026 19:02
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Feb 20, 2026

Hi @sehoon38, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @sehoon38, 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 integrates support for the new Gemini 3.1 Pro Preview model, including its custom tool variant, into the CLI. It enhances the model selection and display mechanisms to intelligently adapt based on the model's launch status and the user's authentication method. Additionally, it improves the clarity of quota-related error messages to provide better user experience and guidance.

Highlights

  • Gemini 3.1 Pro Preview Support: Added comprehensive support for Gemini 3.1 Pro Preview, including new model constants, dynamic model resolution, and display logic across the CLI.
  • Custom Tool Model Integration: Implemented specific handling for Gemini 3.1 custom tool models, ensuring they are correctly selected and displayed when using Gemini API Key authentication.
  • Active Model Filtering: Introduced an isActiveModel utility to dynamically filter and display models based on whether Gemini 3.1 is launched and if custom tool models are preferred, improving model selection accuracy.
  • Improved Quota Error Messaging: Refined terminal quota error messages to be more general for 'all Pro models' and to include suggestions for switching models, enhancing user guidance.
  • Gemini 3.1 Launch Status Management: Added new configuration methods (getGemini31Launched, getGemini31LaunchedSync) and an experiment flag to manage and determine the launch status of Gemini 3.1, ensuring consistent behavior across the application.
Changelog
  • packages/cli/src/ui/components/AboutBox.tsx
    • Updated model version display to use getDisplayString.
  • packages/cli/src/ui/components/ModelDialog.test.tsx
    • Updated model dialog tests to include Gemini 3.1 preview models, custom tool model logic, and authentication types.
  • packages/cli/src/ui/components/ModelDialog.tsx
    • Implemented dynamic model selection in the model dialog to support Gemini 3.1 Pro Preview and custom tool models based on launch status and authentication type.
  • packages/cli/src/ui/components/StatsDisplay.tsx
    • Updated model statistics display to filter and show active models based on Gemini 3.1 launch status and custom tool model usage, and applied getDisplayString for consistent model naming.
  • packages/cli/src/ui/components/messages/ModelMessage.tsx
    • Updated model message display to use getDisplayString for consistent model naming.
  • packages/cli/src/ui/hooks/useQuotaAndFallback.test.ts
    • Updated quota fallback error messages and added tests for specific quota error scenarios, including non-pro models and no-delay errors.
  • packages/cli/src/ui/hooks/useQuotaAndFallback.ts
    • Refactored quota and fallback logic to use isProModel for improved error messaging and getDisplayString for model display consistency.
  • packages/cli/src/zed-integration/zedIntegration.ts
    • Updated Zed integration to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/availability/policyHelpers.ts
    • Updated policy chain resolution to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/code_assist/experiments/flagNames.ts
    • Added a new experiment flag for Gemini 3.1 Pro launch status.
  • packages/core/src/config/config.ts
    • Implemented Gemini 3.1 launch status checks, ensured authType is cleared on auth switch, and updated quota-related model resolution to consider Gemini 3.1 status.
  • packages/core/src/config/models.test.ts
    • Expanded model utility tests to cover isPreviewModel, isProModel, getDisplayString for new models, and resolveModel, resolveClassifierModel, and isActiveModel with Gemini 3.1 and custom tool model logic.
  • packages/core/src/config/models.ts
    • Introduced Gemini 3.1 Pro and custom tool model constants, updated model resolution and display logic, and added utility functions (isProModel, isActiveModel) for model filtering and status.
  • packages/core/src/core/client.ts
    • Updated Gemini client to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/core/contentGenerator.ts
    • Updated content generator creation to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/core/geminiChat.ts
    • Updated Gemini chat API calls to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/prompts/promptProvider.ts
    • Updated prompt provider to pass Gemini 3.1 launch status to resolveModel for prompt generation.
  • packages/core/src/routing/strategies/classifierStrategy.test.ts
    • Expanded classifier strategy tests to include Gemini 3.1 and custom tool model routing logic based on launch status and authentication type.
  • packages/core/src/routing/strategies/classifierStrategy.ts
    • Updated classifier strategy to dynamically resolve models, including Gemini 3.1 and custom tool models, based on launch status and authentication.
  • packages/core/src/routing/strategies/defaultStrategy.ts
    • Updated default routing strategy to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/routing/strategies/fallbackStrategy.ts
    • Updated fallback routing strategy to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/routing/strategies/numericalClassifierStrategy.test.ts
    • Expanded numerical classifier strategy tests to include Gemini 3.1 and custom tool model routing logic based on launch status and authentication type.
  • packages/core/src/routing/strategies/numericalClassifierStrategy.ts
    • Updated numerical classifier strategy to dynamically resolve models, including Gemini 3.1 and custom tool models, based on launch status and authentication.
  • packages/core/src/routing/strategies/overrideStrategy.ts
    • Updated override routing strategy to pass Gemini 3.1 launch status to resolveModel.
  • packages/core/src/services/chatCompressionService.ts
    • Updated chat compression service to recognize and map PREVIEW_GEMINI_3_1_MODEL for configuration aliases.
Activity
  • No human activity has been recorded on this pull request yet.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
Copy link
Copy Markdown

Size Change: +5.58 kB (+0.02%)

Total Size: 25.2 MB

Filename Size Change
./bundle/gemini.js 25.2 MB +5.58 kB (+0.02%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

Copy link
Copy Markdown
Contributor

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

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 effectively introduces support for Gemini 3.1 Pro Preview models, including a custom tools model variant for API key users. The changes are comprehensive, updating model resolution logic, UI components, and routing strategies throughout the codebase. The addition of an experiment flag for the 3.1 launch and corresponding tests ensures the new functionality is well-controlled and validated.

I've identified one area for improvement in the model resolution logic that could prevent unexpected behavior for users explicitly configuring older preview models. Otherwise, the changes are well-implemented.

): string {
switch (requestedModel) {
case PREVIEW_GEMINI_MODEL_AUTO: {
case PREVIEW_GEMINI_MODEL:
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.

high

Explicitly requesting PREVIEW_GEMINI_MODEL ('gemini-3-pro-preview') should not result in an automatic upgrade to a Gemini 3.1 model when the useGemini3_1 flag is true. This can lead to unexpected behavior for users who have explicitly configured the older preview model. By removing this case, PREVIEW_GEMINI_MODEL will fall through to the default case, which correctly returns the requested model as-is, honoring the user's explicit choice.

@sehoon38 sehoon38 added this pull request to the merge queue Feb 20, 2026
@gemini-cli gemini-cli bot added the area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality label Feb 20, 2026
Merged via the queue into main with commit f97b04c Feb 20, 2026
30 checks passed
@sehoon38 sehoon38 deleted the sehoon/gemini_31 branch February 20, 2026 19:32
tripleyoung pushed a commit to tripleyoung/gemini-cli that referenced this pull request Feb 27, 2026
tripleyoung pushed a commit to tripleyoung/gemini-cli that referenced this pull request Feb 27, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Gemini 3.1 pro preview

2 participants