Skip to content

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

@TooTallNate@pranaygp@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
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;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Fix prepareStep system message lost when messages is also returned by TooTallNate · Pull Request #1389 · vercel/workflow · GitHub
Skip to content

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

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

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

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

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

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

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

@TooTallNate@pranaygp@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix prepareStep system message lost when messages is also returned by TooTallNate · Pull Request #1389 · vercel/workflow · GitHub
Skip to content

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

@TooTallNate@pranaygp@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Fix prepareStep system message lost when messages is also returned by TooTallNate · Pull Request #1389 · vercel/workflow · GitHub
Skip to content

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

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

Fix prepareStep system message lost when messages is also returned - #1389

Merged
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering
Mar 16, 2026
Merged

Fix prepareStep system message lost when messages is also returned#1389
TooTallNate merged 2 commits into
mainfrom
fix/prepare-step-system-message-ordering

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fix a bug in DurableAgent's prepareStep where returning both system and messages caused the system message to be discarded
  • The system override was applied first (prepended to conversationPrompt), then messages replaced conversationPrompt entirely, losing the system message
  • Swap the ordering: apply messages first, then system, so the system message is prepended to the new prompt
  • This affected any DurableAgent usage where prepareStep returned a dynamic system prompt alongside modified messages (e.g. for context window management or message injection)

@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 14, 2026 17:32
@vercel

vercelBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

CopilotAI review requested due to automatic review settings March 14, 2026 17:32
@changeset-bot

changeset-botBot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93cf09e

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

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

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

@github-actions

github-actionsBot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production560067627
✅ 💻 Local Development600084684
✅ 📦 Local Production600084684
✅ 🐘 Local Postgres600084684
✅ 🪟 Windows540357
❌ 🌍 Community Worlds1165515186
✅ 📋 Other144027171
Total2674553643093

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously

turso (50 failed):

  • addTenWorkflow
  • addTenWorkflow
  • wellKnownAgentWorkflow (.well-known/agent)
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • importedStepOnlyWorkflow
  • hookWorkflow
  • hookWorkflow is not resumable via public webhook endpoint
  • webhookWorkflow
  • sleepingWorkflow
  • parallelSleepWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE
  • instanceMethodStepWorkflow - instance methods with "use step" directive
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument
  • cancelRun - cancelling a running workflow
  • cancelRun via CLI - cancelling a running workflow
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control)

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro5007
✅ example5007
✅ express5007
✅ fastify5007
✅ hono5007
✅ nextjs-turbopack5502
✅ nextjs-webpack5502
✅ nitro5007
✅ nuxt5007
✅ sveltekit5007
✅ vite5007
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable4809
✅ express-stable4809
✅ fastify-stable4809
✅ hono-stable4809
✅ nextjs-turbopack-canary5403
✅ nextjs-turbopack-stable5403
✅ nextjs-webpack-canary5403
✅ nextjs-webpack-stable5403
✅ nitro-stable4809
✅ nuxt-stable4809
✅ sveltekit-stable4809
✅ vite-stable4809
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack5403
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
❌ mongodb5133
✅ redis-dev302
❌ redis5223
✅ turso-dev302
❌ turso4503
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable4809
✅ e2e-local-postgres-nest-stable4809
✅ e2e-local-prod-nest-stable4809

📋 View full workflow run

@github-actions

