Skip to content

Guard pro model usage#22665

Merged
sehoon38 merged 10 commits intomainfrom
feature/free-tier-optimization
Mar 16, 2026
Merged

Guard pro model usage#22665
sehoon38 merged 10 commits intomainfrom
feature/free-tier-optimization

Conversation

@sehoon38
Copy link
Contributor

Summary

Guard pro model usage with experiments, and enable 3.1 flash lite for some users.

Details

Related Issues

Related to #21040

How to Validate

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

@gemini-cli
Copy link
Contributor

gemini-cli bot commented Mar 16, 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!

@github-actions
Copy link

github-actions bot commented Mar 16, 2026

Size Change: +2.22 kB (+0.01%)

Total Size: 26.1 MB

Filename Size Change
./bundle/chunk-N7P6R6BD.js 0 B -3.62 MB (removed) 🏆
./bundle/chunk-O3SO3KSS.js 0 B -13.4 MB (removed) 🏆
./bundle/chunk-VN2KBIC6.js 0 B -1.95 MB (removed) 🏆
./bundle/core-K454Q3FF.js 0 B -40.3 kB (removed) 🏆
./bundle/devtoolsService-VBRQ3JIQ.js 0 B -27.7 kB (removed) 🏆
./bundle/interactiveCli-S5TYD55B.js 0 B -1.59 MB (removed) 🏆
./bundle/oauth2-provider-AIXHERQU.js 0 B -9.19 kB (removed) 🏆
./bundle/chunk-IHZSIEIN.js 3.62 MB +3.62 MB (new file) 🆕
./bundle/chunk-IVRM4EYJ.js 13.4 MB +13.4 MB (new file) 🆕
./bundle/chunk-M7VDGI6V.js 1.95 MB +1.95 MB (new file) 🆕
./bundle/core-IH4HTKQN.js 40.4 kB +40.4 kB (new file) 🆕
./bundle/devtoolsService-MPEKS76D.js 27.7 kB +27.7 kB (new file) 🆕
./bundle/interactiveCli-W26C557V.js 1.6 MB +1.6 MB (new file) 🆕
./bundle/oauth2-provider-BOO24CKD.js 9.19 kB +9.19 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-37ZTTFQF.js 966 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/gemini.js 695 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-A4UZQ6IE.js 0 B -922 B (removed) 🏆
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./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
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/undici-4X2YZID5.js 360 B 0 B
./bundle/memoryDiscovery-ZHYVZFWT.js 922 B +922 B (new file) 🆕

compressed-size-action

@gemini-cli gemini-cli bot added the priority/p1 Important and should be addressed in the near term. label Mar 16, 2026
@sehoon38 sehoon38 marked this pull request as ready for review March 16, 2026 16:02
@sehoon38 sehoon38 requested a review from a team as a code owner March 16, 2026 16:02
@gemini-code-assist
Copy link
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 enhances the model selection experience by introducing granular control over 'Pro' model access and integrating a new 'Gemini 3.1 Flash Lite' preview model. It ensures that users are presented with appropriate model options based on their access rights and tier, improving clarity and preventing selection of unavailable models. The changes also include an automatic fallback for 'auto' model selection when 'Pro' models are inaccessible, streamlining the user workflow.

Highlights

  • Pro Model Access Control: Introduced an experiment flag PRO_MODEL_NO_ACCESS to guard the usage of 'Pro' models. The UI and configuration now dynamically adjust model availability based on a user's access to these models.
  • Gemini 3.1 Flash Lite Model Integration: Added support for the PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL. This model is now conditionally displayed in the model selection dialog, specifically enabled for free-tier users.
  • Dynamic Model Selection Logic: Implemented logic to automatically switch the default 'auto' model to PREVIEW_GEMINI_FLASH_MODEL if a user does not have access to 'Pro' models. The model dialog also filters out 'Pro' models for users without access.
  • UI/UX Enhancements for Model Dialog: The model selection dialog (ModelDialog) now initializes to the 'manual' view if a user lacks 'Pro' model access. Escape key behavior was also adjusted to prevent switching back to the 'main' view in this scenario.
