Honor caller http_opts (recv_timeout) on the streaming path - #80
Closed
rvasyl wants to merge 1 commit into
Closed
Conversation
The streaming path (`EventStream.stream_objects!/3`) called hackney with a
hard-coded `@hackney_options` and discarded the `config[:http_opts]` the caller
passes (the non-streaming path forwards these via ExAws.Request). As a result
streaming always used hackney's default `recv_timeout` (5s) — an idle/first-byte
timeout — so a slow model response was dropped with `{:closed, :timeout}` in the
initial receive regardless of the timeout the caller configured, yielding an
empty stream.
Merge caller `:http_opts` (recv_timeout/connect_timeout/pool) into the hackney
options via a testable `hackney_options/1`; async-streaming defaults win so
`async: :once` can't be disabled by caller opts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rvasyl
force-pushed
the
fix/stream-recv-timeout
branch
from
July 10, 2026 10:34
74bb893 to
3040dd7
Compare
rvasyl
marked this pull request as draft
July 10, 2026 11:54
Author
|
To be verified first. |
Author
|
Superseded by #81 |
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.
Problem
EventStream.stream_objects!/3calls hackney with a hard-coded@hackney_options([async: :once]) and discards theconfig[:http_opts]the caller passes. The non-streaming path forwards these throughExAws.Request, but the streaming path never did.As a result, streaming always uses hackney's built-in default
recv_timeout(5s). Becauserecv_timeoutis an idle / first-byte timeout, a slow model response gets dropped with{:closed, :timeout}in the initialreceive— regardless of the timeout the caller configured — surfacing as an empty stream even though the caller set a generousrecv_timeout.Fix
Merge caller
:http_opts(recv_timeout,connect_timeout,pool, …) into the hackney options via a small, testablehackney_options/1. The async-streaming defaults win on conflicting keys, soasync: :oncecan't be accidentally disabled by caller options.Tests
Adds a
hackney_options/1describe block covering::http_optsare given,recv_timeout/connect_timeout/poolbeing honored,async: :oncecan't be overridden.mix test test/ex_aws/bedrock/event_stream_test.exs→ 8 tests, 0 failures.For context, this was previously opened against a fork (holsee#1); this PR targets the upstream library. I confirmed the issue is not already fixed on
main(latest EventStream change was #79, hackney v4 support).🤖 Generated with Claude Code