feat(core): increase fetch timeout and fix [object Object] error stringification#20441
feat(core): increase fetch timeout and fix [object Object] error stringification#20441
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 enhances the robustness and user experience of the core library by addressing common issues related to network timeouts and error message clarity. It significantly increases the default fetch timeout for API requests to better accommodate high-latency models, reducing 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 increases the fetch timeout to 60 seconds and improves error message stringification, which are valuable changes. However, the introduction of specific logic to treat HTTP 499 errors as retryable, particularly by misclassifying them as a RetryableQuotaError, raises concerns. I've left a comment suggesting a re-evaluation of the necessity of specific 499 handling given existing generic retry mechanisms, and if necessary, to ensure proper classification and separation of concerns.
|
Size Change: +684 B (0%) Total Size: 25.7 MB ℹ️ View Unchanged
|
| import { Agent, ProxyAgent, setGlobalDispatcher } from 'undici'; | ||
|
|
||
| const DEFAULT_HEADERS_TIMEOUT = 60000; // 60 seconds | ||
| const DEFAULT_BODY_TIMEOUT = 300000; // 5 minutes |
There was a problem hiding this comment.
nit: might comment that the body timeout is actually unchanged from the default or consider raising it.

Summary
Addresses
HeadersTimeoutError(UND_ERR_HEADERS_TIMEOUT) frequently seen with high-latency Gemini 3.0/3.1 Pro models by increasing the default fetch timeout to 60 seconds. Also improves error stringification to prevent[object Object]display for certain non-standard error objects.Details
timeout: 60000to allCodeAssistServerPOST and streaming requests inpackages/core/src/code_assist/server.ts.timeout: 60000toGoogleGenAIinitialization inpackages/core/src/core/contentGenerator.ts.getErrorMessageinpackages/core/src/utils/errors.tsto check for a.messageproperty on non-Error objects before falling back toString(). This ensuresundicitimeout errors are human-readable.packages/core/src/utils/errors_timeout.test.tsto verify the fix forHeadersTimeoutErrorstringification.packages/core/src/code_assist/server.test.tsto reflect the new timeout property in request expectations.Related Issues
N/A
How to Validate
npm test -w @google/gemini-cli-coreand verify all tests pass.errors_timeout.test.tswhich demonstrates the fix for[object Object]error messages.Pre-Merge Checklist