github-actionsBot commented Mar 14, 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.041s (-25.1% 🟢)1.005s (~)0.965s101.00x
💻 LocalExpress0.042s (+1.9%)1.006s (~)0.964s101.04x
💻 LocalNext.js (Turbopack)0.042s1.005s0.963s101.04x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.953s101.30x
🐘 PostgresNext.js (Turbopack)0.059s1.011s0.953s101.45x
🐘 PostgresNitro0.060s (-0.7%)1.011s (~)0.951s101.49x
🌐 MongoDBNext.js (Turbopack)0.079s1.008s0.929s101.95x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.426s (-10.4% 🟢)2.201s (-12.4% 🟢)1.775s101.00x
▲ VercelExpress0.480s (-19.0% 🟢)2.057s (-22.9% 🟢)1.577s101.13x
▲ VercelNext.js (Turbopack)0.507s (-15.3% 🟢)2.192s (-1.5%)1.685s101.19x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.092s2.006s0.913s101.00x
💻 LocalExpress1.120s (~)2.006s (~)0.886s101.03x
🌐 RedisNext.js (Turbopack)1.125s2.007s0.882s101.03x
💻 LocalNitro1.129s (~)2.007s (~)0.878s101.03x
🐘 PostgresNitro1.141s (~)2.012s (~)0.871s101.04x
🐘 PostgresNext.js (Turbopack)1.155s2.012s0.857s101.06x
🌐 MongoDBNext.js (Turbopack)1.310s2.008s0.698s101.20x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.037s (-4.2%)3.323s (-19.8% 🟢)1.286s101.00x
▲ VercelExpress2.121s (-0.9%)3.393s (-16.7% 🟢)1.272s101.04x
▲ VercelNext.js (Turbopack)2.349s (+12.6% 🔺)3.578s (+5.6% 🔺)1.229s101.15x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.581s11.022s0.442s31.00x
🌐 RedisNext.js (Turbopack)10.753s11.023s0.270s31.02x
💻 LocalExpress10.891s (~)11.023s (~)0.131s31.03x
💻 LocalNitro10.892s (~)11.023s (~)0.132s31.03x
🐘 PostgresNext.js (Turbopack)10.915s11.038s0.123s31.03x
🐘 PostgresNitro10.958s (~)11.375s (-2.9%)0.417s31.04x
🌐 MongoDBNext.js (Turbopack)12.216s13.019s0.803s31.15x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express16.477s (-15.4% 🟢)17.328s (-17.9% 🟢)0.851s21.00x
▲ VercelNext.js (Turbopack)16.667s (-1.5%)18.125s (-1.1%)1.458s21.01x
▲ VercelNitro16.950s (+2.6%)18.598s (+3.6%)1.648s21.03x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)26.621s27.049s0.428s31.00x
🌐 RedisNext.js (Turbopack)26.777s27.052s0.275s31.01x
🐘 PostgresNext.js (Turbopack)26.955s27.065s0.110s31.01x
🐘 PostgresNitro27.199s (~)28.064s (~)0.865s31.02x
💻 LocalNitro27.451s (~)28.051s (~)0.600s31.03x
💻 LocalExpress27.458s (~)28.050s (~)0.592s31.03x
🌐 MongoDBNext.js (Turbopack)30.380s31.037s0.657s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.820s (-5.5% 🟢)45.150s (-6.8% 🟢)1.330s21.00x
▲ VercelNext.js (Turbopack)43.889s (+0.7%)45.248s (~)1.359s21.00x
▲ VercelNitro44.008s (~)45.019s (-0.9%)1.011s21.00x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)53.383s54.099s0.716s21.00x
🐘 PostgresNext.js (Turbopack)53.959s54.097s0.138s21.01x
🐘 PostgresNitro54.176s (~)54.597s (-0.9%)0.421s21.01x
💻 LocalNext.js (Turbopack)54.697s55.105s0.408s21.02x
💻 LocalNitro56.405s (-0.6%)57.101s (~)0.696s21.06x
💻 LocalExpress56.553s (~)57.102s (~)0.548s21.06x
🌐 MongoDBNext.js (Turbopack)60.642s61.066s0.425s21.14x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.669s (~)96.588s (~)1.919s11.00x
▲ VercelNext.js (Turbopack)94.803s (-1.6%)96.243s (-2.0%)1.440s11.00x
▲ VercelExpress99.053s (~)100.244s (~)1.191s11.05x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.337s2.006s0.670s151.00x
🐘 PostgresNitro1.417s (+0.9%)2.010s (~)0.593s151.06x
🐘 PostgresNext.js (Turbopack)1.457s2.011s0.554s151.09x
💻 LocalNext.js (Turbopack)1.471s2.005s0.534s151.10x
💻 LocalNitro1.500s (-1.4%)2.006s (~)0.506s151.12x
💻 LocalExpress1.516s (~)2.006s (~)0.490s151.13x
🌐 MongoDBNext.js (Turbopack)2.166s3.009s0.843s101.62x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.328s (-9.5% 🟢)3.653s (-8.6% 🟢)1.325s91.00x
▲ VercelExpress2.483s (-6.7% 🟢)3.675s (-17.0% 🟢)1.191s91.07x
▲ VercelNext.js (Turbopack)2.712s (+15.4% 🔺)3.854s (+1.8%)1.141s81.17x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.542s2.825s0.282s111.00x
🌐 RedisNext.js (Turbopack)2.573s3.008s0.435s101.01x
🐘 PostgresNitro2.574s (-0.9%)3.114s (+3.3%)0.540s101.01x
🐘 PostgresNext.js (Turbopack)2.596s3.012s0.416s101.02x
💻 LocalExpress2.836s (-2.1%)3.108s (-3.1%)0.272s101.12x
💻 LocalNitro2.873s (-2.4%)3.108s (-7.0% 🟢)0.235s101.13x
🌐 MongoDBNext.js (Turbopack)4.696s5.178s0.482s61.85x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.713s (-7.4% 🟢)3.971s (-21.1% 🟢)1.258s81.00x
▲ VercelNext.js (Turbopack)2.793s (+7.9% 🔺)4.382s (-1.8%)1.589s71.03x
▲ VercelExpress3.048s (+3.2%)4.351s (-3.8%)1.303s71.12x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)4.158s5.011s0.853s61.00x
🐘 PostgresNitro4.219s (+6.1% 🔺)4.730s (+6.4% 🔺)0.511s71.01x
🐘 PostgresNext.js (Turbopack)4.284s5.021s0.737s61.03x
💻 LocalNext.js (Turbopack)6.452s7.015s0.563s51.55x
💻 LocalExpress7.927s (-1.5%)8.522s (~)0.595s41.91x
💻 LocalNitro8.008s (-3.6%)8.518s (-5.6% 🟢)0.510s41.93x
🌐 MongoDBNext.js (Turbopack)9.891s10.349s0.458s32.38x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express3.499s (+17.8% 🔺)5.006s (-4.2%)1.507s61.00x
▲ VercelNext.js (Turbopack)3.584s (-11.5% 🟢)5.051s (-10.6% 🟢)1.466s71.02x
▲ VercelNitro4.678s (+33.4% 🔺)6.012s (+20.9% 🔺)1.334s51.34x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.296s2.006s0.711s151.00x
🐘 PostgresNitro1.378s (-1.0%)2.011s (~)0.633s151.06x
🐘 PostgresNext.js (Turbopack)1.430s2.011s0.581s151.10x
💻 LocalExpress1.484s (-2.0%)2.006s (~)0.522s151.14x
💻 LocalNext.js (Turbopack)1.494s2.005s0.511s151.15x
💻 LocalNitro1.502s (-5.0% 🟢)2.005s (~)0.503s151.16x
🌐 MongoDBNext.js (Turbopack)2.209s3.008s0.799s101.70x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.110s (-7.5% 🟢)3.513s (-8.7% 🟢)1.402s91.00x
▲ VercelNitro2.659s (+7.2% 🔺)3.904s (-13.8% 🟢)1.245s91.26x
▲ VercelExpress2.725s (+17.1% 🔺)3.988s (-7.0% 🟢)1.263s81.29x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.501s (-0.7%)3.011s (~)0.510s101.00x
🐘 PostgresNext.js (Turbopack)2.596s3.013s0.417s101.04x
🌐 RedisNext.js (Turbopack)2.618s3.008s0.390s101.05x
💻 LocalNext.js (Turbopack)2.639s3.008s0.368s101.06x
💻 LocalExpress2.904s (-4.9%)3.009s (-20.0% 🟢)0.105s101.16x
💻 LocalNitro2.926s (-8.0% 🟢)3.343s (-16.7% 🟢)0.417s91.17x
🌐 MongoDBNext.js (Turbopack)4.705s5.177s0.472s61.88x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.612s (+6.5% 🔺)4.010s (+2.5%)1.398s91.00x
▲ VercelNitro2.615s (+5.5% 🔺)3.792s (-18.0% 🟢)1.178s81.00x
▲ VercelExpress2.652s (+1.3%)3.661s (-21.1% 🟢)1.009s91.02x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.969s (+0.9%)4.589s (+3.2%)0.620s71.00x
🌐 RedisNext.js (Turbopack)4.152s5.011s0.860s61.05x
🐘 PostgresNext.js (Turbopack)4.370s5.016s0.646s61.10x
💻 LocalNext.js (Turbopack)6.371s6.816s0.445s51.61x
💻 LocalNitro8.241s (-6.8% 🟢)9.020s (-2.7%)0.779s42.08x
💻 LocalExpress8.431s (-3.4%)9.020s (-2.7%)0.589s42.12x
🌐 MongoDBNext.js (Turbopack)9.959s10.684s0.724s32.51x
🐘 PostgresExpress⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.934s (+8.9% 🔺)4.148s (-12.1% 🟢)1.214s81.00x
▲ VercelNitro3.072s (+7.5% 🔺)4.315s (-9.7% 🟢)1.243s71.05x
▲ VercelNext.js (Turbopack)3.314s (-46.2% 🟢)4.719s (-39.7% 🟢)1.405s71.13x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.129s1.002s0.010s1.015s0.887s101.00x
🌐 RedisNext.js (Turbopack)0.173s1.000s0.002s1.008s0.834s101.35x
💻 LocalExpress0.192s (-2.3%)1.003s (~)0.012s (+2.7%)1.017s (~)0.826s101.49x
💻 LocalNitro0.193s (-5.9% 🟢)1.003s (~)0.011s (-9.8% 🟢)1.017s (~)0.824s101.50x
🐘 PostgresNext.js (Turbopack)0.203s1.002s0.002s1.012s0.810s101.58x
🐘 PostgresNitro0.216s (-4.6%)0.993s (~)0.002s (-21.1% 🟢)1.011s (~)0.795s101.68x
🌐 MongoDBNext.js (Turbopack)0.523s0.928s0.001s1.009s0.485s104.07x
🐘 PostgresExpress⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.483s (-5.0% 🟢)2.197s (-21.4% 🟢)0.005s (+31.7% 🔺)2.741s (-18.4% 🟢)1.258s101.00x
▲ VercelNitro1.590s (-1.8%)2.652s (-3.0%)0.006s (+5.6% 🔺)3.205s (-1.9%)1.615s101.07x
▲ VercelExpress1.594s (-13.2% 🟢)2.753s (-4.0%)0.006s (+20.4% 🔺)3.285s (-5.5% 🟢)1.691s101.07x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)10/12
🐘 PostgresNitro7/12
▲ VercelNitro5/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local9/12
Next.js (Turbopack)💻 Local6/12
Nitro🐘 Postgres7/12
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)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: success
  • Postgres: failure
  • Vercel: success

