fix: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3
, '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: separate infrastructure vs user code error handling - #1339

Merged
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling
Mar 13, 2026
Merged

fix: separate infrastructure vs user code error handling#1339
TooTallNate merged 11 commits into
mainfrom
fix/separate-infra-user-error-handling

Conversation

@TooTallNate

@TooTallNateTooTallNate commented Mar 12, 2026

Copy link
Copy Markdown
Member

Summary

Transient network errors (ECONNRESET, etc.) during infrastructure calls (event listing, event creation) were caught by a shared try/catch that also handles user code errors, incorrectly marking runs as run_failed or steps as step_failed instead of letting the queue redeliver the message for retry.

This PR structurally separates infrastructure calls from user code execution and removes redundant in-process retry wrappers, relying on undici's RetryAgent and queue-level redelivery for transient error recovery.

Changes

Structural error separation (runtime.ts, step-handler.ts)

  • Infrastructure calls (world.runs.get(), getAllWorkflowRunEvents(), world.events.create(), getEncryptionKeyForRun(), input hydration, result dehydration) are outside the user-code try/catch. Errors propagate to the queue handler for automatic retry.
  • Only runWorkflow() / stepFn.apply() (user code) is wrapped in the try/catch that produces run_failed / step_failed.
  • WorkflowRuntimeError in infrastructure setup (data integrity issues like missing startedAt) now produces run_failed / step_failed instead of retrying forever via the queue.
  • Safety net in step handler re-throws WorkflowAPIError 5xx/410 from user code catch, preventing step attempt consumption on infra errors.

Removed in-process retry wrappers (helpers.ts)

  • withServerErrorRetry removed — redundant with undici's RetryAgent which retries 5xx at the HTTP dispatcher level.
  • withThrottleRetry removed — redundant with undici's RetryAgent configured with retryAfter: true for 429 handling.
  • isTransientNetworkError removed — no longer needed without withServerErrorRetry.

Test updates

  • Removed serverError5xxRetryWorkflow e2e test and its fault injection helpers from workbench/example/workflows/99_e2e.ts — this test specifically validated withServerErrorRetry behavior.
  • Removed unit tests for withServerErrorRetry, isTransientNetworkError, and withThrottleRetry.

…nd step handler
Transient network errors (ECONNRESET, etc.) during infrastructure calls
(event listing, event creation) were caught by a shared try/catch that
also handles user code errors, incorrectly marking runs as run_failed
or steps as step_failed instead of letting the queue redeliver.
- runtime.ts: Move infrastructure calls outside the user-code try/catch
so errors propagate to the queue handler for automatic retry
- step-handler.ts: Same structural separation — only stepFn.apply() is
wrapped in the try/catch that produces step_failed/step_retrying
- helpers.ts: Add isTransientNetworkError() and update withServerErrorRetry
to retry network errors in addition to 5xx responses
- helpers.test.ts: Add tests for network error detection and retry
@TooTallNate
TooTallNate requested a review from a team as a code ownerMarch 12, 2026 00:09
CopilotAI review requested due to automatic review settings March 12, 2026 00:09
@changeset-bot

changeset-botBot commented Mar 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa30093

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

This PR includes changesets to release 16 packages
NameType
@workflow/corePatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch
@workflow/aiPatch

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

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

@vercel

vercelBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-nextjs-workflow-webpackReadyReadyPreview, CommentMar 13, 2026 0:13am
example-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-astro-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-express-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-fastify-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-hono-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-nitro-workflowBuildingBuildingPreview, CommentMar 13, 2026 0:13am
workbench-nuxt-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-sveltekit-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workbench-vite-workflowReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-nestReadyReadyPreview, CommentMar 13, 2026 0:13am
workflow-swc-playgroundReadyReadyPreview, CommentMar 13, 2026 0:13am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
workflow-docsSkippedSkippedMar 13, 2026 0:13am

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

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

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.032s (~)1.006s (~)0.974s101.00x
💻 LocalExpress0.033s (+2.8%)1.006s (~)0.973s101.02x
🐘 PostgresExpress0.052s (+4.8%)1.011s (~)0.959s101.62x
🐘 PostgresNitro0.053s (+32.5% 🔺)1.012s (~)0.959s101.64x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)0.460s (-11.9% 🟢)2.298s (-79.4% 🟢)1.838s101.00x
▲ VercelNitro0.511s (-9.3% 🟢)1.948s (-83.4% 🟢)1.437s101.11x
▲ VercelExpress0.526s (+33.4% 🔺)2.459s (-64.7% 🟢)1.933s101.14x

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

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.102s (~)2.006s (~)0.904s101.00x
💻 LocalExpress1.104s (~)2.006s (~)0.902s101.00x
🐘 PostgresExpress1.120s (-1.1%)2.011s (~)0.891s101.02x
🐘 PostgresNitro1.122s (+2.8%)2.011s (~)0.889s101.02x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro1.943s (-6.5% 🟢)3.073s (-61.2% 🟢)1.129s101.00x
▲ VercelNext.js (Turbopack)1.995s (-6.3% 🟢)3.458s (-68.8% 🟢)1.463s101.03x
▲ VercelExpress1.999s (-4.2%)3.617s (-65.8% 🟢)1.618s101.03x

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

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Express10.786s (~)11.024s (~)0.238s31.00x
💻 LocalNitro10.786s (~)11.023s (~)0.238s31.00x
🐘 PostgresExpress10.808s (-0.9%)11.042s (~)0.234s31.00x
🐘 PostgresNitro10.843s (+2.4%)11.039s (~)0.196s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro16.329s (-5.1% 🟢)17.395s (-42.8% 🟢)1.066s21.00x
▲ VercelNext.js (Turbopack)16.883s (-1.7%)18.452s (-54.9% 🟢)1.569s21.03x
▲ VercelExpress17.239s (+3.1%)19.209s (-54.2% 🟢)1.970s21.06x

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

workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express26.910s (-0.6%)27.056s (-2.4%)0.146s31.00x
🐘 PostgresNitro26.979s (+2.3%)27.390s (+1.2%)0.411s31.00x
💻 LocalNitro27.200s (~)28.052s (~)0.852s31.01x
💻 LocalExpress27.208s (~)28.053s (~)0.844s31.01x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express43.069s (+0.5%)44.580s (-26.7% 🟢)1.511s21.00x
▲ VercelNext.js (Turbopack)43.089s (-2.9%)44.570s (-26.4% 🟢)1.481s21.00x
▲ VercelNitro43.816s (-9.5% 🟢)45.081s (-25.5% 🟢)1.264s21.02x

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

workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express53.803s (~)54.091s (~)0.288s21.00x
🐘 PostgresNitro53.824s (+2.1%)54.092s (+1.9%)0.268s21.00x
💻 LocalNitro56.010s (~)56.101s (-1.8%)0.091s21.04x
💻 LocalExpress56.072s (~)56.101s (-1.8%)0.029s21.04x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro94.768s (-0.7%)95.718s (-20.7% 🟢)0.950s11.00x
▲ VercelNext.js (Turbopack)95.520s (-5.7% 🟢)97.016s (-19.0% 🟢)1.496s11.01x
▲ VercelExpress98.340s (+4.0%)99.659s (-17.4% 🟢)1.319s11.04x

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

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.326s (+4.7%)2.010s (~)0.684s151.00x
🐘 PostgresExpress1.348s (~)2.010s (~)0.662s151.02x
💻 LocalNitro1.410s (-1.0%)2.005s (~)0.594s151.06x
💻 LocalExpress1.412s (-1.1%)2.006s (~)0.594s151.06x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.363s (+0.6%)3.795s (-43.9% 🟢)1.432s81.00x
▲ VercelNitro2.589s (+3.6%)3.561s (-55.4% 🟢)0.972s91.10x
▲ VercelNext.js (Turbopack)2.914s (+22.4% 🔺)4.133s (-63.9% 🟢)1.219s81.23x

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

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.439s (-1.0%)3.012s (~)0.574s101.00x
🐘 PostgresNitro2.483s (+3.3%)3.013s (~)0.530s101.02x
💻 LocalNitro2.558s (-2.1%)3.007s (~)0.450s101.05x
💻 LocalExpress2.619s (-1.1%)3.008s (~)0.389s101.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.449s (-20.9% 🟢)3.624s (-72.4% 🟢)1.175s91.00x
▲ VercelExpress2.946s (+1.6%)4.317s (-60.7% 🟢)1.371s71.20x
▲ VercelNext.js (Turbopack)3.023s (+7.9% 🔺)4.358s (-45.3% 🟢)1.335s71.23x

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

Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.916s (-2.7%)4.302s (-6.3% 🟢)0.385s71.00x
🐘 PostgresNitro3.927s (+9.3% 🔺)4.590s (+14.3% 🔺)0.663s71.00x
💻 LocalNitro7.248s (-6.5% 🟢)8.019s (~)0.770s41.85x
💻 LocalExpress7.567s (~)8.020s (~)0.453s41.93x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.139s (+9.4% 🔺)4.624s (+13.6% 🔺)1.485s71.00x
▲ VercelNitro3.178s (+11.1% 🔺)4.356s (-60.2% 🟢)1.178s71.01x
▲ VercelExpress3.336s (+18.3% 🔺)4.892s (-56.9% 🟢)1.556s71.06x

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

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro1.339s (+6.7% 🔺)2.010s (~)0.671s151.00x
🐘 PostgresExpress1.369s (+1.5%)2.010s (~)0.641s151.02x
💻 LocalNitro1.418s (-3.3%)2.004s (~)0.586s151.06x
💻 LocalExpress1.462s (+1.1%)2.005s (~)0.543s151.09x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)2.084s (-11.7% 🟢)3.506s (+1.0%)1.422s91.00x
▲ VercelExpress2.140s (-2.8%)3.610s (-55.0% 🟢)1.470s91.03x
▲ VercelNitro2.172s (-2.8%)3.223s (-65.9% 🟢)1.051s101.04x

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

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.447s (+0.9%)3.012s (~)0.565s101.00x
🐘 PostgresExpress2.465s (~)3.011s (~)0.546s101.01x
💻 LocalNitro2.669s (-3.0%)3.007s (~)0.338s101.09x
💻 LocalExpress2.710s (-2.2%)3.008s (~)0.298s101.11x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.152s (-16.2% 🟢)3.111s (-66.2% 🟢)0.958s101.00x
▲ VercelExpress2.535s (+3.0%)3.938s (-49.8% 🟢)1.403s91.18x
▲ VercelNext.js (Turbopack)2.706s (+10.0% 🔺)3.851s (-48.8% 🟢)1.145s81.26x

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

Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.938s (+6.2% 🔺)4.303s (+4.0%)0.365s71.00x
🐘 PostgresExpress3.939s (-2.3%)4.445s (-6.1% 🟢)0.506s71.00x
💻 LocalNitro7.687s (-7.9% 🟢)8.019s (-11.2% 🟢)0.332s41.95x
💻 LocalExpress8.146s (-0.9%)8.772s (-2.8%)0.626s42.07x
💻 LocalNext.js (Turbopack)⚠️missing----
🐘 PostgresNext.js (Turbopack)⚠️missing----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.747s (-14.6% 🟢)3.803s (-59.2% 🟢)1.055s81.00x
▲ VercelExpress2.924s (+4.2%)4.162s (-47.6% 🟢)1.238s81.06x
▲ VercelNext.js (Turbopack)3.057s (+12.4% 🔺)4.340s (-30.9% 🟢)1.282s71.11x

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

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.168s (-1.6%)1.002s (~)0.012s (+5.5% 🔺)1.017s (~)0.849s101.00x
💻 LocalExpress0.170s (~)1.003s (~)0.012s (+4.4%)1.017s (~)0.847s101.02x
🐘 PostgresNitro0.200s (+51.7% 🔺)0.991s (-0.9%)0.001s (-7.7% 🟢)1.012s (~)0.812s101.19x
🐘 PostgresExpress0.201s (+0.9%)0.992s (-0.5%)0.002s (+23.1% 🔺)1.012s (~)0.811s101.20x
💻 LocalNext.js (Turbopack)⚠️missing-----
🐘 PostgresNext.js (Turbopack)⚠️missing-----

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)1.527s (-6.5% 🟢)2.511s (-59.8% 🟢)0.006s (+7.4% 🔺)3.024s (-54.9% 🟢)1.497s101.00x
▲ VercelNitro1.528s (-15.1% 🟢)2.215s (-66.0% 🟢)0.005s (+10.9% 🔺)2.665s (-63.2% 🟢)1.137s101.00x
▲ VercelExpress1.599s (-7.0% 🟢)2.623s (-60.3% 🟢)0.006s (+7.4% 🔺)3.214s (-55.8% 🟢)1.615s101.05x

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

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro11/12
🐘 PostgresExpress7/12
▲ VercelNitro6/12
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres6/12
Next.js (Turbopack)▲ Vercel12/12
Nitro💻 Local4/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

