Skip to content

test: validate sleep() works correctly inside loops#1415

Open
pranaygp wants to merge 2 commits intomainfrom
pgp/validate-v0-sleep-bug
Open

test: validate sleep() works correctly inside loops#1415
pranaygp wants to merge 2 commits intomainfrom
pgp/validate-v0-sleep-bug

Conversation

@pranaygp
Copy link
Collaborator

Summary

  • Adds an e2e test (sleepInLoopWorkflow) that validates sleep() inside a loop with step calls correctly delays each iteration
  • A user reported that sleep() in a loop fires all iterations instantly on replay — this test proves that's not the case
  • 3 iterations with 3s sleeps between each pair takes ~6s+ total, confirming sleep is honored

Test plan

  • Ran sleepInLoopWorkflow e2e test against local world (nextjs-turbopack dev server) — passed in ~8s

🤖 Generated with Claude Code

Validates a user-reported concern that sleep() inside a loop with step
calls fires all iterations instantly. The test confirms sleep is honored
on replay — 3 iterations with 3s sleeps take ~6s+ total elapsed time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pranaygp pranaygp requested a review from a team as a code owner March 17, 2026 01:12
Copilot AI review requested due to automatic review settings March 17, 2026 01:12
@vercel
Copy link
Contributor

vercel bot commented Mar 17, 2026

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

🦋 Changeset detected

Latest commit: 0070fa2

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

This PR includes changesets to release 16 packages
Name Type
@workflow/core Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
workflow Patch
@workflow/world-testing Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch
@workflow/ai Patch

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
Copy link
Contributor

github-actions bot commented Mar 17, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 725 0 67 792
✅ 💻 Local Development 752 0 112 864
✅ 📦 Local Production 752 0 112 864
❌ 🐘 Local Postgres 750 2 112 864
✅ 🪟 Windows 69 0 3 72
❌ 🌍 Community Worlds 118 56 15 189
✅ 📋 Other 189 0 27 216
Total 3355 58 448 3861

❌ Failed Tests

🐘 Local Postgres (2 failed)

express-stable (1 failed):

  • webhookWorkflow

nextjs-turbopack-canary (1 failed):

  • webhookWorkflow
🌍 Community Worlds (56 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (51 failed):

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

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 65 0 7
✅ example 65 0 7
✅ express 65 0 7
✅ fastify 65 0 7
✅ hono 65 0 7
✅ nextjs-turbopack 70 0 2
✅ nextjs-webpack 70 0 2
✅ nitro 65 0 7
✅ nuxt 65 0 7
✅ sveltekit 65 0 7
✅ vite 65 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 63 0 9
✅ express-stable 63 0 9
✅ fastify-stable 63 0 9
✅ hono-stable 63 0 9
✅ nextjs-turbopack-canary 55 0 17
✅ nextjs-turbopack-stable 69 0 3
✅ nextjs-webpack-canary 55 0 17
✅ nextjs-webpack-stable 69 0 3
✅ nitro-stable 63 0 9
✅ nuxt-stable 63 0 9
✅ sveltekit-stable 63 0 9
✅ vite-stable 63 0 9
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 63 0 9
✅ express-stable 63 0 9
✅ fastify-stable 63 0 9
✅ hono-stable 63 0 9
✅ nextjs-turbopack-canary 55 0 17
✅ nextjs-turbopack-stable 69 0 3
✅ nextjs-webpack-canary 55 0 17
✅ nextjs-webpack-stable 69 0 3
✅ nitro-stable 63 0 9
✅ nuxt-stable 63 0 9
✅ sveltekit-stable 63 0 9
✅ vite-stable 63 0 9
❌ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 63 0 9
❌ express-stable 62 1 9
✅ fastify-stable 63 0 9
✅ hono-stable 63 0 9
❌ nextjs-turbopack-canary 54 1 17
✅ nextjs-turbopack-stable 69 0 3
✅ nextjs-webpack-canary 55 0 17
✅ nextjs-webpack-stable 69 0 3
✅ nitro-stable 63 0 9
✅ nuxt-stable 63 0 9
✅ sveltekit-stable 63 0 9
✅ vite-stable 63 0 9
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 69 0 3
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 2
❌ mongodb 52 3 3
✅ redis-dev 3 0 2
❌ redis 53 2 3
✅ turso-dev 3 0 2
❌ turso 4 51 3
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 63 0 9
✅ e2e-local-postgres-nest-stable 63 0 9
✅ e2e-local-prod-nest-stable 63 0 9

📋 View full workflow run


Some E2E test jobs failed:

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

Check the workflow run for details.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Express 0.041s (-8.3% 🟢) 1.005s (-2.0%) 0.964s 10 1.00x
💻 Local Nitro 0.043s (~) 1.005s (~) 0.963s 10 1.03x
💻 Local Next.js (Turbopack) 0.048s 1.005s 0.957s 10 1.16x
🌐 Redis Next.js (Turbopack) 0.055s 1.005s 0.950s 10 1.33x
🐘 Postgres Next.js (Turbopack) 0.059s 1.011s 0.952s 10 1.44x
🐘 Postgres Nitro 0.060s (-3.8%) 1.011s (~) 0.951s 10 1.46x
🐘 Postgres Express 0.061s (-3.0%) 1.011s (~) 0.949s 10 1.49x
🌐 MongoDB Next.js (Turbopack) 0.117s 1.007s 0.890s 10 2.84x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 0.479s (+2.4%) 2.330s (-14.6% 🟢) 1.851s 10 1.00x
▲ Vercel Nitro 0.529s (-21.8% 🟢) 2.882s (+16.1% 🔺) 2.353s 10 1.11x
▲ Vercel Next.js (Turbopack) 0.741s (-22.2% 🟢) 2.626s (-11.6% 🟢) 1.886s 10 1.55x

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

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 1.108s 2.006s 0.898s 10 1.00x
🌐 Redis Next.js (Turbopack) 1.121s 2.006s 0.885s 10 1.01x
💻 Local Nitro 1.126s (~) 2.006s (~) 0.879s 10 1.02x
💻 Local Express 1.130s (+0.5%) 2.005s (~) 0.875s 10 1.02x
🐘 Postgres Express 1.141s (~) 2.012s (~) 0.870s 10 1.03x
🐘 Postgres Next.js (Turbopack) 1.145s 2.012s 0.868s 10 1.03x
🐘 Postgres Nitro 1.151s (~) 2.012s (~) 0.861s 10 1.04x
🌐 MongoDB Next.js (Turbopack) 1.296s 2.007s 0.711s 10 1.17x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 1.960s (-8.8% 🟢) 3.388s (-11.2% 🟢) 1.428s 10 1.00x
▲ Vercel Nitro 1.992s (-23.6% 🟢) 3.569s (-24.0% 🟢) 1.576s 10 1.02x
▲ Vercel Express 2.026s (-2.4%) 3.716s (+2.0%) 1.690s 10 1.03x

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

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 10.744s 11.022s 0.278s 3 1.00x
🌐 Redis Next.js (Turbopack) 10.756s 11.023s 0.268s 3 1.00x
🐘 Postgres Next.js (Turbopack) 10.885s 11.040s 0.155s 3 1.01x
🐘 Postgres Nitro 10.886s (~) 11.043s (~) 0.157s 3 1.01x
💻 Local Nitro 10.894s (~) 11.023s (~) 0.129s 3 1.01x
💻 Local Express 10.897s (~) 11.024s (~) 0.127s 3 1.01x
🐘 Postgres Express 10.923s (~) 11.040s (~) 0.116s 3 1.02x
🌐 MongoDB Next.js (Turbopack) 12.223s 13.022s 0.798s 3 1.14x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 16.343s (-3.5%) 17.890s (-2.0%) 1.548s 2 1.00x
▲ Vercel Nitro 17.003s (-2.8%) 19.774s (-2.6%) 2.772s 2 1.04x
▲ Vercel Next.js (Turbopack) 17.180s (-2.0%) 18.747s (-2.4%) 1.567s 2 1.05x

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

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🌐 Redis 🥇 Next.js (Turbopack) 26.717s 27.050s 0.333s 3 1.00x
🐘 Postgres Next.js (Turbopack) 27.081s 27.726s 0.645s 3 1.01x
🐘 Postgres Express 27.126s (~) 28.062s (~) 0.936s 3 1.02x
🐘 Postgres Nitro 27.172s (~) 28.068s (~) 0.896s 3 1.02x
💻 Local Next.js (Turbopack) 27.176s 28.050s 0.874s 3 1.02x
💻 Local Nitro 27.456s (~) 28.050s (~) 0.595s 3 1.03x
💻 Local Express 27.481s (~) 28.050s (~) 0.569s 3 1.03x
🌐 MongoDB Next.js (Turbopack) 30.313s 31.030s 0.717s 2 1.13x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 43.184s (-0.8%) 44.712s (-1.9%) 1.528s 2 1.00x
▲ Vercel Next.js (Turbopack) 43.413s (-1.3%) 44.549s (-4.1%) 1.136s 2 1.01x
▲ Vercel Express 44.741s (+2.0%) 46.704s (+1.6%) 1.963s 2 1.04x

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

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🌐 Redis 🥇 Next.js (Turbopack) 53.387s 54.098s 0.711s 2 1.00x
🐘 Postgres Next.js (Turbopack) 53.884s 54.107s 0.223s 2 1.01x
🐘 Postgres Express 54.153s (~) 54.593s (-0.9%) 0.440s 2 1.01x
🐘 Postgres Nitro 54.176s (~) 55.104s (~) 0.928s 2 1.01x
💻 Local Next.js (Turbopack) 55.781s 56.098s 0.317s 2 1.04x
💻 Local Nitro 56.554s (~) 57.100s (~) 0.546s 2 1.06x
💻 Local Express 56.621s (~) 57.103s (~) 0.482s 2 1.06x
🌐 MongoDB Next.js (Turbopack) 60.612s 61.057s 0.445s 2 1.14x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 93.594s (+0.8%) 95.908s (+1.8%) 2.314s 1 1.00x
▲ Vercel Next.js (Turbopack) 94.159s (-2.3%) 95.394s (-3.2%) 1.235s 1 1.01x
▲ Vercel Nitro 94.378s (-1.5%) 96.247s (-1.7%) 1.869s 1 1.01x

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

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🌐 Redis 🥇 Next.js (Turbopack) 1.330s 2.006s 0.676s 15 1.00x
🐘 Postgres Express 1.418s (-4.4%) 2.011s (~) 0.592s 15 1.07x
🐘 Postgres Nitro 1.433s (-0.7%) 2.011s (~) 0.578s 15 1.08x
🐘 Postgres Next.js (Turbopack) 1.459s 2.011s 0.553s 15 1.10x
💻 Local Express 1.492s (+0.8%) 2.006s (~) 0.514s 15 1.12x
💻 Local Nitro 1.502s (+0.7%) 2.005s (~) 0.504s 15 1.13x
💻 Local Next.js (Turbopack) 1.513s 2.005s 0.492s 15 1.14x
🌐 MongoDB Next.js (Turbopack) 2.154s 3.008s 0.854s 10 1.62x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.430s (+6.1% 🔺) 3.841s (-2.0%) 1.411s 8 1.00x
▲ Vercel Next.js (Turbopack) 2.586s (+2.8%) 4.696s (+14.6% 🔺) 2.109s 7 1.06x
▲ Vercel Nitro 3.152s (+16.4% 🔺) 5.374s (+22.5% 🔺) 2.222s 6 1.30x

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

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 2.510s 3.007s 0.497s 10 1.00x
🐘 Postgres Express 2.554s (-1.8%) 3.013s (~) 0.459s 10 1.02x
🌐 Redis Next.js (Turbopack) 2.563s 3.008s 0.445s 10 1.02x
🐘 Postgres Nitro 2.594s (~) 3.015s (~) 0.422s 10 1.03x
🐘 Postgres Next.js (Turbopack) 2.805s 3.214s 0.409s 10 1.12x
💻 Local Nitro 2.838s (-0.7%) 3.007s (-10.0% 🟢) 0.169s 10 1.13x
💻 Local Express 2.917s (-1.3%) 3.452s (+4.4%) 0.535s 9 1.16x
🌐 MongoDB Next.js (Turbopack) 4.808s 5.177s 0.370s 6 1.92x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.671s (+6.0% 🔺) 5.049s (+15.0% 🔺) 2.377s 7 1.00x
▲ Vercel Next.js (Turbopack) 2.688s (+0.9%) 4.027s (-13.1% 🟢) 1.339s 8 1.01x
▲ Vercel Nitro 2.845s (+6.0% 🔺) 4.472s (+7.4% 🔺) 1.628s 7 1.06x

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

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 3.938s (-1.3%) 4.445s (~) 0.507s 7 1.00x
🐘 Postgres Nitro 3.966s (-0.6%) 4.446s (-6.0% 🟢) 0.480s 7 1.01x
🌐 Redis Next.js (Turbopack) 4.143s 5.012s 0.869s 6 1.05x
🐘 Postgres Next.js (Turbopack) 4.293s 5.016s 0.723s 6 1.09x
💻 Local Next.js (Turbopack) 6.660s 7.514s 0.854s 4 1.69x
💻 Local Nitro 7.909s (-3.1%) 8.519s (-5.6% 🟢) 0.610s 4 2.01x
💻 Local Express 8.087s (-0.8%) 9.018s (+2.8%) 0.931s 4 2.05x
🌐 MongoDB Next.js (Turbopack) 9.902s 10.348s 0.447s 3 2.51x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 2.908s (-23.5% 🟢) 4.742s (-14.1% 🟢) 1.833s 7 1.00x
▲ Vercel Express 3.174s (-7.7% 🟢) 4.887s (-4.9%) 1.713s 7 1.09x
▲ Vercel Nitro 3.236s (+5.8% 🔺) 5.134s (+12.3% 🔺) 1.897s 6 1.11x

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

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🌐 Redis 🥇 Next.js (Turbopack) 1.306s 2.007s 0.701s 15 1.00x
🐘 Postgres Nitro 1.372s (-3.5%) 2.011s (~) 0.640s 15 1.05x
🐘 Postgres Next.js (Turbopack) 1.419s 2.011s 0.592s 15 1.09x
🐘 Postgres Express 1.468s (+6.1% 🔺) 2.078s (+3.3%) 0.610s 15 1.12x
💻 Local Next.js (Turbopack) 1.484s 2.005s 0.521s 15 1.14x
💻 Local Nitro 1.493s (-2.5%) 2.005s (~) 0.511s 15 1.14x
💻 Local Express 1.512s (-1.3%) 2.006s (~) 0.494s 15 1.16x
🌐 MongoDB Next.js (Turbopack) 2.178s 3.007s 0.830s 10 1.67x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 2.062s (-7.6% 🟢) 3.973s (+5.4% 🔺) 1.911s 8 1.00x
▲ Vercel Nitro 2.168s (-8.1% 🟢) 3.586s (-21.2% 🟢) 1.418s 9 1.05x
▲ Vercel Express 2.512s (-3.7%) 4.328s (-2.8%) 1.817s 7 1.22x

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

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🌐 Redis 🥇 Next.js (Turbopack) 2.528s 3.008s 0.479s 10 1.00x
🐘 Postgres Express 2.548s (+1.3%) 3.013s (~) 0.465s 10 1.01x
🐘 Postgres Nitro 2.585s (-2.9%) 3.013s (-3.2%) 0.427s 10 1.02x
🐘 Postgres Next.js (Turbopack) 2.600s 3.015s 0.415s 10 1.03x
💻 Local Next.js (Turbopack) 2.700s 3.208s 0.508s 10 1.07x
💻 Local Nitro 2.915s (-4.5%) 3.309s (-14.8% 🟢) 0.394s 10 1.15x
💻 Local Express 2.999s (~) 3.454s (-3.1%) 0.455s 9 1.19x
🌐 MongoDB Next.js (Turbopack) 4.688s 5.176s 0.488s 6 1.85x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.378s (-0.9%) 3.780s (-6.8% 🟢) 1.402s 8 1.00x
▲ Vercel Express 2.598s (-6.0% 🟢) 4.235s (+3.3%) 1.637s 8 1.09x
▲ Vercel Next.js (Turbopack) 2.666s (+6.7% 🔺) 4.657s (+17.0% 🔺) 1.991s 7 1.12x

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

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 3.969s (-2.8%) 4.589s (+3.2%) 0.619s 7 1.00x
🐘 Postgres Express 4.018s (+1.7%) 4.447s (-3.1%) 0.429s 7 1.01x
🌐 Redis Next.js (Turbopack) 4.085s 4.726s 0.641s 7 1.03x
🐘 Postgres Next.js (Turbopack) 4.196s 5.016s 0.820s 6 1.06x
💻 Local Next.js (Turbopack) 7.611s 8.268s 0.658s 4 1.92x
💻 Local Express 8.629s (-1.2%) 9.022s (~) 0.393s 4 2.17x
💻 Local Nitro 8.894s (-4.3%) 9.272s (-7.5% 🟢) 0.378s 4 2.24x
🌐 MongoDB Next.js (Turbopack) 9.796s 10.348s 0.552s 3 2.47x

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 2.859s (+7.7% 🔺) 5.067s (+29.9% 🔺) 2.208s 6 1.00x
▲ Vercel Express 3.082s (+11.6% 🔺) 5.116s (+26.5% 🔺) 2.035s 6 1.08x
▲ Vercel Next.js (Turbopack) 3.093s (-13.0% 🟢) 4.670s (-14.5% 🟢) 1.578s 7 1.08x

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

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Next.js (Turbopack) 0.165s 1.002s 0.011s 1.017s 0.853s 10 1.00x
🌐 Redis Next.js (Turbopack) 0.171s 1.000s 0.002s 1.007s 0.836s 10 1.04x
💻 Local Nitro 0.191s (-3.4%) 1.003s (~) 0.012s (-0.9%) 1.017s (~) 0.826s 10 1.16x
💻 Local Express 0.196s (~) 1.003s (~) 0.011s (-2.6%) 1.018s (~) 0.822s 10 1.19x
🐘 Postgres Next.js (Turbopack) 0.202s 1.001s 0.002s 1.013s 0.811s 10 1.22x
🐘 Postgres Express 0.214s (-3.5%) 0.994s (~) 0.001s (+8.3% 🔺) 1.012s (~) 0.798s 10 1.30x
🐘 Postgres Nitro 0.215s (-2.4%) 0.995s (~) 0.002s (+15.4% 🔺) 1.012s (~) 0.797s 10 1.31x
🌐 MongoDB Next.js (Turbopack) 0.508s 0.941s 0.002s 1.008s 0.500s 10 3.09x

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Nitro 1.564s (-2.0%) 2.820s (+4.7%) 0.005s (-96.3% 🟢) 3.349s (-2.1%) 1.785s 10 1.00x
▲ Vercel Express 1.599s (-15.5% 🟢) 2.627s (+15.3% 🔺) 0.005s (-21.9% 🟢) 15.311s (+382.0% 🔺) 13.712s 10 1.02x
▲ Vercel Next.js (Turbopack) 1.696s (-1.2%) 3.010s (+10.9% 🔺) 0.006s (+33.3% 🔺) 3.611s (+2.8%) 1.914s 10 1.08x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Next.js (Turbopack) 10/12
🐘 Postgres Next.js (Turbopack) 5/12
▲ Vercel Express 5/12
Fastest World by Framework

Winner determined by most benchmark wins

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

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an end-to-end regression test to ensure sleep() calls inside a loop (interleaved with step calls) introduce real delays between iterations, addressing a reported “instant replay” concern.

Changes:

  • Add sleepInLoopWorkflow and a supporting step (noopStep) to the example e2e workflows.
  • Add a new core e2e test asserting the workflow shows elapsed time consistent with loop sleeps.
  • Add a changeset bumping @workflow/core (patch) for the added e2e coverage.

Reviewed changes

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

File Description
workbench/example/workflows/99_e2e.ts Adds a new workflow + step that records timestamps across loop iterations separated by sleep() calls.
packages/core/e2e/e2e.test.ts Adds an e2e test that runs the new workflow and asserts the elapsed time indicates sleeps occurred.
.changeset/add-sleep-in-loop-e2e-test.md Publishes a patch changeset for @workflow/core tied to the new e2e test.

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

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

export async function sleepInLoopWorkflow() {
'use workflow';
const iterations = 3;
const sleepMs = 3_000; // 3s per iteration
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed — changed to "3s between iterations (2 sleeps total)".

const run = await start(await e2e('sleepInLoopWorkflow'), []);
const returnValue = await run.returnValue;

// 3 iterations with 3s sleep between each pair = ~6s minimum total elapsed
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the comment to say "2.5s threshold per sleep to allow jitter" which matches the actual assertion.

const returnValue = await run.returnValue;

// 3 iterations with 3s sleep between each pair = ~6s minimum total elapsed
expect(returnValue.timestamps).toHaveLength(3);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call — added per-iteration delta assertions (delta1 > 2500 and delta2 > 2500) so each individual sleep is validated.

- Fix misleading "3s per iteration" comment to "3s between iterations"
- Update test comment to reflect 2.5s jitter-tolerant threshold
- Add per-iteration delta assertions to ensure each individual sleep fires

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants