Skip to content

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

Open
razor-x wants to merge 1 commit into
mainfrom
claude/sdk-default-http-timeout-33qknd
Open

feat: Default requests to a 30 second timeout#951
razor-x wants to merge 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 ECONNABORTED error and is retried according to the retry options.

Behavior change

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

Testing

npm run typecheck and Prettier are clean. I was not able to run ava in my environment — the fixtures/* path mapping fails inside ava's worker threads there, identically on unmodified tests, so it is environmental rather than caused by this change. The four tests in test/seam/connect/timeout.test.ts are unverified and CI is their first real run.

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

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 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
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