Skip to content

fix(server-utils): Keep pi-durable 1.6 runs from faulting - #26718

Merged
andreiborza merged 2 commits into
developfrom
fix/pi-durable-runtime-identity
Nov 23, 2026
Merged

andreiborza merged 2 commits into
developfrom
fix/pi-durable-runtime-identity

Conversation

@sergical

Copy link
Copy Markdown
Member

What

Agent runs on @earendil-works/pi-durable 1.6.0 work again with piDurableIntegration. With SDK 11.16.0, every run ended as unanswered before its first model request:

{"status":"unanswered","reason":"faulted","detail":"Cannot read properties of undefined (reading 'add')"}

Why

pi-durable 1.6.0 finds the state it keeps for a task runtime (provider sessions, the close signal) by the runtime object. The integration gave task phases a Proxy of the runtime, so those lookups returned undefined. The phases now get the runtime itself, with commit and agent replaced on it while the phase runs.

Both are put back when the phase ends. Without that, scenario-retention fails: pi-durable keeps the runtime after the phase, and the runtime would keep the run and its spans alive.

The integration tests use pi-durable 1.4.0 and still pass. I checked 1.6.0 by hand with this build: a run with tool calls completes and is traced. In CI, the test:build-latest variant of node-pi-durable covers 1.6.0.

pi-durable 1.6.0 finds the state it keeps for a task runtime by the runtime object. The integration handed task phases a Proxy of the runtime, so every run faulted before its first model request. The phases now get the runtime itself, with `commit` and `agent` replaced on it for the time of the phase.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sergical sergical self-assigned this Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 15dd93f (PR test merge using develop at 3950f4a)

Against: 3950f4a (develop) · base run #67492

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

Path Size % Change Change
@sentry/browser 30.26 kB - -
@sentry/browser - with treeshaking flags 28.45 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.33 kB - -
@sentry/browser (incl. Tracing) 52.9 kB - -
@sentry/browser (incl. Tracing Core) 40.32 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.9 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.77 kB - -
@sentry/browser (incl. Tracing, Replay) 92.95 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.78 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.3 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.88 kB - -
@sentry/browser (incl. Feedback) 48.2 kB - -
@sentry/browser (incl. sendFeedback) 30.84 kB - -
@sentry/browser (incl. FeedbackAsync) 35.87 kB - -
@sentry/browser (incl. Metrics) 31.58 kB - -
@sentry/browser (incl. Logs) 31.86 kB - -
@sentry/browser (incl. Metrics & Logs) 32.52 kB - -
@sentry/react 32.27 kB - -
@sentry/react (incl. Tracing) 55.49 kB - -
@sentry/vue 38.45 kB - -
@sentry/vue (incl. Tracing) 55.82 kB - -
@sentry/svelte 30.27 kB - -
@sentry/effect (client) 301.05 kB - -
@sentry/effect (client, incl. Tracing) 308.22 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 311.08 kB - -
@sentry/remix (Remix 3 client bundle) 58.52 kB - -
CDN Bundle 32.19 kB - -
CDN Bundle (incl. Tracing) 53.28 kB - -
CDN Bundle (incl. Logs, Metrics) 34.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.84 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.05 kB - -
CDN Bundle (incl. Tracing, Replay) 91.2 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.17 kB - -
CDN Bundle - uncompressed 93.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.52 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.32 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 165.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.55 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.79 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.72 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.34 kB - -
@sentry/nextjs (client) 59.26 kB - -
@sentry/sveltekit (client) 54.15 kB - -
@sentry/core/server 45.75 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 155.86 kB -0.02% -27 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.46 kB - -
@sentry/node - without tracing 88.94 kB - -
@sentry/node - without channel injection 144.81 kB -0.02% -18 B 🔽
@sentry/aws-serverless 99.56 kB -0.01% -5 B 🔽
@sentry/cloudflare (withSentry) - minified 209.05 kB - -
@sentry/cloudflare (withSentry) 485.09 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 1.04 MB - -
@sentry/nextjs/cloudflare (withSentry) - minified 234.28 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 63 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-mastra (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 node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 37s Details

@sergical
sergical marked this pull request as ready for review November 21, 2026 16:47
@sergical
sergical requested a review from cleptric November 21, 2026 16:47
@andreiborza
andreiborza self-requested a review November 23, 2026 10:06

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix @sergical!

@andreiborza
andreiborza merged commit 127485c into develop Nov 23, 2026
461 of 462 checks passed
@andreiborza
andreiborza deleted the fix/pi-durable-runtime-identity branch November 23, 2026 10:31
andreiborza added a commit that referenced this pull request Nov 23, 2026
…26719)

## What

`piDurableIntegration` now traces the tool calls that a tool makes with
`api.executeTool()`. Each one gets a `gen_ai.execute_tool` span under
the span of the calling tool, with its arguments and result.

This is what a pi-durable code mode script does. Until now a script was
one `execute_tool codemode` span, and the calls inside it did not appear
in the trace.

## Why

pi-durable resolves a model-issued call among `agent.tools` and a nested
call among `agent.callable` (since 1.2.0). The integration wrapped only
`agent.tools`.

A nested call is a `pi.tool` task of its own, so its span would
otherwise sit next to the calling tool under the run. It gives its
result to the calling tool and commits no result entry, so the span
records what `execute()` returned.

Checked with pi-durable 1.6.0 code mode: one run with 4 scripts shows 21
nested tool spans, each under its script and with its result.

Stacked on #26718, which touches the same lines.

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Andrei Borza <andrei.borza@sentry.io>
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