Skip to content

feat: Default requests to a 30 second timeout - #951

Merged
razor-x merged 1 commit into
mainfrom
claude/sdk-default-http-timeout-33qknd
Aug 11, 2026
Merged

feat: Default requests to a 30 second timeout#951
razor-x merged 1 commit into
mainfrom
claude/sdk-default-http-timeout-33qknd

Conversation

@razor-x

@razor-x razor-x commented Aug 6, 2026

Copy link
Copy Markdown
Member

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 timeout to 0, which means no timeout at all, and the SDK never set it.

Changes

  • Set the Axios timeout to 30 seconds by default, matching the API's own request timeout.
  • Add a timeout option, in milliseconds, so callers can raise, lower, or disable it.
  • Precedence keeps the low-level escape hatch authoritative: axiosOptions.timeout still wins over the timeout option.
const seam = new SeamHttp({ apiKey: 'your-api-key', timeout: 60000 })

Set timeout to 0 to disable it. A request that times out rejects with an Axios ETIMEDOUT error and is retried according to the retry options.

Note that the code is ETIMEDOUT rather than the more familiar ECONNABORTED because this SDK pins adapter: 'fetch', and the fetch adapter raises timeouts through composeSignals. The XHR and http adapters would report ECONNABORTED.

Behavior change

Requests that previously ran longer than 30 seconds will now fail with ETIMEDOUT instead of hanging. The timeout option is the opt-out.

Testing

test/seam/connect/timeout.test.ts covers the default, the timeout option, axiosOptions precedence, 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

@razor-x
razor-x requested a review from a team as a code owner August 6, 2026 16:05
@razor-x razor-x changed the title feat: default requests to a 30 second timeout feat: Default requests to a 30 second timeout Aug 6, 2026
@razor-x
razor-x force-pushed the claude/sdk-default-http-timeout-33qknd branch from 835a160 to 1302c62 Compare August 11, 2026 17:11
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
razor-x force-pushed the claude/sdk-default-http-timeout-33qknd branch from 1302c62 to bf851e0 Compare August 11, 2026 17:20
@razor-x
razor-x merged commit e6336d1 into main Aug 11, 2026
16 checks passed
@razor-x
razor-x deleted the claude/sdk-default-http-timeout-33qknd branch August 11, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants