[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[ai] Fix "missing text part" stream crash by repairing UI message framing - #2537

Merged
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422
Jun 26, 2026
Merged

[ai] Fix "missing text part" stream crash by repairing UI message framing#2537
VaguelySerious merged 3 commits into
mainfrom
peter/issue-2422

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes#2422

Problem

A workflow run owns a single shared UI message stream, and the AI SDK's stream consumer (processUIMessageStream, backing useChat/readUIMessageStream) resets its active text/reasoning part maps on every finish-step. Multi-step turns reuse the same part id (commonly "0") in each step. So if a text-start is dropped or a finish-step lands in the middle of a text part, the consumer hits a text-delta/text-end for an id it has no open part for and throws:

Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.

…which kills the whole turn.

That malformed framing is reachable whenever a stream-producing step's output is duplicated or interleaved on the shared stream — e.g. step retry/redelivery, reconnect/replay overlap, or the concurrent-worker duplication tracked in #2331 / #2039 (a finish-step from one execution landing inside another's text part).

Fix

WorkflowChatTransport now passes the stream it hands to the AI SDK through normalizeUIMessageStreamParts, which mirrors the consumer's per-step part-lifetime state machine:

  • resets tracking on finish-step (exactly where the consumer resets);
  • synthesizes a missing *-start when an orphaned *-delta/*-end arrives;
  • drops a re-delivered*-start/*-delta/*-end for a part already open/ended in the current step (reconnect/replay overlap).

It wraps the output of the send/reconnect iterators, so the reconnect chunkIndex/gotFinish accounting is untouched. A well-formed stream passes through unchanged; the worst case degrades to "text begins slightly into the step" or "a duplicated tail is dropped" instead of a dead turn. Applies to both text and reasoning parts.

This addresses the client-visible symptom for all WorkflowChatTransport consumers regardless of the upstream duplication cause. The underlying server-side duplicate-execution races (#2331, #2039) are separate and remain tracked there.

Tests

packages/ai/src/workflow-chat-transport.stream-repair.test.ts drives the real transport (mock fetch returning chunks via the AI SDK's own JsonToSseTransformStream) into the realreadUIMessageStream consumer:

  • proves the raw interleaved stream reproduces the exact missing text part error;
  • proves the transport now repairs it with no content lost ("Hello world");
  • proves a reconnect/replay duplicate tail is dropped without erroring;
  • proves a well-formed multi-step stream (id "0" reused across steps) is unchanged.

🤖 Generated with Claude Code


Ported to @ai-sdk/workflow:vercel/ai#16433

…ming
Duplicated or interleaved durable stream writes (step retry/redelivery or
concurrent-worker duplication) can land a finish-step in the middle of a text
part that reuses id "0", orphaning the rest. The AI SDK consumer then throws
`Received text-delta for missing text part with ID "0"` and kills the turn.
WorkflowChatTransport now normalizes UI message stream part framing — mirroring
the consumer's per-step part-lifetime state machine — so orphaned deltas/ends
get a synthesized start and replayed chunks are dropped. Well-formed streams
pass through unchanged.
Closes#2422
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 324559a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
❌ ▲ Vercel Production143932301672
✅ 💻 Local Development190902192128
✅ 📦 Local Production190902192128
✅ 🐘 Local Postgres189502332128
✅ 🪟 Windows15200152
✅ 📋 Other88501791064
Total8189310809272

❌ Failed Tests

▲ Vercel Production (3 failed)

nextjs-webpack (3 failed):

  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router

Details by Category

❌ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro125027
✅ example125027
✅ express125027
✅ fastify125027
✅ hono125027
✅ nextjs-turbopack14903
❌ nextjs-webpack14633
✅ nitro125027
✅ nuxt125027
✅ sveltekit14408
✅ vite125027
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable127025
✅ express-stable127025
✅ fastify-stable127025
✅ hono-stable127025
✅ nextjs-turbopack-canary133019
✅ nextjs-turbopack-stable-lazy-discovery-disabled15200
✅ nextjs-turbopack-stable-lazy-discovery-enabled15200
✅ nextjs-webpack-canary133019
✅ nextjs-webpack-stable-lazy-discovery-disabled15200
✅ nextjs-webpack-stable-lazy-discovery-enabled15200
✅ nitro-stable127025
✅ nuxt-stable127025
✅ sveltekit-stable14606
✅ vite-stable127025
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable126026
✅ express-stable126026
✅ fastify-stable126026
✅ hono-stable126026
✅ nextjs-turbopack-canary132020
✅ nextjs-turbopack-stable-lazy-discovery-disabled15101
✅ nextjs-turbopack-stable-lazy-discovery-enabled15101
✅ nextjs-webpack-canary132020
✅ nextjs-webpack-stable-lazy-discovery-disabled15101
✅ nextjs-webpack-stable-lazy-discovery-enabled15101
✅ nitro-stable126026
✅ nuxt-stable126026
✅ sveltekit-stable14507
✅ vite-stable126026
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack15200
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable127025
✅ e2e-local-dev-tanstack-start-127025
✅ e2e-local-postgres-nest-stable126026
✅ e2e-local-postgres-tanstack-start-126026
✅ e2e-local-prod-nest-stable127025
✅ e2e-local-prod-tanstack-start-127025
✅ e2e-vercel-prod-tanstack-start125027

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: success
  • Local Prod: success
  • Local Postgres: success
  • Windows: success

Check the workflow run for details.

@github-actions

github-actionsBot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.046s (+32.0% 🔺)1.006s (~)0.960s101.00x
💻 LocalExpress0.047s (-5.1% 🟢)1.006s (~)0.959s101.01x
💻 LocalNext.js (Turbopack)0.053s (+5.0%)1.006s (~)0.953s101.14x
🐘 PostgresNext.js (Turbopack)0.056s (-52.2% 🟢)1.011s (-4.0%)0.954s101.22x
🐘 PostgresNitro0.067s (-5.2% 🟢)1.012s (~)0.945s101.45x
🐘 PostgresExpress0.072s (+14.3% 🔺)1.013s (~)0.941s101.56x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.265s (-51.7% 🟢)2.225s (+9.4% 🔺)1.960s101.00x
▲ VercelExpress0.280s (+33.2% 🔺)1.983s (+32.6% 🔺)1.703s101.06x
▲ VercelNitro0.287s (+45.2% 🔺)2.128s (+24.7% 🔺)1.841s101.08x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.077s (+1.1%)2.007s (~)0.929s101.00x
💻 LocalExpress1.079s (~)2.006s (~)0.928s101.00x
💻 LocalNext.js (Turbopack)1.086s (~)2.007s (~)0.921s101.01x
🐘 PostgresNitro1.087s (-1.1%)2.010s (~)0.923s101.01x
🐘 PostgresExpress1.094s (~)2.009s (~)0.915s101.02x
🐘 PostgresNext.js (Turbopack)1.094s (+1.0%)2.009s (~)0.915s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.633s (+16.1% 🔺)3.691s (+30.3% 🔺)2.058s101.00x
▲ VercelNitro1.653s (+19.6% 🔺)3.485s (+12.1% 🔺)1.832s101.01x
▲ VercelNext.js (Turbopack)1.734s (-19.3% 🟢)3.670s (+3.4%)1.936s101.06x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.428s (~)11.022s (~)0.594s31.00x
💻 LocalExpress10.444s (~)11.023s (~)0.579s31.00x
🐘 PostgresNitro10.476s (-0.6%)11.020s (~)0.544s31.00x
💻 LocalNext.js (Turbopack)10.492s (~)11.022s (~)0.530s31.01x
🐘 PostgresExpress10.497s (+0.5%)11.017s (~)0.520s31.01x
🐘 PostgresNext.js (Turbopack)10.517s (-1.8%)11.016s (~)0.499s31.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)13.326s (+5.3% 🔺)14.845s (+7.0% 🔺)1.519s31.00x
▲ VercelExpress13.406s (+14.0% 🔺)15.197s (+9.4% 🔺)1.791s31.01x
▲ VercelNitro13.538s (+14.4% 🔺)14.941s (+12.6% 🔺)1.403s31.02x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro13.548s (~)14.027s (~)0.479s51.00x
💻 LocalExpress13.558s (-0.5%)14.029s (~)0.471s51.00x
🐘 PostgresNext.js (Turbopack)13.607s (~)14.018s (~)0.411s51.00x
🐘 PostgresNitro13.610s (-0.8%)14.021s (~)0.411s51.00x
💻 LocalNext.js (Turbopack)13.695s (~)14.027s (~)0.332s51.01x
🐘 PostgresExpress13.720s (~)14.018s (~)0.298s51.01x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express22.013s (+29.0% 🔺)23.728s (+25.4% 🔺)1.715s31.00x
▲ VercelNext.js (Turbopack)22.486s (+23.1% 🔺)24.211s (+19.8% 🔺)1.725s31.02x
▲ VercelNitro24.124s (+29.7% 🔺)25.960s (+26.1% 🔺)1.836s31.10x

🔍 Observability: Express | Next.js (Turbopack) | Nitro

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.051s (~)12.873s (~)0.822s71.00x
💻 LocalNitro12.065s (+2.3%)13.026s (+8.3% 🔺)0.960s71.00x
💻 LocalExpress12.084s (-2.2%)13.025s (~)0.941s71.00x
🐘 PostgresNitro12.111s (-1.5%)13.023s (~)0.912s71.00x
🐘 PostgresNext.js (Turbopack)12.203s (-1.4%)13.017s (~)0.813s71.01x
💻 LocalNext.js (Turbopack)12.284s (-0.7%)13.024s (~)0.740s71.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro27.628s (+54.9% 🔺)29.135s (+49.4% 🔺)1.507s41.00x
▲ VercelExpress29.373s (+62.6% 🔺)31.308s (+54.9% 🔺)1.936s31.06x
▲ VercelNext.js (Turbopack)30.080s (+53.3% 🔺)31.947s (+52.1% 🔺)1.867s31.09x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.168s (-0.9%)2.007s (~)0.839s151.00x
🐘 PostgresNitro1.171s (-2.6%)2.008s (~)0.837s151.00x
🐘 PostgresNext.js (Turbopack)1.182s (-12.9% 🟢)2.007s (-1.2%)0.825s151.01x
💻 LocalNitro1.366s (+5.4% 🔺)2.006s (~)0.641s151.17x
💻 LocalExpress1.384s (-2.6%)2.007s (~)0.622s151.18x
💻 LocalNext.js (Turbopack)1.444s (+3.1%)2.006s (~)0.562s151.24x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.334s (+6.3% 🔺)3.723s (+2.5%)1.389s91.00x
▲ VercelExpress2.560s (+33.9% 🔺)4.149s (+9.1% 🔺)1.589s81.10x
▲ VercelNext.js (Turbopack)2.611s (-22.4% 🟢)4.122s (-14.3% 🟢)1.511s81.12x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.282s (-6.0% 🟢)2.150s (-14.3% 🟢)0.869s141.00x
🐘 PostgresExpress1.282s (-1.0%)2.316s (-10.6% 🟢)1.034s131.00x
🐘 PostgresNext.js (Turbopack)1.314s (-6.4% 🟢)3.009s (~)1.695s101.03x
💻 LocalExpress2.457s (-11.1% 🟢)3.011s (~)0.554s101.92x
💻 LocalNitro2.543s (+5.5% 🔺)2.917s (-3.3%)0.374s111.98x
💻 LocalNext.js (Turbopack)2.610s (~)3.009s (~)0.399s102.04x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.053s (-12.9% 🟢)4.904s (+4.9%)1.851s71.00x
▲ VercelExpress3.054s (+10.0% 🔺)4.730s (+5.6% 🔺)1.676s71.00x
▲ VercelNitro3.783s (+50.9% 🔺)5.293s (+43.8% 🔺)1.510s71.24x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.587s (~)4.137s (~)2.549s81.00x
🐘 PostgresNitro1.610s (-3.2%)3.764s (-12.5% 🟢)2.153s81.01x
🐘 PostgresNext.js (Turbopack)3.072s (+7.6% 🔺)5.847s (+9.3% 🔺)2.775s61.94x
💻 LocalNitro6.118s (+12.0% 🔺)6.819s (+13.3% 🔺)0.701s53.85x
💻 LocalExpress7.002s (+11.2% 🔺)7.768s (+14.0% 🔺)0.767s44.41x
💻 LocalNext.js (Turbopack)7.653s (+3.3%)8.519s (~)0.866s44.82x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.591s (+27.3% 🔺)4.967s (+4.9%)1.376s71.00x
▲ VercelExpress5.029s (+63.0% 🔺)6.496s (+36.4% 🔺)1.467s51.40x
▲ VercelNext.js (Turbopack)6.596s (+30.2% 🔺)8.448s (+29.8% 🔺)1.853s41.84x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.168s (-2.3%)2.007s (~)0.839s151.00x
🐘 PostgresExpress1.172s (-20.0% 🟢)2.008s (-9.6% 🟢)0.836s151.00x
🐘 PostgresNext.js (Turbopack)1.180s (-9.0% 🟢)2.008s (-1.0%)0.827s151.01x
💻 LocalNitro1.392s (+17.5% 🔺)2.007s (~)0.615s151.19x
💻 LocalExpress1.422s (-1.5%)2.007s (~)0.585s151.22x
💻 LocalNext.js (Turbopack)1.486s (-8.4% 🟢)2.006s (-3.2%)0.521s151.27x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.411s (+18.7% 🔺)3.863s (+12.2% 🔺)1.452s81.00x
▲ VercelNext.js (Turbopack)2.492s (-16.6% 🟢)3.838s (-14.5% 🟢)1.346s81.03x
▲ VercelExpress2.740s (+35.6% 🔺)4.286s (+11.0% 🔺)1.546s71.14x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.290s (-2.0%)2.222s (-11.5% 🟢)0.932s141.00x
🐘 PostgresNext.js (Turbopack)1.305s (-7.8% 🟢)2.918s (+5.0%)1.613s111.01x
🐘 PostgresExpress1.307s (-1.4%)2.223s (-4.0%)0.916s141.01x
💻 LocalNitro2.341s (-1.7%)3.008s (~)0.667s101.81x
💻 LocalExpress2.552s (-4.2%)3.109s (+6.5% 🔺)0.556s101.98x
💻 LocalNext.js (Turbopack)2.772s (+14.2% 🔺)3.010s (-3.2%)0.238s102.15x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.514s (+15.6% 🔺)3.814s (-0.7%)1.299s91.00x
▲ VercelNitro2.735s (+16.1% 🔺)4.394s (+20.8% 🔺)1.659s71.09x
▲ VercelNext.js (Turbopack)2.986s (-14.6% 🟢)4.571s (-6.4% 🟢)1.585s71.19x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.578s (~)4.136s (~)2.559s81.00x
🐘 PostgresNitro1.593s (-4.4%)4.135s (-4.0%)2.542s81.01x
🐘 PostgresNext.js (Turbopack)3.201s (+16.6% 🔺)5.683s (+8.8% 🔺)2.481s62.03x
💻 LocalNext.js (Turbopack)5.342s (-30.5% 🟢)5.846s (-33.4% 🟢)0.505s63.39x
💻 LocalNitro6.030s (+11.0% 🔺)6.616s (+3.1%)0.586s53.82x
💻 LocalExpress7.229s (+17.7% 🔺)8.018s (+17.6% 🔺)0.788s44.58x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.172s (+13.6% 🔺)4.932s (+4.6%)1.760s71.00x
▲ VercelExpress3.508s (+21.3% 🔺)5.105s (+5.5% 🔺)1.596s61.11x
▲ VercelNext.js (Turbopack)4.741s (+19.7% 🔺)6.237s (+13.8% 🔺)1.496s51.49x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.501s (-2.5%)1.006s (~)0.506s601.00x
🐘 PostgresNext.js (Turbopack)0.538s (-13.9% 🟢)1.006s (-6.3% 🟢)0.469s601.07x
🐘 PostgresNitro0.539s (-6.2% 🟢)1.024s (~)0.484s591.08x
💻 LocalNext.js (Turbopack)0.595s (-9.4% 🟢)1.005s (-1.6%)0.410s601.19x
💻 LocalExpress0.659s (+15.5% 🔺)1.022s (+1.7%)0.363s591.32x
💻 LocalNitro0.660s (+48.2% 🔺)1.077s (+6.9% 🔺)0.416s561.32x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.307s (+19.1% 🔺)4.917s (+3.7%)1.610s131.00x
▲ VercelNext.js (Turbopack)3.525s (-8.2% 🟢)5.171s (-4.6%)1.646s121.07x
▲ VercelExpress3.810s (+48.4% 🔺)5.343s (+32.9% 🔺)1.533s121.15x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.210s (-3.7%)2.008s (-1.1%)0.798s451.00x
🐘 PostgresNext.js (Turbopack)1.268s (-26.3% 🟢)2.007s (-13.8% 🟢)0.740s451.05x
🐘 PostgresNitro1.317s (-5.0% 🟢)2.030s (+1.1%)0.713s451.09x
💻 LocalNitro1.434s (+38.4% 🔺)2.006s (+38.2% 🔺)0.572s451.18x
💻 LocalExpress1.484s (+6.2% 🔺)2.029s (+1.1%)0.545s451.23x
💻 LocalNext.js (Turbopack)1.516s (-0.5%)2.006s (~)0.490s451.25x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)8.629s (+1.5%)10.594s (+3.5%)1.965s91.00x
▲ VercelNitro8.696s (+42.1% 🔺)10.259s (+37.9% 🔺)1.563s91.01x
▲ VercelExpress9.461s (+37.0% 🔺)11.645s (+33.3% 🔺)2.184s81.10x

🔍 Observability: Next.js (Turbopack) | Nitro | Express

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.396s (~)3.034s (~)0.637s401.00x
🐘 PostgresNext.js (Turbopack)2.557s (-17.2% 🟢)3.008s (-16.5% 🟢)0.451s401.07x
🐘 PostgresNitro2.565s (-11.4% 🟢)3.086s (-5.1% 🟢)0.521s391.07x
💻 LocalNitro3.098s (+39.7% 🔺)3.790s (+34.2% 🔺)0.692s321.29x
💻 LocalExpress3.182s (+4.5%)3.736s (+3.9%)0.554s331.33x
💻 LocalNext.js (Turbopack)3.324s (~)4.009s (~)0.686s301.39x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro15.909s (+18.9% 🔺)17.562s (+16.6% 🔺)1.653s71.00x
▲ VercelExpress16.784s (+27.5% 🔺)18.587s (+18.8% 🔺)1.803s71.05x
▲ VercelNext.js (Turbopack)17.150s (-10.8% 🟢)18.919s (-8.8% 🟢)1.769s71.08x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.172s (-33.6% 🟢)1.006s (-0.9%)0.834s601.00x
🐘 PostgresNitro0.200s (-12.7% 🟢)1.006s (~)0.806s601.16x
🐘 PostgresExpress0.205s (+1.0%)1.007s (~)0.802s601.19x
💻 LocalNitro0.452s (+20.2% 🔺)1.004s (~)0.552s602.63x
💻 LocalExpress0.485s (+4.1%)1.005s (~)0.520s602.83x
💻 LocalNext.js (Turbopack)0.643s (+4.1%)1.005s (~)0.362s603.74x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express1.428s (+41.7% 🔺)2.925s (+9.3% 🔺)1.497s211.00x
▲ VercelNitro1.512s (+40.4% 🔺)2.968s (+20.3% 🔺)1.456s211.06x
▲ VercelNext.js (Turbopack)1.812s (-11.1% 🟢)3.534s (+5.8% 🔺)1.722s171.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.278s (-48.2% 🟢)1.006s (-11.2% 🟢)0.728s901.00x
🐘 PostgresExpress0.312s (+1.7%)1.006s (~)0.694s901.12x
🐘 PostgresNitro0.317s (-10.9% 🟢)1.006s (~)0.690s901.14x
💻 LocalNitro2.142s (+44.1% 🔺)2.767s (+34.7% 🔺)0.625s337.72x
💻 LocalExpress2.150s (-5.4% 🟢)2.767s (-3.0%)0.617s337.75x
💻 LocalNext.js (Turbopack)2.826s (+1.1%)3.380s (+1.1%)0.554s2710.18x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.096s (+42.5% 🔺)3.844s (+19.5% 🔺)1.748s241.00x
▲ VercelNitro2.114s (+62.2% 🔺)3.771s (+41.0% 🔺)1.657s241.01x
▲ VercelNext.js (Turbopack)2.655s (+4.4%)4.343s (+15.5% 🔺)1.687s211.27x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.498s (-3.7%)1.087s (+3.6%)0.590s1111.00x
🐘 PostgresNitro0.501s (-9.7% 🟢)1.032s (-6.9% 🟢)0.531s1171.01x
🐘 PostgresNext.js (Turbopack)0.512s (-41.6% 🟢)3.086s (+22.1% 🔺)2.574s391.03x
💻 LocalExpress9.768s (+4.0%)10.782s (+1.6%)1.014s1219.63x
💻 LocalNitro9.818s (+32.1% 🔺)10.939s (+32.0% 🔺)1.121s1119.73x
💻 LocalNext.js (Turbopack)11.547s (+8.1% 🔺)12.428s (+6.5% 🔺)0.881s1023.21x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.723s (+49.6% 🔺)4.294s (+18.6% 🔺)1.572s281.00x
▲ VercelExpress2.880s (+44.8% 🔺)4.504s (+14.9% 🔺)1.624s271.06x
▲ VercelNext.js (Turbopack)3.959s (+5.7% 🔺)5.519s (+5.8% 🔺)1.560s221.45x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.143s (-1.1%)1.999s (~)0.001s (+22.2% 🔺)2.010s (~)0.867s101.00x
💻 LocalNext.js (Turbopack)1.145s (+0.6%)1.965s (~)0.012s (+17.8% 🔺)2.019s (~)0.874s101.00x
🐘 PostgresNitro1.146s (-2.5%)1.998s (~)0.001s (~)2.010s (~)0.864s101.00x
💻 LocalNitro1.153s (+3.7%)2.003s (~)0.010s (-69.2% 🟢)2.017s (-1.3%)0.864s101.01x
🐘 PostgresNext.js (Turbopack)1.159s (-11.1% 🟢)2.000s (~)0.001s (-92.2% 🟢)2.011s (-1.4%)0.852s101.01x
💻 LocalExpress1.162s (+1.1%)2.006s (~)0.011s (+3.6%)2.021s (~)0.859s101.02x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.465s (+29.2% 🔺)3.535s (+15.5% 🔺)3.029s (+101.3% 🔺)6.975s (+38.7% 🔺)4.509s101.00x
▲ VercelNext.js (Turbopack)2.546s (-23.9% 🟢)3.675s (+0.9%)2.734s (+96.8% 🔺)6.910s (+8.9% 🔺)4.364s101.03x
▲ VercelExpress2.691s (+38.8% 🔺)3.714s (+9.9% 🔺)2.870s (+89.9% 🔺)7.065s (+31.3% 🔺)4.374s101.09x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.520s (-1.4%)2.004s (~)0.005s (-1.9%)2.027s (~)0.507s301.00x
💻 LocalNitro1.539s (+9.1% 🔺)2.010s (~)0.014s (-21.6% 🟢)2.028s (~)0.489s301.01x
💻 LocalExpress1.541s (-0.8%)2.011s (~)0.012s (-13.4% 🟢)2.027s (~)0.486s301.01x
🐘 PostgresNitro1.542s (-5.6% 🟢)2.002s (~)0.005s (+3.2%)2.027s (~)0.485s301.01x
🐘 PostgresNext.js (Turbopack)1.584s (-19.6% 🟢)2.008s (-16.0% 🟢)0.005s (+16.4% 🔺)2.025s (-16.3% 🟢)0.440s301.04x
💻 LocalNext.js (Turbopack)1.604s (~)1.970s (~)0.013s (-3.0%)2.027s (~)0.423s301.06x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro6.534s (+17.0% 🔺)7.614s (+13.6% 🔺)0.192s (-12.1% 🟢)8.416s (+13.6% 🔺)1.882s81.00x
▲ VercelNext.js (Turbopack)6.555s (-29.5% 🟢)7.774s (-22.8% 🟢)0.357s (+33.7% 🔺)8.655s (-23.0% 🟢)2.100s71.00x
▲ VercelExpress6.717s (+16.7% 🔺)8.110s (+10.2% 🔺)0.192s (-24.3% 🟢)8.746s (+7.7% 🔺)2.029s71.03x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.752s (+1.9%)1.046s (+1.7%)0.000s (NaN%)1.070s (+1.5%)0.318s571.00x
🐘 PostgresNitro0.755s (-9.3% 🟢)1.049s (-4.7%)0.000s (+184.2% 🔺)1.062s (-5.1% 🟢)0.307s571.00x
🐘 PostgresNext.js (Turbopack)1.033s (-5.5% 🟢)1.463s (-11.8% 🟢)0.000s (+Infinity% 🔺)1.472s (-12.5% 🟢)0.439s411.37x
💻 LocalExpress1.209s (-9.3% 🟢)1.981s (-1.6%)0.000s (-36.9% 🟢)1.984s (-1.6%)0.775s311.61x
💻 LocalNitro1.226s (+28.3% 🔺)1.981s (+50.6% 🔺)0.000s (-57.6% 🟢)1.984s (+50.4% 🔺)0.757s311.63x
💻 LocalNext.js (Turbopack)1.410s (-3.3%)1.978s (~)0.000s (+266.7% 🔺)2.016s (~)0.606s301.88x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.490s (+25.3% 🔺)4.484s (+7.5% 🔺)0.000s (+Infinity% 🔺)4.914s (+5.9% 🔺)1.424s131.00x
▲ VercelExpress3.602s (+26.6% 🔺)4.853s (+8.7% 🔺)0.000s (+116.7% 🔺)5.355s (+7.4% 🔺)1.753s121.03x
▲ VercelNext.js (Turbopack)3.741s (-23.4% 🟢)4.896s (-9.0% 🟢)0.001s (+1233.3% 🔺)5.357s (-16.2% 🟢)1.616s121.07x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.606s (-2.3%)2.252s (~)0.000s (+100.0% 🔺)2.268s (~)0.662s271.00x
🐘 PostgresNitro1.750s (~)2.327s (~)0.000s (+100.0% 🔺)2.358s (+0.6%)0.608s271.09x
🐘 PostgresNext.js (Turbopack)2.275s (-32.6% 🟢)2.716s (-30.0% 🟢)0.000s (NaN%)2.769s (-29.4% 🟢)0.495s221.42x
💻 LocalNitro3.522s (+61.3% 🔺)4.160s (+59.6% 🔺)0.000s (-73.3% 🟢)4.163s (+59.4% 🔺)0.641s152.19x
💻 LocalExpress3.667s (+9.1% 🔺)4.314s (+10.6% 🔺)0.000s (-54.3% 🟢)4.317s (+10.5% 🔺)0.650s142.28x
💻 LocalNext.js (Turbopack)3.973s (-1.7%)4.414s (-1.8%)0.001s (-23.1% 🟢)4.462s (-1.6%)0.488s142.47x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express4.975s (-3.6%)6.132s (-6.2% 🟢)0.000s (+Infinity% 🔺)6.623s (-6.5% 🟢)1.647s101.00x
▲ VercelNitro5.041s (-7.9% 🟢)6.327s (+3.5%)0.000s (NaN%)6.722s (-5.9% 🟢)1.681s91.01x
▲ VercelNext.js (Turbopack)5.726s (-17.0% 🟢)6.788s (-9.9% 🟢)0.000s (+Infinity% 🔺)7.251s (-15.6% 🟢)1.525s91.15x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress12/21
▲ VercelNitro11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres17/21
Next.js (Turbopack)🐘 Postgres17/21
Nitro🐘 Postgres15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Redis + BullMQ: Community world (local development)
  • 🌐 Cloudflare: Community world (local development)
  • 🌐 MySQL: Community world (local development)
  • 🌐 Azure: Community world (local development)
  • 🌐 NATS JetStream: Community world (local development)
  • 🌐 Upstash: Community world (local development)
  • 🌐 Platformatic: Community world (local development)

📋 View full workflow run

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI review: no blocking issues

yield* repairPart('end', chunk.id, chunk, reasoning, 'reasoning-start');
break;

default:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Scope question: tool-input-delta raises the same class of fatal error in the consumer (Received tool-input-delta for missing tool call with ID ...), and tool parts flow through this default branch unrepaired. The reason text/reasoning are uniquely fragile is the consumer resets activeTextParts/activeReasoningParts on finish-step while ids are reused ("0") — I confirmed against the consumer source that tool state is not reset on finish-step and tool-call ids are unique, so the step-boundary orphaning genuinely doesn't apply to tools. But the same duplication/interleave races behind this issue could still re-deliver a tool-input-start or orphan a tool-input-delta and crash a turn the same way. Worth a one-line comment here recording that tools are deliberately out of scope (and why), so the omission reads as intentional rather than missed.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added a "Scope: text and reasoning only" section to the doc comment recording that tool-input parts are deliberately out of scope and why (consumer doesn't reset tool state on finish-step; tool-call ids are unique).

{ type: 'finish' },
];

describe('WorkflowChatTransport UI message stream repair (issue #2422)', () => {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

AI Review: Note

Forward-compat: the repair mirrors an internal, undocumented behavior of processUIMessageStream (reset-on-finish-step). Under the ai: ^6 peer range a future 6.x could move that reset boundary or add a part family and silently desync the repair. Driving the real consumer here is exactly the right canary for that — but every case in this file exercises only text. The reasoning branch (and the well-formed reasoning passthrough) is asserted only structurally, so a reasoning-semantics change in a future ai wouldn't break a test. I verified locally that an interleaved reasoning stream reproduces Received reasoning-delta for missing reasoning part with ID "0" against the real consumer and that the transport repairs it to "Thinking..." with no loss — suggest adding that as a case here. I'll include it when addressing comments.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

(AI) Addressed in af13a07 — added two interleaved-reasoning cases driving the real readUIMessageStream consumer: one proving the raw stream is fatal with Received reasoning-delta for missing reasoning part with ID "0", one proving the transport repairs it to "Thinking..." with no loss. A future ai reasoning-semantics change now breaks a test.

… against real consumer
- normalize-ui-message-stream: document why tool-input parts are deliberately
out of scope (consumer doesn't reset tool state on finish-step; ids unique).
- stream-repair test: add interleaved-reasoning cases driving the real
readUIMessageStream consumer (raw stream is fatal; transport repairs to
"Thinking..." with no loss), so a future ai reasoning-semantics change is caught.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread.changeset/repair-ui-message-stream-framing.md Outdated
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened against stable: #2672. (backport job run)

pranaygp added a commit that referenced this pull request Jun 26, 2026
…edrive
* origin/main: (90 commits)
[ai] Fix "missing text part" stream crash by repairing UI message framing (#2537)
[ci] Fix release "Premature close" by bounding changelog GraphQL batch size (#2669)
[ai] Drop orphan UI chunks after negative-index reconnect (#2082)
Fix trace detail panel Input/Output flicker (selection-driven state machine) (#2637)
[world-local] Scope untagged startup recovery to untagged runs (#2667)
fix(world-postgres): defer loopback worker startup (#2657)
docs: deprecate DurableAgent and WorkflowChatTransport, point to AI SDK WorkflowAgent (#2616)
[web] Fix HTTP/2 in bundled server build so observability reads work (#2632)
[core] Fix turbo-mode step-body writes racing run_started (#2629)
fix(world-postgres): rename setup command (#2644)
chore: ignore workflow swc caches (#2640)
fix(ai): ignore intentional stream aborts (#2635)
fix(nitro): reload steps during Vite HMR (#2572)
[world] Make @workflow/world own its Zod dependency (#2622)
feat(web-shared): extend cn with custom tailwind-merge class groups (#2619)
[world-vercel] Enable HTTP/2 for the events API and stream writes (#2573)
Remove shadow from off-screen marker indicator button (#2614)
Fix discovery of dotted JS workflow imports (#2594)
Version Packages (beta) (#2597)
Thread occurredAt into web-shared entities (#2608)
...
# Conflicts:
#	packages/core/src/runtime/step-executor.ts
#	packages/world-vercel/src/http-client.ts
pranaygp pushed a commit that referenced this pull request Jun 26, 2026
…ming (#2537) (#2672)
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actionsgithub-actionsBot mentioned this pull request Jun 26, 2026
gr2m pushed a commit to vercel/ai that referenced this pull request Jun 29, 2026
…ransport (#16433)
## Summary
Port of **vercel/workflow#2537** to `@ai-sdk/workflow`.
A workflow run owns a single shared UI message stream, and the AI SDK's
stream consumer (`processUIMessageStream`, backing
`useChat`/`readUIMessageStream`) resets its active text/reasoning part
maps on every `finish-step`. Multi-step turns reuse the same part id
(commonly `"0"`) per step, so if a `text-start` is dropped or a
`finish-step` lands mid-part, the consumer hits a
`text-delta`/`text-end` for an id it has no open part for and throws:
```
Received text-delta for missing text part with ID "0". Ensure a "text-start" chunk is sent before any "text-delta" chunks.
```
…killing the whole turn. That malformed framing is reachable whenever a
stream-producing step's output is duplicated or interleaved on the
shared stream (step retry/redelivery, reconnect/replay overlap,
concurrent-worker duplication).
## Fix
`WorkflowChatTransport` now passes the stream it hands to the AI SDK
through `normalizeUIMessageStreamParts`, which mirrors the consumer's
per-step part-lifetime state machine:
- resets tracking on `finish-step` (exactly where the consumer resets —
verified against `processUIMessageStream`);
- synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end`
arrives;
- drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
open/ended in the current step.
It wraps the *output* of the send/reconnect iterators, so the reconnect
`chunkIndex`/`gotFinish` accounting (which counts raw server chunks) is
untouched. A well-formed stream passes through unchanged. Applies to
both text and reasoning parts.
## Tests
`workflow-chat-transport.stream-repair.test.ts` drives the **real**
transport (mock `fetch` returning chunks via the AI SDK's own
`JsonToSseTransformStream`) into the **real** `readUIMessageStream`
consumer:
- proves the raw interleaved stream reproduces the exact `missing text
part` error;
- proves the transport repairs it with no content lost (`"Hello
world"`);
- proves a reconnect/replay duplicate tail is dropped without erroring;
- proves a well-formed multi-step stream (id `"0"` reused across steps)
is unchanged;
- same for reasoning parts (raw interleaved reasoning is fatal;
transport repairs to `"Thinking..."`).
`pnpm --filter @ai-sdk/workflow build && test` pass (node + edge).
## Related
- Sibling PR: vercel/workflow#2537 (the `@workflow/ai` copy)
- Original issue: vercel/workflow#2422
Opened as a draft — this is an AI-assisted port across diverged copies
of the same package; please review the translation before merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

Flight booking app fails with v5 beta release with "received text-delta for missing text part with ID 0"

2 participants

@VaguelySerious@pranaygp