Skip to content

ref(server-utils): Extract pi-ai chat span helpers from pi-durable - #25932

Open
mydea wants to merge 2 commits into
developfrom
ref/pi-ai-chat-span-helpers
Open

mydea wants to merge 2 commits into
developfrom
ref/pi-ai-chat-span-helpers

Conversation

@mydea

@mydea mydea commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

This PR only moves things around in preparation for follow up work. Functionally nothing should change and it should mostly be stamp-able.

Why: Split out of #25869. The upcoming pi-ai integration creates the same gen_ai.chat span as pi-durable's models proxy does today, so the span logic moves to ai/pi-ai/ first. That way it gets reviewed once, as a move, while pi-durable still uses it. No behavior change: the pi-durable unit tests pass unmodified (only a type import moved).

How to review: ai/pi-ai/chat.ts is the body of the old traceModelRequest/endChatSpan, with the origin as a parameter. getPiAiChatSpanOptions returns the span options instead of starting the span, because pi-durable keeps the span active while the request is sent (startSpanManual), whereas a channel-based integration starts it inactive.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 6eea71c (PR test merge using develop at 446679d)

Against: 446679d (develop) · base run #64414

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.39 kB - -
@sentry/browser - with treeshaking flags 28.53 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.42 kB - -
@sentry/browser (incl. Tracing) 52.7 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.71 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.68 kB - -
@sentry/browser (incl. Tracing, Replay) 93.01 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.75 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.74 kB - -
@sentry/browser (incl. Feedback) 47.97 kB - -
@sentry/browser (incl. sendFeedback) 35.49 kB - -
@sentry/browser (incl. FeedbackAsync) 40.6 kB - -
@sentry/browser (incl. Metrics) 31.42 kB - -
@sentry/browser (incl. Logs) 31.72 kB - -
@sentry/browser (incl. Metrics & Logs) 32.44 kB - -
@sentry/react 32.27 kB - -
@sentry/react (incl. Tracing) 55.07 kB - -
@sentry/vue 38.66 kB - -
@sentry/vue (incl. Tracing) 55.72 kB - -
@sentry/svelte 30.42 kB - -
@sentry/remix (Remix 3 client bundle) 57.79 kB - -
CDN Bundle 32.18 kB - -
CDN Bundle (incl. Tracing) 53.23 kB - -
CDN Bundle (incl. Logs, Metrics) 34.45 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.17 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.86 kB - -
CDN Bundle (incl. Tracing, Replay) 91.44 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.55 kB - -
CDN Bundle - uncompressed 94.62 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.58 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.09 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.31 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.65 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 284.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.69 kB - -
@sentry/nextjs (client) 57.87 kB - -
@sentry/sveltekit (client) 53.22 kB - -
@sentry/core/server 44.24 kB - -
@sentry/core/browser 13.93 kB - -
@sentry/node 154.98 kB +0.07% +97 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.08 kB - -
@sentry/node - without tracing 96.23 kB +0.03% +23 B 🔺
@sentry/node - without channel injection 135.41 kB +0.08% +102 B 🔺
@sentry/aws-serverless 104.42 kB +0.03% +28 B 🔺
@sentry/cloudflare (withSentry) - minified 197.89 kB - -
@sentry/cloudflare (withSentry) 491.86 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 218.31 kB - -

View base workflow run

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 2 not successful, 50 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Failing after 50s Details
❌ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Failing after 2m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 18s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 16s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 19s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 26s Details

@mydea
mydea marked this pull request as ready for review October 30, 2026 10:41
@mydea
mydea requested a review from a team as a code owner October 30, 2026 10:41
@mydea
mydea requested review from andreiborza and isaacs and removed request for a team October 30, 2026 10:41
@mydea
mydea added this pull request to stack #25938 October 30, 2026 10:53
@mydea
mydea force-pushed the ref/pi-ai-chat-span-helpers branch from 5c3374d to e186d12 Compare October 30, 2026 12:53
mydea and others added 2 commits October 30, 2026 13:53
The span options and response attributes of a pi-ai request move to
`ai/pi-ai/chat.ts`, and the pi-ai structural types to `ai/pi-ai/types.ts`, so
a pi-ai integration can reuse them. pi-durable's `models` proxy uses them with
no change in behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Span attributes drop `undefined` values, so the conditional spreads are not
needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mydea
mydea force-pushed the ref/pi-ai-chat-span-helpers branch from e186d12 to 437fab0 Compare October 30, 2026 12:54

This branch has not been deployed

No deployments
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