Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

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

Fix race condition in streamer when multiple writes share a promise runId - #704

Merged
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid
Dec 30, 2025
Merged

Fix race condition in streamer when multiple writes share a promise runId#704
VaguelySerious merged 1 commit into
mainfrom
12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Dec 29, 2025

Copy link
Copy Markdown
Member

ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order. This prevents race conditions when multiple write operations share the same promise runId.

The fix moves the ULID generation to occur before any await operations in both writeToStream and closeStream methods, preserving the sequence of operations even when multiple calls are waiting on the same promise.

This is an attempt to fix flaky unit test runs seen on Windows, such as here: https://github.com/vercel/workflow/actions/runs/20580915177/job/59108005932?pr=703

…unId
ULID generation now happens synchronously before awaiting the runId, ensuring chunks maintain their call order.
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1112653

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

This PR includes changesets to release 14 packages
NameType
@workflow/world-localPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/world-postgresPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/web-sharedPatch
@workflow/aiPatch
@workflow/astroPatch
@workflow/sveltekitPatch
@workflow/nuxtPatch

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 Dec 29, 2025

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🥇 Next.js (Turbopack)0.038s (-4.0%)1.017s (~)0.979s101.00x
🌐 StarterNext.js (Turbopack)0.040s (+10.8% 🔺)1.015s (~)0.975s101.05x
🌐 RedisNext.js (Turbopack)0.042s (+3.7%)1.018s (~)0.976s101.10x
💻 LocalExpress0.043s (+37.3% 🔺)1.007s (~)0.964s101.14x
💻 LocalNitro0.044s (-5.6% 🟢)1.006s (-0.8%)0.963s101.14x
🌐 MongoDBNext.js (Turbopack)0.056s (-50.4% 🟢)1.015s (~)0.959s101.47x
🌐 TursoNext.js (Turbopack)0.106s (+11.7% 🔺)1.014s (~)0.908s102.77x
🐘 PostgresNext.js (Turbopack)0.185s (-49.8% 🟢)1.020s (~)0.834s104.85x
🐘 PostgresExpress0.186s (-43.5% 🟢)1.030s (+1.5%)0.845s104.86x
🐘 PostgresNitro0.276s (+2.2%)1.033s (+2.0%)0.757s107.22x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.591s (-32.2% 🟢)1.633s (-13.0% 🟢)1.042s101.00x
▲ VercelNitro0.633s (-16.7% 🟢)1.475s (-11.2% 🟢)0.842s101.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.094s (~)2.010s (~)0.916s101.00x
💻 LocalNext.js (Turbopack)1.096s (~)2.011s (~)0.915s101.00x
🌐 RedisNext.js (Turbopack)1.101s (~)2.013s (~)0.912s101.01x
💻 LocalExpress1.113s (+3.2%)2.006s (~)0.894s101.02x
💻 LocalNitro1.113s (~)2.007s (~)0.893s101.02x
🌐 MongoDBNext.js (Turbopack)1.303s (~)2.013s (~)0.710s101.19x
🌐 TursoNext.js (Turbopack)1.314s (~)2.012s (~)0.698s101.20x
🐘 PostgresNext.js (Turbopack)2.414s (+15.7% 🔺)3.016s (+19.8% 🔺)0.602s102.21x
🐘 PostgresNitro2.422s (+13.9% 🔺)3.017s (~)0.595s102.21x
🐘 PostgresExpress2.470s (+14.1% 🔺)3.016s (~)0.546s102.26x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.044s (+3.2%)3.896s (+2.6%)0.852s101.00x
▲ VercelNitro3.061s (+6.5% 🔺)3.836s (-4.0%)0.776s101.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)10.587s (~)11.011s (~)0.424s51.00x
💻 LocalNext.js (Turbopack)10.668s (~)11.019s (~)0.351s51.01x
🌐 RedisNext.js (Turbopack)10.707s (~)11.017s (~)0.311s51.01x
💻 LocalNitro10.787s (~)11.013s (~)0.226s51.02x
💻 LocalExpress10.797s (+2.7%)11.012s (~)0.215s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.028s (~)0.844s51.15x
🌐 MongoDBNext.js (Turbopack)12.282s (~)13.030s (~)0.748s51.16x
🐘 PostgresNext.js (Turbopack)20.266s (+34.3% 🔺)21.045s (+32.9% 🔺)0.779s51.91x
🐘 PostgresNitro20.273s (-1.0%)21.044s (~)0.771s51.91x
🐘 PostgresExpress20.288s (-1.0%)21.041s (~)0.753s51.92x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)22.707s (-3.2%)24.461s (+2.1%)1.754s51.00x
▲ VercelNitro24.214s (+6.6% 🔺)24.926s (+7.1% 🔺)0.712s51.07x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.350s (~)2.008s (~)0.658s151.00x
🌐 RedisNext.js (Turbopack)1.367s (+0.6%)2.011s (~)0.645s151.01x
💻 LocalNext.js (Turbopack)1.376s (-1.0%)2.011s (~)0.635s151.02x
💻 LocalExpress1.412s (+6.6% 🔺)2.006s (~)0.594s151.05x
💻 LocalNitro1.418s (-0.5%)2.006s (~)0.588s151.05x
🌐 MongoDBNext.js (Turbopack)2.131s (~)3.014s (~)0.883s101.58x
🌐 TursoNext.js (Turbopack)2.209s (~)3.013s (~)0.804s101.64x
🐘 PostgresNext.js (Turbopack)2.212s (+14.6% 🔺)2.686s (+20.4% 🔺)0.474s121.64x
🐘 PostgresExpress2.563s (+7.9% 🔺)3.014s (~)0.451s101.90x
🐘 PostgresNitro2.571s (+7.9% 🔺)3.018s (~)0.447s101.90x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.372s (-7.9% 🟢)4.182s (-8.8% 🟢)0.809s81.00x
▲ VercelNitro3.443s (+24.2% 🔺)4.013s (+9.9% 🔺)0.570s81.02x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.981s (-8.6% 🟢)2.783s (-10.8% 🟢)0.802s111.00x
💻 LocalExpress2.203s (+9.5% 🔺)3.150s (+21.0% 🔺)0.947s101.11x
💻 LocalNitro2.220s (-0.9%)3.159s (~)0.939s101.12x
🌐 StarterNext.js (Turbopack)2.471s (+0.7%)3.032s (+0.8%)0.561s101.25x
🌐 RedisNext.js (Turbopack)2.539s (+2.7%)3.015s (~)0.476s101.28x
🐘 PostgresNext.js (Turbopack)2.626s (~)3.015s (~)0.389s101.33x
🐘 PostgresExpress2.950s (-5.2% 🟢)3.114s (-17.5% 🟢)0.164s101.49x
🐘 PostgresNitro3.112s (+3.1%)3.627s (+1.1%)0.514s91.57x
🌐 MongoDBNext.js (Turbopack)4.694s (~)5.179s (~)0.485s62.37x
🌐 TursoNext.js (Turbopack)4.705s (-1.2%)5.185s (~)0.480s62.38x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.951s (+13.4% 🔺)4.583s (+11.5% 🔺)0.633s71.00x
▲ VercelNitro4.872s (-3.5%)5.753s (-6.4% 🟢)0.881s61.23x
▲ VercelExpress⚠️missing----

🔍 Observability: Next.js (Turbopack) | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)1.368s (+1.5%)2.007s (~)0.639s151.00x
🌐 RedisNext.js (Turbopack)1.382s (+2.0%)2.011s (~)0.629s151.01x
💻 LocalNext.js (Turbopack)1.412s (+0.5%)2.014s (~)0.602s151.03x
💻 LocalNitro1.417s (-1.0%)2.006s (~)0.589s151.04x
💻 LocalExpress1.440s (+6.4% 🔺)2.006s (~)0.566s151.05x
🐘 PostgresNext.js (Turbopack)1.646s (-12.7% 🟢)2.012s (~)0.365s151.20x
🐘 PostgresExpress1.930s (+1.0%)2.088s (+3.4%)0.158s151.41x
🐘 PostgresNitro1.963s (+6.5% 🔺)2.335s (+16.1% 🔺)0.372s131.43x
🌐 MongoDBNext.js (Turbopack)2.136s (~)3.013s (~)0.877s101.56x
🌐 TursoNext.js (Turbopack)2.235s (~)3.013s (~)0.778s101.63x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.859s (+0.8%)3.608s (-0.5%)0.749s91.00x
▲ VercelNext.js (Turbopack)2.886s (-9.9% 🟢)3.774s (-8.5% 🟢)0.888s81.01x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.253s (+6.7% 🔺)3.135s (+4.1%)0.882s101.00x
💻 LocalNitro2.266s (+1.1%)3.175s (~)0.909s101.01x
💻 LocalExpress2.286s (+9.5% 🔺)3.208s (+4.8%)0.921s101.01x
🌐 StarterNext.js (Turbopack)2.485s (+1.6%)3.009s (~)0.524s101.10x
🌐 RedisNext.js (Turbopack)2.506s (+1.6%)3.013s (~)0.507s101.11x
🐘 PostgresNext.js (Turbopack)2.562s (-5.0%)3.023s (~)0.461s101.14x
🐘 PostgresNitro2.637s (-6.1% 🟢)3.022s (-3.3%)0.385s101.17x
🐘 PostgresExpress2.812s (+2.2%)3.124s (+3.6%)0.313s101.25x
🌐 MongoDBNext.js (Turbopack)4.628s (~)5.189s (~)0.562s62.05x
🌐 TursoNext.js (Turbopack)4.722s (-1.8%)5.184s (~)0.462s62.10x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.371s (+1.0%)3.977s (-0.8%)0.606s81.00x
▲ VercelNext.js (Turbopack)4.011s (-8.9% 🟢)4.650s (-10.7% 🟢)0.639s71.19x
▲ VercelExpress⚠️missing----

🔍 Observability: Nitro | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Starter🥇 Next.js (Turbopack)0.125s (-7.9% 🟢)1.006s (~)0.000s (+Infinity% 🔺)1.012s (~)0.886s101.00x
💻 LocalNext.js (Turbopack)0.140s (+2.8%)1.004s (~)0.016s (-13.2% 🟢)1.028s (~)0.888s101.12x
🌐 RedisNext.js (Turbopack)0.149s (+6.9% 🔺)1.004s (~)0.000s (+Infinity% 🔺)1.014s (~)0.864s101.20x
💻 LocalNitro0.174s (-3.6%)0.993s (~)0.015s (-2.7%)1.021s (~)0.847s101.39x
💻 LocalExpress0.175s (+58.0% 🔺)0.992s (-0.7%)0.015s (+2.0%)1.022s (~)0.847s101.40x
🌐 MongoDBNext.js (Turbopack)0.478s (-7.3% 🟢)0.973s (+4.0%)0.000s (-100.0% 🟢)1.012s (~)0.534s103.82x
🌐 TursoNext.js (Turbopack)0.488s (-3.7%)0.965s (+2.0%)0.000s (-100.0% 🟢)1.014s (~)0.526s103.90x
🐘 PostgresExpress1.778s (-22.1% 🟢)2.170s (-21.4% 🟢)0.000s (NaN%)2.419s (-19.8% 🟢)0.641s1014.21x
🐘 PostgresNext.js (Turbopack)2.243s (+96.6% 🔺)2.805s (+47.3% 🔺)0.000s (NaN%)3.018s (+49.6% 🔺)0.775s1017.93x
🐘 PostgresNitro2.333s (+2.3%)2.729s (-1.3%)0.000s (NaN%)3.026s (~)0.692s1018.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.909s (-17.4% 🟢)3.303s (-9.0% 🟢)0.364s (-54.0% 🟢)4.141s (-18.1% 🟢)1.231s101.00x
▲ VercelNitro3.063s (-8.0% 🟢)3.306s (-8.2% 🟢)1.058s (+109.0% 🔺)4.901s (+5.6% 🔺)1.838s101.05x
▲ VercelExpress⚠️missing-----

🔍 Observability: Next.js (Turbopack) | Nitro

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNext.js (Turbopack)6/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)🌐 Starter5/8
Nitro💻 Local8/8
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
  • 🌐 Starter: Community world (local development)
  • 🌐 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: success
  • Vercel: failure

Check the workflow run for details.

@vercel

vercelBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds25950120
Total1097122351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (95 failed)

mongodb (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

redis-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

redis (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso-dev (3 failed):

  • dev e2e should rebuild on step change
  • dev e2e should rebuild on workflow change
  • dev e2e should rebuild on adding workflow file

turso (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • 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 endpoint - workflow and step endpoints respond to __health query parameter

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb0270
❌ redis-dev030
❌ redis0270
✅ starter-dev300
❌ starter1980
❌ turso-dev030
❌ turso0270

📋 View full workflow run

@TooTallNateGraphite App

Copy link
Copy Markdown
MemberAuthor

This stack of pull requests is managed by Graphite. Learn more about stacking.

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

This PR fixes a race condition in the streamer when multiple write operations share the same promise-based runId. The fix moves ULID generation to occur synchronously before any await operations, ensuring that chunks maintain their chronological order even when multiple calls are waiting on the same promise to resolve.

  • Moved monotonicUlid() calls before await statements in both writeToStream and closeStream methods
  • Updated test to correctly extract ULID from chunk filenames
  • Added comprehensive comments explaining the race condition fix

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
packages/world-local/src/streamer.tsMoved ULID generation before await operations in both writeToStream and closeStream to preserve call order and prevent race conditions
packages/world-local/src/streamer.test.tsFixed ULID extraction logic in test error diagnostics to correctly parse the "chnk_" prefix from filenames
.changeset/quiet-streams-order.mdAdded changeset documenting the race condition fix as a patch release

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

@VaguelySeriousVaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💡

@VaguelySerious
VaguelySerious merged commit 2dbe494 into mainDec 30, 2025
149 of 151 checks passed
@VaguelySerious
VaguelySerious deleted the 12-29-fix_race_condition_in_streamer_when_multiple_writes_share_a_promise_runid branch December 30, 2025 09:35
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.

3 participants

@TooTallNate@VaguelySerious