-
Notifications
You must be signed in to change notification settings - Fork 10.4k
fix(patch): cherry-pick 9e6914d to release/v0.21.2-pr-15288 to patch version v0.21.2 and create version 0.21.3 #15295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 error classification logic for Google API responses, specifically targeting HTTP 429 (Too Many Requests) errors. The primary goal is to ensure that any 429 error, regardless of its specific details, is recognized as a retryable quota error. This change introduces a default 5-second retry delay for generic 429s, making the system more robust in handling temporary rate limits and improving the overall reliability of interactions with Google services. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
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 correctly implements a fallback mechanism to treat all unclassified Google API 429 errors as retryable, which is a good improvement for resilience. The accompanying tests are thorough and cover the new logic well. However, I've identified a significant code duplication in classifyGoogleError where the logic for creating the fallback RetryableQuotaError is repeated. I've left a comment with a suggestion to refactor this to improve code maintainability.
| // If we reached this point and the status is still 429, we return retryable. | ||
| if (status === 429) { | ||
| const errorMessage = | ||
| googleApiError?.message || | ||
| (error instanceof Error ? error.message : String(error)); | ||
| return new RetryableQuotaError( | ||
| errorMessage, | ||
| googleApiError ?? { | ||
| code: 429, | ||
| message: errorMessage, | ||
| details: [], | ||
| }, | ||
| DEFAULT_RETRYABLE_DELAY_SECOND, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block of code for creating a fallback RetryableQuotaError is nearly identical to the one added at lines 117-129. The logic for defining errorMessage is also duplicated (see lines 100-102 and 252-254). This duplication increases maintenance overhead and the risk of future inconsistencies if the fallback logic needs to be changed.
To improve maintainability, I recommend refactoring to remove this duplication. You could either:
- Extract the creation of the default
RetryableQuotaErrorinto a small, private helper function. - Restructure the
classifyGoogleErrorfunction to have a single fallback path for all unclassified 429 errors at the end of the function.
|
Size Change: +672 B (0%) Total Size: 21.6 MB ℹ️ View Unchanged
|
This PR automatically cherry-picks commit 9e6914d to patch version v0.21.2 in the stable release to create version 0.21.3.