feat: Default requests to a 30 second timeout - #951
Merged
Conversation
This was referenced Aug 6, 2026
razor-x
force-pushed
the
claude/sdk-default-http-timeout-33qknd
branch
from
August 11, 2026 17:11
835a160 to
1302c62
Compare
Requests had no timeout, so a hung connection blocked the caller indefinitely. Axios defaults `timeout` to 0, which means no timeout at all, and the SDK never set it. Set the Axios `timeout` to 30 seconds, matching the API's own request timeout, and add a `timeout` option so callers can raise, lower, or disable it. Passing `timeout` through `axiosOptions` still wins, keeping the existing escape hatch authoritative. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMgDauUA2R9u2THCHmMgv1
razor-x
force-pushed
the
claude/sdk-default-http-timeout-33qknd
branch
from
August 11, 2026 17:20
1302c62 to
bf851e0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of a four-SDK change adding a default HTTP timeout (ruby, python, csharp).
Problem
Requests had no timeout, so a hung connection blocked the caller indefinitely. Axios defaults
timeoutto0, which means no timeout at all, and the SDK never set it.Changes
timeoutto 30 seconds by default, matching the API's own request timeout.timeoutoption, in milliseconds, so callers can raise, lower, or disable it.axiosOptions.timeoutstill wins over thetimeoutoption.Set
timeoutto0to disable it. A request that times out rejects with an AxiosETIMEDOUTerror and is retried according to the retry options.Note that the code is
ETIMEDOUTrather than the more familiarECONNABORTEDbecause this SDK pinsadapter: 'fetch', and the fetch adapter raises timeouts throughcomposeSignals. The XHR and http adapters would reportECONNABORTED.Behavior change
Requests that previously ran longer than 30 seconds will now fail with
ETIMEDOUTinstead of hanging. Thetimeoutoption is the opt-out.Testing
test/seam/connect/timeout.test.tscovers the default, thetimeoutoption,axiosOptionsprecedence, and a request that actually aborts.Note for reviewers
Retries multiply the timeout. With the default of 2 retries, a fully hung endpoint is now bounded at roughly 90 seconds rather than forever. Retry behavior is otherwise untouched here.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XMgDauUA2R9u2THCHmMgv1