Skip to content

fix: preserve Bedrock streaming errors - #15

Merged
ElliotEtag merged 7 commits into
mainfrom
codex/bedrock-stream-errors
Oct 24, 2026
Merged

ElliotEtag merged 7 commits into
mainfrom
codex/bedrock-stream-errors

Conversation

@ElliotEtag

@ElliotEtag ElliotEtag commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

  • Fix Nova/Bedrock stream errors being replaced with an empty assistant stop, which showed up as misleading usage_missing failures. The client now gets the provider's error in the existing Bedrock error envelope.
  • Read each AWS frame length from the buffered bytes, so frames split across network chunks parse correctly. The duplicate end-of-stream loop is removed; it could never yield a complete frame.
  • Run the stream tests in CI (npm run test:streams).

Evidence

  • 12 stream tests and 15 parameter tests pass locally and in CI. On unchanged main, the captured Nova error test and the split-frame test fail; the healthy-usage test passes on both.

  • Local Gen → local gateway, streaming through Bedrock (every chunk reports "provider":"bedrock"). Each charge equals Gen's totalPrice:

    Model Request Result Charged
    nova-2-lite Healthy ok + usage, one [DONE] 0.00003146
    nova-2-lite Identical replay cache hit, same output 0
    nova-2-lite Invalid image in-stream bedrock error: … MIME type text/plain is not supported … 0
    claude-haiku-4.5 Healthy ok + usage 0.000043
    claude-haiku-4.5 Identical replay cache hit 0
    claude-haiku-4.5 60 numbers in words 29 events, 195 output tokens, full text 0.001007
    claude-haiku-4.5 Forced tool call get_weather {"city": "Tallinn"}, tool_calls 0.00085
    claude-haiku-4.5 Invalid image rejected before streaming (HTTP 400, unchanged path) 0
  • Build and startup smoke test pass. TypeScript still has its 11 existing errors, none in changed files.

Merge risk

  • Shared Bedrock stream path; reverts cleanly. No deployment or production pin change.
  • The client still gets HTTP 200 with the error event. HTTP classification and production error-rate improvement are not claimed.

@ElliotEtag
ElliotEtag marked this pull request as ready for review October 24, 2026 18:31
@ElliotEtag
ElliotEtag merged commit 6628f64 into main Oct 24, 2026
4 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.

1 participant