Changelog
  • packages/cli/src/ui/components/ModelDialog.test.tsx
    • Imported PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL and UserTierId.
    • Updated mock configuration to include getProModelNoAccess, getProModelNoAccessSync, and getUserTier.
    • Added new test cases to verify the rendering and filtering of models for users without 'Pro' access, ensuring correct model order and conditional display of PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL.
  • packages/cli/src/ui/components/ModelDialog.tsx
    • Imported useEffect, isProModel, and UserTierId.
    • Introduced hasAccessToProModel state and initialized view based on synchronous 'Pro' model access.
    • Added a useEffect hook to asynchronously check and update hasAccessToProModel and set the view to 'manual' if 'Pro' models are inaccessible.
    • Modified escape key handling to conditionally allow switching from 'manual' to 'main' view only if the user has 'Pro' model access.
    • Updated manualOptions memoization to include isFreeTier and hasAccessToProModel for dynamic model filtering and inclusion of PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL for free-tier users.
  • packages/core/src/code_assist/experiments/flagNames.ts
    • Added PRO_MODEL_NO_ACCESS (ID 45768879) to ExperimentFlags.
  • packages/core/src/config/config.test.ts
    • Imported PREVIEW_GEMINI_MODEL_AUTO and PREVIEW_GEMINI_FLASH_MODEL.
    • Added test cases to verify that the 'auto' model switches to PREVIEW_GEMINI_FLASH_MODEL if the user has no 'Pro' access, and does not switch if 'Pro' access is available.
  • packages/core/src/config/config.ts
    • Implemented getProModelNoAccess (async) and getProModelNoAccessSync (sync) methods to check the PRO_MODEL_NO_ACCESS experiment flag.
    • Added logic within refreshAuth to set the model to PREVIEW_GEMINI_FLASH_MODEL if the user has no 'Pro' access and the current model is an 'auto' model.
  • packages/core/src/config/models.test.ts
    • Imported PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL.
    • Added test cases for getDisplayString to correctly return PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL.
    • Added a test case for resolveModel to ensure PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL falls back to DEFAULT_GEMINI_FLASH_LITE_MODEL when preview access is false.
    • Updated isActiveModel tests to include PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL.
  • packages/core/src/config/models.ts
    • Defined PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL constant.
    • Added PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL to VALID_GEMINI_MODELS.
    • Updated isPreviewModel to recognize PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL.
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.

Copy link
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 introduces a mechanism to guard Pro model usage based on an experiment flag and adds a new gemini-3.1-flash-lite-preview model for certain users. The changes in the ModelDialog component and its tests correctly handle the new UI logic for filtering models and displaying the new flash lite model based on user tier. The core Config is also updated to switch users without Pro access from an "auto" model to a flash model.

My review found one critical issue in the tests for this new model-switching logic. The test cases have inverted boolean logic for the experiment flag, which means the feature is not being correctly verified. I've provided a code suggestion to fix the tests.

@sehoon38 sehoon38 force-pushed the feature/free-tier-optimization branch from ccdccf8 to fa824c0 Compare March 16, 2026 16:09
Copy link
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 introduces a mechanism to guard pro model usage based on an experiment flag and adds a new flash lite model for certain users. The changes in the Config and ModelDialog components correctly implement this logic. However, I've found a critical issue in the accompanying tests for the Config class, where the test logic is inverted, failing to properly validate the new behavior. Please see the detailed comment.

@sehoon38 sehoon38 added this pull request to the merge queue Mar 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 16, 2026
@sehoon38 sehoon38 added this pull request to the merge queue Mar 16, 2026
Merged via the queue into main with commit 48130eb Mar 16, 2026
27 checks passed
@sehoon38 sehoon38 deleted the feature/free-tier-optimization branch March 16, 2026 18:01
@sehoon38
Copy link
Contributor Author

/patch

@galz10
Copy link
Collaborator

galz10 commented Mar 16, 2026

/patch both

@github-actions
Copy link

🚀 [Step 1/4] Patch workflow(s) waiting for approval!

📋 Details:

  • Channels: stable,preview
  • Commit: 48130ebd25100f3a3b5efbf9e4568100411645b2
  • Workflows Created: 2

⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs.

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Mar 16, 2026
@github-actions
Copy link

🚀 [Step 2/4] Patch PR Created!

📋 Patch Details:

📝 Next Steps:

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

🔗 Track Progress:

github-actions bot pushed a commit that referenced this pull request Mar 16, 2026
# Conflicts:
#	packages/core/src/config/models.test.ts
@github-actions
Copy link

🚀 [Step 2/4] Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #22720
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

@github-actions
Copy link

🚀 [Step 3/4] Patch Release Waiting for Approval!

📋 Release Details:

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

⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

🚀 [Step 3/4] Patch Release Waiting for Approval!

📋 Release Details:

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

⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes.

🔗 Track Progress:

@github-actions
Copy link

[Step 4/4] Patch Release Complete!

📦 Release Details:

  • Version: 0.33.2
  • 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

[Step 4/4] Patch Release Complete!

📦 Release Details:

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

📝 What's Available:

🔗 Links:

kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants