feat(core)!: Remove enableTruncation flag and all AI integrations truncation logic - #23045
Merged
Conversation
Remove genai text truncation: - Removes the `enableTruncation` integration option and all gen_ai text-truncation logic (`messageTruncation.ts`); byte-limit cropping and "keep only the last message" are gone now that gen_ai spans always use the v2 span path. - Keeps inline media stripping and makes it unconditional, so this is now being applied to both transaction and span streaming paths. - All input messages are now recorded in full (media stripped), stripping is consolidated into `mediaStripping.ts`. - Covers both `@sentry/core` and `@sentry/server-utils`. - Removes truncation specific tests. Adds a new span streaming scenario because the span streaming path was so far only tested together with truncation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
…-text-truncation-2 # Conflicts: # dev-packages/node-integration-tests/suites/tracing/anthropic/test.ts # dev-packages/node-integration-tests/suites/tracing/langchain/v1/test.ts # dev-packages/node-integration-tests/suites/tracing/openai/test.ts # packages/server-utils/src/ai/vercel-ai/utils.ts # packages/server-utils/src/vercel-ai/vercel-ai-dc-subscriber.ts
Media stripping was the last piece of gen_ai input processing left after truncation removal. Since gen_ai spans always use the v2 span path (not subject to transaction payload-size limits), full input messages — including inline media (base64 images, audio, files) — are now recorded verbatim. - Delete `mediaStripping.ts` and the `getGenAiMessagesJsonString` helper; call sites now use `stringify` from `@sentry/core` directly. - Collapse langchain's `normalizeContent` into `stringify` now that it no longer strips media. - Remove media-stripping unit tests and the anthropic/openai media scenarios; the node integration suites already assert the full output format. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
enableTruncation flag and gen_ai text truncationenableTruncation flag and all AI integrations truncation logic
The per-suite span-streaming tests existed only to prove input messages were recorded in full (not truncated) — firing 50k-char payloads. With no message-modifying logic left in the SDK, that assertion is redundant. Reuse each suite's basic scenario against `instrument-streaming.mjs` and assert the same core span attributes as the static-lifecycle base tests, so the `traceLifecycle: 'stream'` path stays covered without the truncation framing or giant payloads. Delete the now-unused `scenario-span-streaming.mjs` files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…reaming `instrument-streaming.mjs` configures `traceLifecycle: 'stream'` (span streaming), which is easily confused with the `scenario-stream*` files that exercise streaming *responses* — a different concept. Rename to `instrument-span-streaming.mjs` to disambiguate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 29afb51. Configure here.
…ale comments With no message-truncation logic left in the SDK, tests that assert "we keep the full message" or use giant payloads to prove non-truncation exercise behavior that no longer exists. - Remove the duplicate "keeps all messages including inline media" test (same code path as the plain serialization test). - Reword the 200k-char "without truncation" anthropic test to a basic input messages check, drop the "non-array input" case (pure `stringify`, covered in core), and make the empty-array test self-contained. - Fix stale comments/JSDoc that still referenced truncation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ests
The span-streaming tests reuse the basic scenarios, which also emit event
envelopes (error-model exceptions, captureMessage). The tests only assert on a
span envelope and don't ignore events, so under the ordered envelope matcher an
event arriving before the span would fail the test — it passed only because the
streamed span happened to match first. Add `.ignore('event')` so the outcome no
longer depends on envelope timing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
nicohrubec
marked this pull request as ready for review
August 6, 2026 10:57
nicohrubec
requested review from
JPeer264,
andreiborza and
mydea
and removed request for
a team and
mydea
August 6, 2026 10:57
…ests `addRequestAttributes` no longer takes the `enableTruncation` parameter, but six call sites in the workers-ai utils test still passed a trailing `false`. JS ignores the extra arg so the tests passed, but they were stale — remove it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chargome
approved these changes
Aug 6, 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.



This PR removes the
enableTruncationflag and all related truncation logic for the AI integrations, including image and text truncation, as well as cleans out any truncation integration tests.