Skip to content

fix(core): allow any preview model in quota access check - #19867

Merged
bdmorgan merged 3 commits into
mainfrom
fix/gemini-3.1-access-bug
Feb 22, 2026
Merged

fix(core): allow any preview model in quota access check#19867
bdmorgan merged 3 commits into
mainfrom
fix/gemini-3.1-access-bug

Conversation

@bdmorgan

@bdmorgan bdmorgan commented Feb 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a bug where users with access only to Gemini 3.1 preview models are incorrectly downgraded to Gemini 2.5 because the CLI's access check specifically looks for the legacy Gemini 3.0 preview model ID (gemini-3-pro-preview) instead of any valid preview model.

Details

The refreshUserQuota() method in packages/core/src/config/config.ts was hardcoded to check for PREVIEW_GEMINI_MODEL ('gemini-3-pro-preview'). With the launch of Gemini 3.1, users who have been transitioned to 3.1 may no longer have the 3.0 bucket in their quota.

Changes:

  • Updated refreshUserQuota to use the isPreviewModel() helper, which correctly identifies both 3.0 and 3.1 models.
  • Updated isPreviewModel() in packages/core/src/config/models.ts to include PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL ('gemini-3.1-pro-preview-customtools'), ensuring full coverage for all 3.1 preview variants.
  • Added regression tests in packages/core/src/config/config.test.ts and packages/core/src/config/models.test.ts.

Related Issues

Fixes reported issue where users transitioned to Gemini 3.1 are unable to access Gemini 3 models.

How to Validate

  • Run the new test case in packages/core/src/config/config.test.ts: npm test -w @google/gemini-cli-core -- src/config/config.test.ts
  • Run the updated tests in packages/core/src/config/models.test.ts: npm test -w @google/gemini-cli-core -- src/config/models.test.ts
  • Confirm that both Gemini 3.1 Pro Preview and the custom tools variant are correctly identified as preview models.

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

Update refreshUserQuota to use isPreviewModel when checking buckets for access. This ensures that users with access only to Gemini 3.1 Pro Preview are not incorrectly downgraded to Gemini 2.5.
@bdmorgan
bdmorgan requested a review from a team as a code owner February 22, 2026 00:31
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @bdmorgan, 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 a critical bug that prevented users with access to Gemini 3.1 preview models from being correctly recognized by the CLI, leading to an unintended downgrade to Gemini 2.5. By updating the model access check to dynamically identify any valid preview model, this change ensures that users retain appropriate access to their entitled preview features, improving the overall user experience and model accessibility.

Highlights

  • Quota Access Logic: Updated the refreshUserQuota method to use the isPreviewModel() helper, allowing it to correctly identify both Gemini 3.0 and 3.1 preview models instead of a hardcoded legacy model ID.
  • Test Coverage: Added a new test case to verify that hasAccessToPreviewModel is correctly set to true when the user's quota includes the Gemini 3.1 preview model.
Changelog
  • packages/core/src/config/config.test.ts
    • Added a test case to validate correct preview model access for Gemini 3.1.
  • packages/core/src/config/config.ts
    • Modified the refreshUserQuota method to use isPreviewModel for broader preview model identification.
Activity
  • The pull request author, bdmorgan, created this PR to fix a bug related to preview model access.
  • A new test case was added to validate the fix.
  • The PR description includes a pre-merge checklist with some items already validated.
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.

@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

The pull request correctly addresses the issue where the quota access check was hardcoded to a specific legacy preview model. By switching to the isPreviewModel helper, the check now covers more models. However, the isPreviewModel helper itself appears to be missing one of the preview model variants defined in the project, which could lead to incorrect downgrades for some users.

Comment thread packages/core/src/config/config.ts
@github-actions

github-actions Bot commented Feb 22, 2026

Copy link
Copy Markdown

Size Change: +53 B (0%)

Total Size: 25.2 MB

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

compressed-size-action

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

add PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL to the list in isPreviewModel

This ensures that users with access only to the Gemini 3.1 Pro Preview with custom tools model are correctly identified as having preview access.
@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 22, 2026
@bdmorgan
bdmorgan added this pull request to the merge queue Feb 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 22, 2026
@bdmorgan
bdmorgan added this pull request to the merge queue Feb 22, 2026
Merged via the queue into main with commit d96bd05 Feb 22, 2026
27 checks passed
@bdmorgan
bdmorgan deleted the fix/gemini-3.1-access-bug branch February 22, 2026 13:07
SH20RAJ added a commit to SH20RAJ/gemini-cli that referenced this pull request Feb 23, 2026
@sehoon38

Copy link
Copy Markdown
Contributor

/patch

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable,preview
  • Commit: d96bd05d368a7315fdf106a6de95e299d97adc18
  • Workflows Created: 2

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20104
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20105
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@sehoon38

Copy link
Copy Markdown
Contributor

/patch

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable,preview
  • Commit: d96bd05d368a7315fdf106a6de95e299d97adc18
  • Workflows Created: 2

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

ℹ️ Patch branch exists but no PR found!

A patch branch hotfix/v0.29.6/0.29.7/stable/cherry-pick-d96bd05/pr-19867 exists but has no open PR.

🔍 Issue: This might indicate an incomplete patch process.

📝 Next Steps:

  1. Delete the branch: git branch -D hotfix/v0.29.6/0.29.7/stable/cherry-pick-d96bd05/pr-19867
  2. Run the patch command again

🔗 Links:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20109
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@sehoon38

Copy link
Copy Markdown
Contributor

/patch

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: stable,preview
  • Commit: d96bd05d368a7315fdf106a6de95e299d97adc18
  • Workflows Created: 2

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20111
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. Review and approve the hotfix PR: #20112
  2. Once merged, the patch release will automatically trigger
  3. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: stable → publishing to npm tag latest
  • Version: v0.29.6
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.29.6-pr-19867

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

🚀 Patch Release Started!

📋 Release Details:

  • Environment: prod
  • Channel: preview → publishing to npm tag preview
  • Version: v0.30.0-preview.5
  • Hotfix PR: Merged ✅
  • Release Branch: release/v0.30.0-preview.5-pr-19867

⏳ Status: The patch release is now running. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions

Copy link
Copy Markdown

Patch Release Complete!

📦 Release Details:

  • Version: 0.29.7
  • NPM Tag: latest
  • Channel: stable
  • Dry Run: false

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

@github-actions

Copy link
Copy Markdown

Patch Release Complete!

📦 Release Details:

🎉 Status: Your patch has been successfully released and published to npm!

📝 What's Available:

🔗 Links:

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

Labels

size/s A small PR status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants