fix(patch): cherry-pick d96bd05 to release/v0.29.6-pr-19867 to patch version v0.29.6 and create version 0.29.7#20104
Conversation
Summary of ChangesHello @gemini-cli-robot, 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 refines the application's ability to manage and recognize access to various preview AI models. It updates the core configuration logic to dynamically check user quotas against an expanded list of preview model identifiers, ensuring that users are granted appropriate access to the latest Gemini 3.1 preview offerings. The changes also include new test coverage to validate this updated access mechanism. Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
|
Size Change: +53 B (0%) Total Size: 23.9 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request correctly generalizes the preview model access check by using the isPreviewModel helper instead of a single hardcoded constant. This ensures that users with Gemini 3.1 preview quotas are correctly recognized. I have identified a potential issue where isPreviewModel does not handle model aliases (like pro or auto), which could lead to inconsistent behavior when these aliases are used in the configuration. I've suggested a refactor to use resolveModel for better robustness and added test cases using hardcoded literals as per repository guidelines.
| return ( | ||
| model === PREVIEW_GEMINI_MODEL || | ||
| model === PREVIEW_GEMINI_3_1_MODEL || | ||
| model === PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL || | ||
| model === PREVIEW_GEMINI_FLASH_MODEL || | ||
| model === PREVIEW_GEMINI_MODEL_AUTO | ||
| ); |
There was a problem hiding this comment.
The isPreviewModel function currently checks for strict equality against a hardcoded list of model IDs. This is inconsistent with other helpers like isGemini3Model and fails to correctly identify preview models when aliases like pro or auto are used in the configuration. This can lead to incorrect feature enablement (e.g., useWriteTodos being enabled for Gemini 3 models) and failure to trigger model fallbacks when access is lost. Refactoring this to use resolveModel first makes it much more robust and maintainable.
| return ( | |
| model === PREVIEW_GEMINI_MODEL || | |
| model === PREVIEW_GEMINI_3_1_MODEL || | |
| model === PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL || | |
| model === PREVIEW_GEMINI_FLASH_MODEL || | |
| model === PREVIEW_GEMINI_MODEL_AUTO | |
| ); | |
| const resolved = resolveModel(model); | |
| return ( | |
| resolved === PREVIEW_GEMINI_MODEL || | |
| resolved === PREVIEW_GEMINI_3_1_MODEL || | |
| resolved === PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL || | |
| resolved === PREVIEW_GEMINI_FLASH_MODEL | |
| ); |
| expect(isPreviewModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(true); | ||
| expect(isPreviewModel(PREVIEW_GEMINI_FLASH_MODEL)).toBe(true); | ||
| expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true); | ||
| }); |
There was a problem hiding this comment.
To ensure that isPreviewModel correctly handles aliases, we should add test cases for 'pro' and 'auto'. As per repository guidelines, prefer using hardcoded literal values in tests instead of importing constants to ensure tests are self-contained and less brittle.
expect(isPreviewModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(true);
expect(isPreviewModel(PREVIEW_GEMINI_FLASH_MODEL)).toBe(true);
expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
expect(isPreviewModel("pro")).toBe(true);
expect(isPreviewModel("auto")).toBe(true);
});References
- In tests, prefer using hardcoded literal values instead of importing constants to ensure tests are self-contained and less brittle.
This PR automatically cherry-picks commit d96bd05 to patch version v0.29.6 in the stable release to create version 0.29.7.