-
Notifications
You must be signed in to change notification settings - Fork 1
Add automatic retry for timeout errors with configurable intervals #143
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
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #142
This reverts commit 424c33d.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-30T17:59:25.788Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Document the root cause analysis of why timeout errors are not retried, including error propagation path through AI SDK and the agent's error handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Detect DOMException TimeoutError (from AbortSignal.timeout()) and generic timeout errors, creating a retryable TimeoutError that triggers automatic retry with configurable delays (30s, 60s, 120s for up to 3 attempts). Previously, timeout errors fell through to NamedError.Unknown and were not retried, causing immediate session failure on transient network issues. Fixes #142 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The operation timed out, not fail immediatelyCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Fixes #142
Adds automatic retry when API requests time out with
"The operation timed out."error, instead of failing immediately. Uses configurable retry intervals of 30s, 60s, and 120s (3 retries max).Root Cause
The
"The operation timed out."error is aDOMExceptionwithname === 'TimeoutError', generated byAbortSignal.timeout(). The AI SDK'shandleFetchError()re-throws this error as-is (not wrapped inAPICallError), so it bypasses the existing retry logic and creates an unretryableNamedError.Unknown.Changes
js/src/session/message-v2.ts: AddedTimeoutErrorerror type; detectDOMExceptionwithname === 'TimeoutError'and generic timeout errors infromError()js/src/session/retry.ts: Added timeout-specific retry configuration: 3 retries with 30s, 60s, 120s delaysjs/src/session/processor.ts: Added retry handling forTimeoutErroralongside existingAPIErrorandSocketConnectionErrorretry pathsjs/tests/timeout-retry.test.js: 16 tests covering timeout error detection, retry configuration, and delay calculationdocs/case-studies/issue-142/: Case study with root cause analysis and original error logRetryable errors now handled
APIError(isRetryable)SocketConnectionErrorTimeoutError(NEW)AbortSignal.timeout()Test Results
All 29 retry-related tests pass (16 new + 13 existing socket-retry tests). Lint passes with no warnings.