Bedrock: ConverseStream emits contentBlockDelta events with no content
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
- Install a response rule for the model.
- Call
conversewith the matching prompt: Expected/actual: returns the configured text (works). - Call
converse_streamwith 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.
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.