Skip to content

fix: add 30s timeout to all fetch requests to prevent CLI stalls#231

Draft
bukinoshita wants to merge 1 commit intomainfrom
fix/fetch-timeout-2e44
Draft

fix: add 30s timeout to all fetch requests to prevent CLI stalls#231
bukinoshita wants to merge 1 commit intomainfrom
fix/fetch-timeout-2e44

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Add a 30s timeout to all CLI HTTP requests so the CLI fails fast instead of hanging on network or Resend API stalls. Addresses Linear BU-666.

  • Bug Fixes
    • Wraps globalThis.fetch with a 30s AbortSignal.timeout for every request.
    • Preserves caller signals using AbortSignal.any (shortest timeout wins).
    • Imports the wrapper in src/cli.ts to cover all SDK and direct requests.
    • Adds tests for timeout behavior, signal composition, and option forwarding.

Written for commit ec56b41. Summary will update on new commits.

Introduces src/lib/fetch-timeout.ts, a side-effect module that wraps
globalThis.fetch with a 30-second AbortSignal.timeout. The wrapper
preserves any caller-provided signal using AbortSignal.any, ensuring
existing timeout-bounded calls (e.g. update-check, doctor GitHub fetch)
continue to work correctly.

The module is imported at the top of src/cli.ts so every outbound HTTP
request — including Resend SDK calls routed through withSpinner — fails
fast instead of blocking indefinitely on a stalled network path.

Fixes BU-666

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
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