Files
floci/docs
david lee 4204ee2ea5 fix(bedrock-runtime): return errors when upstream error bodies stall (#5527)
* fix(bedrock-runtime): cancel abandoned calls and bound stalled error bodies

Close the upstream request when the caller disconnects, including a
stream stalled between tokens, and read streaming error bodies under a
one-second deadline so a backend that stalls mid-error still returns
ModelErrorException. Warnings keep the upstream status but omit the
response body.

* fix(bedrock-runtime): bound stalled error bodies on non-streaming converse

Non-streaming Converse read the upstream body with ofString, so an error
status followed by a stalled body hung until the caller gave up: the
request timeout stops at the headers. Both Converse paths now share one
send step that reads error bodies under the collection deadline.

The deadline is configurable (error-body-timeout-millis, default 1000) so
the tests run against a short one, and the raw-socket upstream fixture is
shared between the cancellation and logging tests.

* fix(bedrock-runtime): declare the error-body timeout in application.yml

* fix(bedrock-runtime): schedule the error-body cut instead of polling for it

The cancellation poll checked the deadline every 100 ms, so a stalled
error body was cut 100 to 200 ms after it started. A timer armed when
the error status arrives cuts it exactly, and the poll goes back to
watching only for a caller disconnect. The test deadline drops to 10 ms.

* fix(bedrock-runtime): validate the error-body timeout and tighten its tests

Refuse a non-positive error-body-timeout-millis at startup, list the
setting in the configuration table, and restore the non-streaming
"Proxy request interrupted." wording.

The complete-error-body tests now send headers and body in one write
through StallingUpstream, so the 10 ms test deadline cannot race them,
and the 8 KiB test asserts that the read ended at the cap rather than
at the deadline. A shared ConverseRequests helper replaces the three
hand-built Converse requests.
2026-10-18 14:50:09 -04:00
..
2026-03-15 17:43:56 -05:00