fix(bedrock): preserve reasoningContent in normalized responses - #21202
Merged
Conversation
Contributor
🔎 Lint report:
|
This was referenced Aug 1, 2026
7 tasks
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.
Salvage of #20366 onto current main (172 commits stale).
Bedrock thinking text now survives normalization on both raw
converse()and streamingconverse_stream()paths. Previouslyagent/bedrock_adapter.py:normalize_converse_response()didn't handlereasoningContentblocks, and the stream path only forwarded reasoning to the callback — nothing persisted onto the assistant message. The transport layer (agent/transports/bedrock.py:108) already readsmsg.reasoning_content, so the field just arrived empty andNormalizedResponse.reasoningwas alwaysNoneeven on Claude 4.6+ thinking output.Changes
agent/bedrock_adapter.py: collectreasoningContent.textblocks in bothnormalize_converse_response()andstream_converse_with_callbacks(), attach asreasoning_contenton the assistant SimpleNamespace.tests/agent/test_bedrock_adapter.py: assert streamed reasoning persists on the normalized message, not only via callback.tests/agent/transports/test_bedrock_transport.py: regression coverage for raw Converse withreasoningContent.Validation
NormalizedResponse.reasoningon Bedrock thinking outputtests/agent/test_bedrock_adapter.py+tests/agent/transports/test_bedrock_transport.pyAuthored-by: @molvikar via cherry-pick, no follow-up fixes needed.
Closes #20366