@github-actions

github-actionsBot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

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

❌ Failed Tests

🌍 Community Worlds (55 failed)

mongodb (3 failed):

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

redis (2 failed):

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

turso (50 failed):

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

Details by Category

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

📋 View full workflow run

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 refactors the workflow and step runtimes to more explicitly separate “infrastructure” operations (hydration/serialization and event writes) from user code execution, and extends server-retry logic to include transient network failures so backend/network flakiness can be retried instead of incorrectly failing runs/steps.

Changes:

  • Refactors step execution flow to split input hydration, user step execution, and step completion into distinct phases.
  • Refactors workflow entrypoint flow to split run preparation, workflow replay execution, and run completion into distinct phases.
  • Adds transient network error detection and retries to withServerErrorRetry, plus corresponding unit tests.

Reviewed changes

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

Show a summary per file
FileDescription
packages/core/src/runtime/step-handler.tsRestructures step execution phases and error handling boundaries.
packages/core/src/runtime/helpers.tsAdds transient network error detection + expands withServerErrorRetry retry conditions.
packages/core/src/runtime/helpers.test.tsAdds tests covering network error retry behavior and isTransientNetworkError.
packages/core/src/runtime.tsRestructures workflow execution phases and moves run completion outside user-code try/catch.
.changeset/fix-infra-error-handling.mdRecords patch release note for infra vs user error handling changes.

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

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

Comment threadpackages/core/src/runtime/step-handler.ts
Comment threadpackages/core/src/runtime/helpers.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated

@vercelvercelBot 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.

Additional Suggestion:

Infrastructure call getEncryptionKeyForRun is inside the user-code try/catch block, causing transient network errors to be misclassified as user code failures (run_failed).

Fix on Vercel

Redundant with undici RetryAgent which already handles 5xx retries
and network error retries at the HTTP dispatcher level.
Comment threadpackages/core/e2e/e2e.test.ts
Comment threadpackages/core/src/runtime.ts

@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.

LGTM overall, there's a few cases I think we should do different though (if what Claude says applies)

Comment threadpackages/core/src/runtime/step-handler.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts Outdated
Comment threadpackages/core/src/runtime.ts
… as fatal, deduplicate check
- Remove withThrottleRetry (undici RetryAgent handles 429s)
- WorkflowRuntimeError in infrastructure setup now produces run_failed/step_failed
instead of retrying forever via queue
- Deduplicate redundant WorkflowAPIError.is check in step-handler.ts

@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.

LGTM assuming e2e tests pass

@ghostghost mentioned this pull request Mar 12, 2026
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.

5 participants

@TooTallNate@pranaygp@VaguelySerious@karthikscale3