feat(core): fallback to 2.5 models with no access for toolcalls#21283
feat(core): fallback to 2.5 models with no access for toolcalls#21283
Conversation
Summary of ChangesHello, 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 resolution mechanism within the "@google/gemini-cli-core" package by introducing a new parameter to control access to preview models. This ensures that users without explicit access to preview models are automatically provided with stable alternatives, improving reliability and preventing unintended usage. Additionally, it includes a minor dependency fix in a React hook and updates an agent's model reference. 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a hasAccessToPreview parameter to the resolveModel function to automatically downgrade preview models to their stable counterparts when a user lacks access. The changes are well-implemented across the affected files, including updates to policy helpers and tests. I've identified one area for improvement in packages/core/src/config/models.ts where the model downgrade logic could be made more robust to prevent potential issues with future model naming conventions. Overall, this is a solid feature addition that improves model resolution logic.
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to gracefully downgrade preview models to their stable equivalents for users without preview access by adding a hasAccessToPreview flag to the resolveModel function. However, the implementation is incomplete. Critical functions like resolveClassifierModel do not respect the new access control flag, leading to widespread bypasses of the intended security policy. Furthermore, the model downgrade logic in models.ts should be made more robust, explicit, and less reliant on string matching to enhance future maintainability.
|
Size Change: +763 B (0%) Total Size: 26 MB ℹ️ View Unchanged
|
a25a8ba to
27ec435
Compare
Summary
This PR adds an optional
hasAccessToPreviewparameter to theresolveModelfunction in@google/gemini-cli-core. When this flag is set tofalse, any resolved preview model is automatically downgraded to its stable equivalent (e.g.,gemini-3-pro-preview->gemini-2.5-pro).Details
resolveModelinpackages/core/src/config/models.tsto accepthasAccessToPreview: boolean = true.policyHelpers.tsto pass the access flag from the configuration.useGeminiStream.tsthat was blocking preflight.cli-help-agent.tsto use a concrete preview model directly.Related Issues
Fixes https://github.com/google-gemini/maintainers-gemini-cli/issues/1284
How to Validate
npm test -w @google/gemini-cli-core -- src/config/models.test.tsresolveModelwithhasAccessToPreview: falsereturns non-preview models even when a preview model or alias is requested.Pre-Merge Checklist