Repository navigation
fix(bedrock): do not record an empty reasoning part for redacted Converse content - #932
Conversation
The non-streaming converse path records a redactedContent reasoning block as an empty reasoning part, but the streaming handler only read reasoningContent deltas with text, so a redacted block was missing from the output messages of a streamed call. Record it as an empty reasoning part as well.
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fix aligns streaming with existing non-streaming behavior and includes targeted regression coverage.
No open issues 🎉
What changed in this PR
Preserves redacted reasoning blocks in Bedrock Converse streaming telemetry, matching non-streaming behavior.
Changes:
- Records redacted reasoning deltas as empty reasoning parts.
- Adds a regression test and changelog entry.
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-genai-bedrock/tests/test_converse_stream.py | Tests preservation of redacted reasoning. |
| instrumentation/opentelemetry-instrumentation-genai-bedrock/src/opentelemetry/instrumentation/genai/bedrock/stream.py | Handles redacted reasoning deltas. |
| instrumentation/opentelemetry-instrumentation-genai-bedrock/.changelog/932.fixed | Documents the fix. |
Review effort: Balanced
Pull request dashboard statusWaiting on reviewers · refreshed 2026-10-21 05:39 UTC Review the latest changes. Status above doesn't look right?
|
lmolkova
left a comment
There was a problem hiding this comment.
What's the point of recording "" instead of redacted content?
I think this needs discussion / documentation in https://github.com/open-telemetry/semantic-conventions-genai to decide if/how to record redacted content and for now dropping it does not seem too different from having empty string.
|
Fair point. The change only makes the streaming path match |
thanks for the context! could you please create issue in semconv-genai repo to track it?
Sounds good! Let's do it |
|
Done. Both the streaming and the non-streaming path now skip |
A Bedrock Converse reasoning block that comes back as
redactedContentwas recorded as a reasoning part with an empty string in the non-streaming path, and was missing from the streaming path. Neither carries readable content, and recording the empty part makes the output messages look as if the model produced a blank thought.Both paths now skip a
redactedContentblock, so the recorded output messages match for streamed and non-streamed calls. How to record redacted reasoning, if at all, is tracked in the semantic conventions repository: open-telemetry/semantic-conventions-genai#616.test_extract_content_block_reasoningnow expects no part for redacted content, andtest_stream_wrapper_skips_redacted_reasoningchecks that a streamed redacted block leaves only the text part. Both fail on the previous head of this branch and pass now, the bedrock converse tests pass, andruffis clean. No request was made to Bedrock.This change was made with Claude Code.