Skip to content

feat(node): Add v7 support for vercelAiIntegration#21613

Draft
mydea wants to merge 5 commits into
developfrom
fn/vercel-ai-v7
Draft

feat(node): Add v7 support for vercelAiIntegration#21613
mydea wants to merge 5 commits into
developfrom
fn/vercel-ai-v7

Conversation

@mydea

@mydea mydea commented Jun 17, 2026

Copy link
Copy Markdown
Member

In the latest beta release of v7 of the ai package, native tracing channel events are now emitted. This PR adds support for this and thus for instrumentation in this package.

For now, this is only implemented in node, but can also be ported to deno/bun.

A big part of this PR was making sure that the v6 tests also run for v7 to make sure this is compatible. It may need some cleanup but tests pass now.

Supersedes #21584

Comment thread packages/server-utils/src/vercel-ai/vercel-ai-dc-subscriber.ts
Comment thread packages/server-utils/src/vercel-ai/vercel-ai-dc-subscriber.ts
@mydea mydea force-pushed the fn/vercel-ai-v7 branch from ec59e1b to 21822ce Compare June 17, 2026 17:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 21822ce. Configure here.

// `@sentry/opentelemetry/tracing-channel` as the factory so spans become the active OTel
// context via `bindStore` (giving correct parent/child nesting). That factory needs the Sentry
// OTel context manager, which `initOpenTelemetry()` registers after `setupOnce`, so defer a tick.
void Promise.resolve().then(() => subscribeVercelAiTracingChannel(otelTracingChannel));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

V7 never registers Vercel processors

High Severity

With ai v7, OTel instrumentation no longer patches the package, so callWhenPatched never runs. addVercelAiProcessors is only registered when shouldForce is true at afterAllSetup. If the Modules integration does not list ai then (typical for ESM before import or when ai is missing from cwd package.json dependencies), v7 channel spans are emitted but transaction processors never run—no tool descriptions, parent token rollup, or related enrichment.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 21822ce. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.45 kB - -
@sentry/browser - with treeshaking flags 25.88 kB - -
@sentry/browser (incl. Tracing) 45.88 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.11 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.65 kB - -
@sentry/browser (incl. Tracing, Replay) 85.08 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.68 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.78 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.44 kB - -
@sentry/browser (incl. Feedback) 44.62 kB - -
@sentry/browser (incl. sendFeedback) 32.25 kB - -
@sentry/browser (incl. FeedbackAsync) 37.38 kB - -
@sentry/browser (incl. Metrics) 28.52 kB - -
@sentry/browser (incl. Logs) 28.76 kB - -
@sentry/browser (incl. Metrics & Logs) 29.45 kB - -
@sentry/react 29.25 kB - -
@sentry/react (incl. Tracing) 48.17 kB - -
@sentry/vue 32.56 kB - -
@sentry/vue (incl. Tracing) 47.74 kB - -
@sentry/svelte 27.48 kB - -
CDN Bundle 29.86 kB - -
CDN Bundle (incl. Tracing) 48.28 kB - -
CDN Bundle (incl. Logs, Metrics) 31.4 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.58 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.71 kB - -
CDN Bundle (incl. Tracing, Replay) 85.61 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.88 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.71 kB - -
CDN Bundle - uncompressed 88.8 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.04 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 93.5 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.02 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.33 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.91 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.87 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.61 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.56 kB - -
@sentry/nextjs (client) 50.58 kB - -
@sentry/sveltekit (client) 46.27 kB - -
@sentry/core/server 76.14 kB - -
@sentry/core/browser 63.29 kB - -
@sentry/node-core 61.84 kB -0.01% -1 B 🔽
@sentry/node 129.93 kB +1.28% +1.64 kB 🔺
@sentry/node - without tracing 74.22 kB -0.01% -1 B 🔽
@sentry/aws-serverless 85.47 kB - -
@sentry/cloudflare (withSentry) - minified 174.48 kB - -
@sentry/cloudflare (withSentry) 436.52 kB - -

View base workflow run

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