fix(bedrock): preserve reasoningContent in normalized responses - #20366
Closed
molvikar wants to merge 1 commit into
Closed
fix(bedrock): preserve reasoningContent in normalized responses#20366molvikar wants to merge 1 commit into
molvikar wants to merge 1 commit into
Conversation
This was referenced Aug 1, 2026
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.
What does this PR do?
Preserves Bedrock
reasoningContentwhen normalizing Converse responses.Before this change, Bedrock thinking text could appear in the streaming callback path, but it was dropped from the normalized assistant message shape. That caused downstream transport normalization to produce
NormalizedResponse.reasoning=Noneeven when Bedrock had returned reasoning content.This change fixes both paths:
converse()responses now collectreasoningContentblocks into the normalized message.converse_stream()responses now persist reasoning text onto the normalized message instead of only forwarding it to the callback.As a result, Bedrock reasoning now survives normalization consistently across raw and streaming flows.
Related Issue
Fixes #
Type of Change
Changes Made
Updated
agent/bedrock_adapter.pyPreserved
reasoningContentblocks innormalize_converse_response()Preserved streamed reasoning deltas in
stream_converse_with_callbacks()Attached normalized reasoning onto the assistant message as
reasoning_contentUpdated
tests/agent/test_bedrock_adapter.pyAdded an assertion that streamed reasoning is persisted on the normalized message, not only emitted via callback
Updated
tests/agent/transports/test_bedrock_transport.pyAdded regression coverage for raw Converse responses containing
reasoningContentHow to Test