Skip to content

feat: Remove truncation when stream_gen_ai_spans is enabled#6260

Merged
alexander-alderman-webb merged 95 commits into
masterfrom
webb/remove-truncation
May 13, 2026
Merged

feat: Remove truncation when stream_gen_ai_spans is enabled#6260
alexander-alderman-webb merged 95 commits into
masterfrom
webb/remove-truncation

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented May 12, 2026

Note: Depends on #6079

Description

Remove message popping and binary blob redaction when the stream_gen_ai_spans option is enabled.

Stop parametrizing truncation tests that fail when the stream_gen_ai_spans option is enabled.

Issues

Reminders

Comment thread tests/integrations/langgraph/test_langgraph.py
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Two things:

  1. Does message truncation exclusively affect gen_ai spans currently? In other words, is it guaranteed that all spans that will become very large because of this change will be sent as v2 spans, or do we need an extra check to only lift the truncation for gen_ai spans specifically?
  2. If we remove the parametrization from the truncation tests, will we have test coverage for the "stream_gen_ai_spans=True should not truncate messages" code path?

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor Author

  1. That's a possible edge case, and since it's unexpected for truncate_and_annotate_messages to not truncate in some cases, I moved the logic to the call sites in the integrations: 4ec3ff7
  2. By removing the parametrization we do not assert that there is no truncation when stream_gen_ai_spans=True. I don't have strong feelings here, and removed the parametrization because I try to avoid having to many tests that assert the absence of something 🤷 . Happy to parametrize the tests again as well.

@sentrivana
Copy link
Copy Markdown
Contributor

2. By removing the parametrization we _do not_ assert that there is no truncation when `stream_gen_ai_spans=True`. I don't have strong feelings here, and removed the parametrization because I try to avoid having to many tests that assert the absence of something 🤷 . Happy to parametrize the tests again as well.

I'm fine with removing the parametrization, but we should have some test coverage for the messages being there as expected, without truncation, in the stream_gen_ai_spans=True case. If this is already tested by another existing test not touched by this PR, fine to leave as is. If not, would be good to add a new test for that specifically.

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor Author

Yes, that makes sense. I'll update other tests to accept two inputs messages and assert that both are present when the option is enabled (demonstrating that input truncation is disabled in this case).

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 962fd65. Configure here.

Comment thread tests/integrations/openai_agents/test_openai_agents.py
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Base automatically changed from webb/gen-ai-v2 to master May 13, 2026 12:28
Comment thread sentry_sdk/integrations/openai_agents/utils.py
@alexander-alderman-webb alexander-alderman-webb merged commit fcb9305 into master May 13, 2026
156 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/remove-truncation branch May 13, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants