fix(cli): support quota error fallbacks for all authentication types#20475
fix(cli): support quota error fallbacks for all authentication types#20475
Conversation
Summary of ChangesHello @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 significantly enhances the user experience by broadening the support for model quota fallback mechanisms across all authentication types. It ensures that users encountering quota limits receive appropriate guidance, while also refining the user interface to display relevant options based on their authentication method. Additionally, it improves the robustness of authentication type detection by correctly parsing specific environment variables. 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: +336 B (0%) Total Size: 25.7 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request extends the model fallback functionality for quota errors to all authentication types, not just OAuth users. It correctly adapts the UI to conditionally show options like 'Upgrade' only when relevant (for OAuth users). The environment variable parsing for authentication types is also improved to correctly recognize Cloud Shell and Compute ADC environments. The changes are well-implemented and thoroughly tested, improving the user experience for those using API keys or other non-OAuth authentication methods.
…#20338) Previously, model fallbacks on persistent quota errors were restricted to users authenticated with LOGIN_WITH_GOOGLE. This commit enables fallback prompts for all authentication methods, conditionally rendering the 'switch to API key' message exclusively for OAuth users. Additionally, this updates the environment parser to properly respect CLOUD_SHELL and COMPUTE_ADC variables.
b84504c to
4b295ed
Compare
…oogle-gemini#20475) Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
…oogle-gemini#20475) Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
Summary
This PR enables model fallback prompts (for persistent quota/429 errors) for all authentication methods, not just
LOGIN_WITH_GOOGLEOAuth users. It conditionally renders the "switch to API key" message in the fallback dialog only when the user is authenticated via OAuth. It also updates the environment variable parser to properly supportCLOUD_SHELLandGEMINI_CLI_USE_COMPUTE_ADCto resolve toAuthType.COMPUTE_ADC.Details
useQuotaAndFallback. This restriction has been removed.ProQuotaDialognow receives the currentauthTypeand conditionally hides the "Upgrade for higher limits" option for non-OAuth users (e.g. API key users).getAuthTypeFromEnv()was ignoringCLOUD_SHELLandCOMPUTE_ADCenvironment flags entirely, which has now been fixed.Tests have been updated to ensure the fallback dialog correctly triggers and omits the OAuth-specific suggestion and upgrade options for API Key and Vertex users.
Related Issues
Closes #20338
How to Validate
vitesttests foruseQuotaAndFallback.test.ts,ProQuotaDialog.test.tsx, andcontentGenerator.test.tsto see passing tests.GEMINI_API_KEY, trigger a 429 terminal quota error, and verify the fallback prompt appears and does not include the/auth to switch to API key.line nor the "Upgrade for higher limits" button.Pre-Merge Checklist