Check the workflow run for details.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a DurableAgent/streamTextIterator bug where a prepareStep callback returning both messages and system would inadvertently drop the system message due to override ordering.

Changes:

  • Apply prepareStep.messages override before applying prepareStep.system, ensuring the system message is preserved.
  • Add a changeset to publish the fix as a patch for @workflow/ai.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
packages/ai/src/agent/stream-text-iterator.tsReorders prepareStep override application so system is applied after messages.
.changeset/fix-prepare-step-system-ordering.mdAdds a patch changeset entry documenting the bug fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 151 to 174
@@ -167,9 +172,6 @@ export async function* streamTextIterator({
});
}
}
Apply messages override before system override so that the system
message is prepended to the new prompt instead of being discarded.
Previously, system was applied first then messages replaced the
entire conversation prompt, losing the system message.
Add tests for prepareStep system/messages ordering:
- system only: prepended to prompt
- system + messages: system prepended to replaced messages
- system + messages with existing system: replaces existing
- system updates across multi-step tool call rounds
'@workflow/ai': patch
---

Fix `prepareStep` system message being discarded when `messages` is also returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add an e2e test for this to prevent regressions @TooTallNate? since we now have the DurableAgent e2e test infra as of this week :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also when relevant/possible, we should update the DurableAgent chat app to use the feature - for example when adding/fixing provider tools and client side tools, I would've been good to add that feature to the app as an easy way to try it and see if it actually works and the DX for it (the app didn't exist at the time and the friction to do a tarball and test with flight booking app is a bit annoying)

maybe this time we should have something in the DurableAgent test app that uses prepareStep?

@TooTallNate
TooTallNate merged commit 4a298b5 into mainMar 16, 2026
164 of 168 checks passed
@TooTallNate
TooTallNate deleted the fix/prepare-step-system-message-ordering branch March 16, 2026 22:37
@ghostghost mentioned this pull request Mar 16, 2026
gr2m added a commit to vercel/ai that referenced this pull request Mar 23, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit to vercel/ai that referenced this pull request Mar 24, 2026
## Summary
Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:
- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support
## Changes
- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls
## Test plan
- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)
---------
Co-authored-by: Claude Opus 4.6 (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.

4 participants

@TooTallNate@pranaygp@VaguelySerious