feat(core): add HTTP 499 to retryable errors and map to RetryableQuotaError#20432
Conversation
Summary of ChangesHello @bdmorgan, 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 improves the resilience of the core package by explicitly recognizing and handling HTTP 499 "Client Closed Request" errors. By classifying these errors as retryable quota errors, the system can now intelligently apply exponential backoff and trigger appropriate fallback mechanisms when transient infrastructure issues persist. This enhancement is particularly beneficial for interactions with AI models via proxy servers, where such timeouts can occur, leading to a more robust and user-friendly experience. 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 correctly adds HTTP 499 (Client Closed Request) to the set of retryable errors. The changes are consistently applied across the retry logic and error classification utilities, and are well-supported by new unit and integration tests. Classifying the 499 error as a RetryableQuotaError is a logical choice that allows it to leverage the existing exponential backoff and fallback mechanisms. The included fix for a flaky test is also a good addition. The changes are of high quality and I have no further recommendations.
| @@ -144,14 +144,14 @@ describe('GeminiCliAgent Integration', () => { | |||
| }); | |||
|
|
|||
| it('propagates errors from dynamic instructions', async () => { | |||
| const goldenFile = getGoldenPath('agent-static-instructions'); | |||
There was a problem hiding this comment.
where is the file been attach bro??
|
Size Change: +125 B (0%) Total Size: 25.7 MB ℹ️ View Unchanged
|
Summary
Adds HTTP 499 (Client Closed Request) to the list of retryable errors in
packages/core, and correctly classifies it as aRetryableQuotaErrorso that it triggers the exponential backoff mechanism and eventually theonPersistent429fallback dialog (e.g., offering to fall back to a Flash model) if the transient infrastructure failure persists. This is especially helpful for timeouts occurring when talking to models like Gemini 3.1 Pro via proxy servers.Details
isRetryableErrorstatus check inpackages/core/src/utils/retry.ts.classifyGoogleErrorinpackages/core/src/utils/googleQuotaErrors.tsto map HTTP 499 toRetryableQuotaError.retry.test.tsandgoogleQuotaErrors.test.ts.flashFallback.test.tsto ensure persistent 499 errors trigger the correct fallback intent logic.packages/sdk/src/agent.integration.test.tsthat was failing due to missingfakeResponsesconfigurations during the run.Related Issues
N/A
How to Validate
npm test -w @google/gemini-cli-coreand verify all tests pass.retry.test.ts,googleQuotaErrors.test.ts, andflashFallback.test.tswhich mock the 499 failure condition.Pre-Merge Checklist