Skip to content

feat(core)!: Remove enableTruncation flag and all AI integrations truncation logic - #23045

Draft
nicohrubec wants to merge 4 commits into
developfrom
feat/remove-gen-ai-text-truncation-2
Draft

feat(core)!: Remove enableTruncation flag and all AI integrations truncation logic#23045
nicohrubec wants to merge 4 commits into
developfrom
feat/remove-gen-ai-text-truncation-2

Conversation

@nicohrubec

Copy link
Copy Markdown
Member

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.

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>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.12 kB - -
@sentry/browser - with treeshaking flags 28.32 kB - -
@sentry/browser (incl. Tracing) 47.53 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.54 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.29 kB - -
@sentry/browser (incl. Tracing, Replay) 86.91 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.33 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.6 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 104.25 kB - -
@sentry/browser (incl. Feedback) 47.45 kB - -
@sentry/browser (incl. sendFeedback) 34.96 kB - -
@sentry/browser (incl. FeedbackAsync) 40.1 kB - -
@sentry/browser (incl. Metrics) 31.2 kB - -
@sentry/browser (incl. Logs) 31.41 kB - -
@sentry/browser (incl. Metrics & Logs) 32.11 kB - -
@sentry/react 31.93 kB - -
@sentry/react (incl. Tracing) 49.79 kB - -
@sentry/vue 35.2 kB - -
@sentry/vue (incl. Tracing) 49.51 kB - -
@sentry/svelte 30.14 kB - -
CDN Bundle 32.13 kB - -
CDN Bundle (incl. Tracing) 47.81 kB - -
CDN Bundle (incl. Logs, Metrics) 33.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.19 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.02 kB - -
CDN Bundle (incl. Tracing, Replay) 85.45 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.27 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.59 kB - -
CDN Bundle - uncompressed 95.27 kB - -
CDN Bundle (incl. Tracing) - uncompressed 142.78 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.9 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 146.75 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.6 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.03 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 275.74 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 279.69 kB - -
@sentry/nextjs (client) 52.36 kB - -
@sentry/sveltekit (client) 47.99 kB - -
@sentry/core/server 65.54 kB - -
@sentry/core/browser 51.82 kB - -
@sentry/node 119.17 kB -1.06% -1.27 kB 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.09 kB - -
@sentry/aws-serverless 92.59 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 212.56 kB -2.42% -5.26 kB 🔽
@sentry/cloudflare (withSentry) 524.74 kB -2.3% -12.32 kB 🔽

View base workflow run

nicohrubec and others added 3 commits August 5, 2026 11:16
…-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>
@nicohrubec nicohrubec changed the title feat(core)!: Remove enableTruncation flag and gen_ai text truncation feat(core)!: Remove enableTruncation flag and all AI integrations truncation logic Aug 6, 2026
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.

1 participant