fakecloud icon indicating copy to clipboard operation
fakecloud copied to clipboard

Bedrock: ConverseStream emits contentBlockDelta events with no content

Open fivejjs opened this issue 1 month ago • 1 comments

Summary

bedrock-runtime.ConverseStore (via converse_stream) returns the right event sequence but no content: contentBlockDelta events carry no delta, so collected text is ''. The non-streaming converse for the same model and configured response rule returns the text correctly.

Observed on fakecloud 0.51.0 (linux-amd64 release binary, SHA-256 verified). Response rules were installed with fc.bedrock.set_response_rules(...).

Reproduction

  1. Install a response rule for the model.
  2. Call converse with the matching prompt: Expected/actual: returns the configured text (works).
  3. Call converse_stream with the same prompt:
resp = client.converse_stream(modelId=..., messages=[{"role":"user","content":[{"text": prompt}]}])
events = list(resp["stream"])   # -> 6 events

Observed events:

{"messageStart": {}}
{"contentBlockStart": {}}
{"contentBlockDelta": {}}      # <- no delta/content
{"contentBlockStop": {}}
{"messageStop": {}}
{"metadata": {}}

Collected contentBlockDelta[*].delta.text is empty, so a streaming consumer stores an empty answer.

Impact

Any consumer that streams model output gets nothing while the same call non-streamed works, which is easy to miss (the call itself succeeds). We work around it by falling back to a non-streaming completion when the transport is the emulator; the defect should still be fixed for anyone using streaming.

fivejjs avatar Nov 04 '26 12:11 fivejjs

Fixed in #2782. Event stream payloads are no longer wrapped in the event name: the type is carried in the :event-type header and the payload holds the event's members, so boto3 and the Rust SDK decode the deltas. The shapes were checked against real Bedrock (ConverseStream and InvokeFlow with trace). One difference from the event list in the report: real Bedrock sends no contentBlockStart for text blocks, so fakecloud doesn't either. Thanks for the detailed report.

vieiralucas avatar Nov 10 '26 04:11 vieiralucas