fix(core): add retry logic for transient SSL/TLS errors (#17318)#18310
fix(core): add retry logic for transient SSL/TLS errors (#17318)#18310sehoon38 merged 3 commits intogoogle-gemini:mainfrom
Conversation
…i#17318) Add automatic retry for transient SSL errors like ERR_SSL_SSLV3_ALERT_BAD_RECORD_MAC that can occur during long sessions, preventing unnecessary crashes. Changes: - Add SSL error codes to RETRYABLE_NETWORK_CODES list - Improve error code extraction to traverse nested cause chains - Allow retry of retryable errors during connection phase - Add comprehensive tests for SSL error scenarios
Summary of ChangesHello @ppgranger, 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 robustness of the core CLI by implementing automatic retry logic for transient SSL/TLS and network errors. Previously, such errors would cause the application to crash, requiring manual restarts. With these changes, the system can now gracefully recover from temporary network instabilities, particularly during long-running sessions, by automatically retrying failed operations. 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 robust retry logic for transient SSL/TLS errors, preventing unnecessary crashes during long-lived CLI sessions. The changes are well-implemented by expanding the list of retryable network codes and improving error inspection to traverse nested cause chains. The core chat logic is correctly modified to trigger retries for these errors even during the initial connection phase. The accompanying tests are comprehensive, covering various SSL error scenarios, including connection-phase failures and deeply nested error objects. Overall, this is an excellent contribution that significantly improves the resilience of the application.
sehoon38
left a comment
There was a problem hiding this comment.
just a minor nit, lgtm overall. thanks for the contribution!
|
@sehoon38 Ready to merge :). |
Summary
Add automatic retry for transient SSL errors like
ERR_SSL_SSLV3_ALERT_BAD_RECORD_MACthat can occur during long sessions, preventing unnecessary crashes.Previously, a transient SSL error would crash the entire CLI, forcing users to manually restart their session even though a simple retry would succeed
immediately.
Details
Changes
Add SSL error codes to
RETRYABLE_NETWORK_CODES(retry.ts):ERR_SSL_SSLV3_ALERT_BAD_RECORD_MACERR_SSL_WRONG_VERSION_NUMBERERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MACERR_SSL_BAD_RECORD_MACEPROTO(generic protocol error)Improve error code extraction (
retry.ts):causechains up to 5 levels deepAllow retry during connection phase (
geminiChat.ts):Test Coverage
Added 9 new tests covering:
Related Issues
Fixes #17318
How to Validate
npm run build && npm run lint
Pre-Merge Checklist