Skip to content

fix: time out stalled streams - #227

Merged
NianJiuZst merged 1 commit into
mainfrom
codex/stream-idle-timeout
Aug 10, 2026
Merged

fix: time out stalled streams#227
NianJiuZst merged 1 commit into
mainfrom
codex/stream-idle-timeout

Conversation

@victor0602

@victor0602 victor0602 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Apply a timeout while waiting for streaming response headers.
  • Add a resettable idle timeout between response body chunks.
  • Abort and cancel the underlying reader when a stream stalls or its consumer cancels.
  • Allow active streams to continue beyond a single timeout interval.

Why

Streaming requests previously removed the timeout signal entirely and could hang forever when a server stopped sending data.

Impact

Stalled streams now fail predictably and release their resources, while healthy long-running streams continue normally.

Checks

  • bun test — 453 passed
  • bun run typecheck
  • bun run lint — no errors; one pre-existing test warning
  • git diff --check

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@victor0602
victor0602 marked this pull request as ready for review August 5, 2026 12:11

@NianJiuZst NianJiuZst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings on the current head. The header timeout, resettable body-idle timeout, and consumer-cancellation propagation are internally consistent, and I recommend merging this PR on its present base.

Verified locally: typecheck, lint (one pre-existing warning), build, 22 focused HTTP/stream tests, and the full suite (453/453). This is source/mock proof; I did not run a live long-lived provider stream. If another src/client/http.ts PR lands first, this should be rebased and the combined behavior re-tested.

@NianJiuZst
NianJiuZst merged commit 3670141 into main Aug 10, 2026
5 checks passed
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