[PR #13502] fix: retry on timeout errors instead of failing #14691

Open
opened 2026-02-16 18:19:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13502

State: open
Merged: No


Fixes #13138

Problem

When provider requests timeout (default 5 min), AbortSignal.timeout() throws a DOMException with name: 'TimeoutError'. This error was not handled in fromError(), causing it to fall through to Unknown error type which is not retryable. Sessions stopped immediately instead of retrying.

Solution

Handle TimeoutError DOMException in fromError() and convert it to APIError with isRetryable: true. This enables automatic retry with exponential backoff via the existing retry mechanism.

Testing

Verified the fix handles timeout errors correctly. The session will now retry on provider timeouts instead of failing immediately.


Related issues/PRs (not duplicates):

  • #7929 - AbortSignal.timeout is not a function (missing API on Windows/web)
  • #12762 - Bash tool timeout config being ignored
  • #8633 / #8630 - MCP timeout configuration
  • #13189 - Model fallback with TTFT-based timeout
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13502 **State:** open **Merged:** No --- Fixes #13138 ## Problem When provider requests timeout (default 5 min), `AbortSignal.timeout()` throws a `DOMException` with `name: 'TimeoutError'`. This error was not handled in `fromError()`, causing it to fall through to `Unknown` error type which is not retryable. Sessions stopped immediately instead of retrying. ## Solution Handle `TimeoutError` DOMException in `fromError()` and convert it to `APIError` with `isRetryable: true`. This enables automatic retry with exponential backoff via the existing retry mechanism. ## Testing Verified the fix handles timeout errors correctly. The session will now retry on provider timeouts instead of failing immediately. --- **Related issues/PRs (not duplicates):** - #7929 - `AbortSignal.timeout is not a function` (missing API on Windows/web) - #12762 - Bash tool timeout config being ignored - #8633 / #8630 - MCP timeout configuration - #13189 - Model fallback with TTFT-based timeout
yindo added the pull-request label 2026-02-16 18:19:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14691