Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate
, '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

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code - #3687

Merged
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable
Aug 20, 2026
Merged

Backport #3675: fix(core): make step-argument serialization failures catchable in workflow code#3687
TooTallNate merged 1 commit into
stablefrom
backport/pr-3675-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #3675 to stable (backport job run).

AI recommendation: This is a stability fix for a defect that exists on stable: a step whose arguments fail to serialize fails the run from outside the workflow, unobservable to user code, and on v4 the orchestrator message redelivers until max-deliveries exhaustion — the production failure a customer on stable reported. The non-test changes are confined to packages/core runtime paths plus a docs/content/ correction, all of which are maintained on stable, and the only additive bits (a telemetry attribute, e2e fixtures) are incidental to the fix. Note for the reviewer: stable has drifted substantially here — no SerializationError class in packages/errors, an older suspension-handler.ts, and no step-executor.ts or QuickJS engine files at all — so most of this diff has no target and the port will be a rewrite of the same fix rather than a cherry-pick.

Merge conflicts were resolved by AI (opencode with anthropic/claude-opus-5). Please review the conflict resolution carefully before merging.

…kflow code (#3675)
* fix(core): make step-argument serialization failures catchable in workflow code
A step whose arguments fail to serialize is now finalized by the
suspension handler as step_created + step_failed (mirroring a step-body
failure) instead of rejecting the whole suspension. The next replay —
forced in-process, since no step message is dispatched for the failed
step — rejects the step's promise with the SerializationError, so a
try/catch around the step call observes it. Uncaught, the error
propagates out of the workflow body and fails the run as a fatal
USER_ERROR immediately, instead of redelivering the orchestrator
message until max deliveries (49/48) as reported in production on v4.
* Serialize the step_failed error with the VM global; one-sentence changeset
Addresses review feedback: dehydrateStepError in
finalizeUnserializableStep now receives suspension.globalThis like every
other dehydration in this file. Error detection is realm-independent, so
the host-created SerializationError serializes identically, but VM-realm
values guest code threw into the cause chain are now detected by the
realm-sensitive reducers.
* Address review: QuickJS engine support, deferred-batch join, drain gate, placeholder marker, telemetry, docs
- QuickJS: dumpPendingOps now catches a step input's serialization
failure per-op, reframes it as a SerializationError with the same
framed message as dehydrateStepArguments, and surfaces it on the
pending op instead of failing the whole collection. The entrypoint's
dispatchPendingOps finalizes such steps as step_created (placeholder
input) + step_failed, excludes them from inline claims and queue
publishes, marks them handled, and raises the requeue signal so the
failure is observed even when the feed lags — mirroring the node:vm
engine, so both engines agree: catchable in workflow code, USER_ERROR
with the framed message when uncaught. Both step-argument e2e tests
now pass on WORKFLOW_VM=quickjs.
- runtime.ts: the failed-step replay path now joins
suspensionResult.deferredBatchWork before continuing, so a trailing
chunk commit or step-message publish rejection propagates instead of
being swallowed after ack; committed inline claims are documented as
deliberately handed to owned recovery.
- Terminal drain: finalization is gated on a stepDispatch target. The
drain caller has no replay to observe a finalization, so a completed
run no longer gains failed-step rows for an unawaited unserializable
step — the rethrown error is swallowed by the drain's catch,
preserving its pre-existing behavior.
- The placeholder input now carries a marker string ('[input
unavailable: step argument serialization failed]', shared via
runtime/unserializable-step.ts) so inspect/o11y don't render the
failed step as a genuine zero-argument call.
- New workflow.steps.failed_serialization span attribute on the
suspension span, so occurrence is measurable without log search.
- Docs: v5 serialization-failed error page documents where each
boundary's failure surfaces (catchable step failure vs run failure)
and the no-retry USER_ERROR semantics; foundations/errors-and-retries
gains a Serialization Failures section with the try/catch shape.
* Guard the finalization crash window; self-contained docs samples
- A crash or transient failure between finalization's two durable
writes leaves a lone placeholder step_created, and redelivery then
dispatches the step through normal crash recovery — previously
running user code with the placeholder arguments. The placeholder
now carries a structural flag on the input triple's top level (which
user code never controls, so no false positives), and the step
executor checks it after hydration: instead of running the body, it
throws the intended fatal SerializationError, completing the
interrupted finalization as step_failed. Applies to both engines
(they share the placeholder and the executor).
- Regression tests: executor fails a placeholder-input step without
running the body (and doesn't trip on a genuine argument equal to
the display marker); handleSuspension rejects for redelivery when
step_failed can't be written after step_created landed, leaving the
recoverable placeholder behind; mixed bad-step + large fan-out
returns the failure set alongside still-pending deferredBatchWork
whose rejection surfaces — the contract the runtime's failed-step
join (added previously) relies on.
- Docs: the two new code samples are now self-contained so the docs
code-sample typecheck passes.
Signed-off-by: Nathan Rajlich <n@n8.io>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6ff2141

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
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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

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

@vercel

vercelBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
example-nextjs-workflow-turbopackReadyReadyPreviewAug 20, 2026 1:01am
example-nextjs-workflow-webpackReadyReadyPreviewAug 20, 2026 1:01am
example-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-astro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-express-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-fastify-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-hono-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nestjs-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nitro-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-nuxt-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-python-workflowErrorErrorAug 20, 2026 1:01am
workbench-sveltekit-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-tanstack-start-workflowReadyReadyPreviewAug 20, 2026 1:01am
workbench-vite-workflowReadyReadyPreviewAug 20, 2026 1:01am
workflow-docsReadyReadyPreview, v0Aug 20, 2026 1:01am
workflow-swc-playgroundReadyReadyPreviewAug 20, 2026 1:01am
workflow-tarballsReadyReadyPreviewAug 20, 2026 1:01am
workflow-webReadyReadyPreviewAug 20, 2026 1:01am

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

Reviewed thoroughly for correctness and faithfulness to #3675 (original author here). No issues found — the AI port is a correct v4 rewrite of the fix. Verified locally on the branch: full workspace build, all 844 packages/core unit tests (including the 12 ported tests in suspension-handler.test.ts / step-handler.test.ts), and e2e against a local nextjs-turbopack dev server — both new serialization failure tests plus FatalError/parallel smoke slices green.

Faithful core semantics, correctly translated to stable's architecture:

  • handleSuspension catches the per-step dehydration failure (everything except RuntimeDecryptionError — correct on v4, where dehydrateStepArguments wraps all non-decryption throws in a WorkflowRuntimeError with the framed Failed to serialize step arguments… message) and finalizes the step as step_created (marker placeholder + structural flag) + step_failed, tolerating EntityConflictError/RunExpiredError on both writes.
  • The step_failed payload uses v4's event shape ({ error: message, stack } string form), which the v4 step consumer rejects into workflow code as a FatalError carrying the framed message — the right v4 analog of main's hydrated SerializationError (which doesn't exist on this branch).
  • Replay-to-observe uses { timeoutSeconds: 0 } (immediate queue re-invocation) instead of main's in-process replay — matching stable's own PreconditionFailedError idiom, and the caller at runtime.ts propagates it. When the failed step was the only pending work, this is what wakes the run.
  • The crash-window guard landed in step-handler.ts (v4's executor): the structural placeholder flag check fires after hydration, throws FatalError → the existing fatal path writes step_failed without running the body and re-queues the workflow. Important detail the port got right: on redelivery after an interrupted finalization, stable's suspension handler queues the already-created step unconditionally, so the guard is the recovery mechanism — and it's covered by both halves of the regression tests (interruption → suspension rejects; redelivery → body never runs), plus the negative test (a genuine argument equal to the display marker executes normally).

Deliberate scope reductions, all correct for stable: no QuickJS engine, no batch-fanout/lazy-inline/deferredBatchWork handling, and no drain gate (none of those exist on this branch — handleSuspension has exactly one caller). Step-return-value e2e was dropped because v4 retries those before step_failed (different semantics than main's fatal-skip); the docs correctly omit that claim and use message-based detection + FatalError framing instead of the v5-only SerializationError name.

One pre-existing note (not this PR):packages/docs-typecheck has 12 failing tests on origin/stable today (nitro ModuleOptions.sourcemap, world.streams samples). This PR's two new doc samples typecheck cleanly; the totals go 463→465 passed with the same 12 pre-existing failures.

@github-actions

github-actionsBot commented Aug 20, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10990781177
✅ 💻 Local Development11980861284
✅ 📦 Local Production11980861284
✅ 🐘 Local Postgres11980861284
✅ 🪟 Windows10700107
❌ 🌍 Community Worlds821069197
✅ 📋 Other606036642
Total54881063815975

❌ Failed Tests

🌍 Community Worlds (106 failed)

redis (21 failed):

  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

turso (85 failed):

  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • addTenWorkflow | wrun_01M0F2YN682K5WBF4D1T26S82X
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01M0F37A43S488PZV9S94PBMMN
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01M0F2YX7W0ZGTPN1VJXTRV0GX
  • promiseRaceWorkflow | wrun_01M0F2Z3RD0Q9FT2WBJME3N51K
  • promiseAnyWorkflow | wrun_01M0F2Z630CBCM4XYQR5XKHC1Q
  • importedStepOnlyWorkflow | wrun_01M0F37Q880PJFGA62GECJ19W1
  • readableStreamWorkflow | wrun_01M0F2Z8FFVMP6DN3QJ5HRV6H2
  • hookWorkflow | wrun_01M0F2ZNFNJFR39ZZ631S7NH9V
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01M0F2ZZN1NQZX1YMQED2NR7PS
  • webhookWorkflow | wrun_01M0F304AKR0CKKGXJ7CP42S2N
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01M0F30JX6M8KPWZRN517K9FR8
  • sleepingWorkflow | wrun_01M0F34EK3QRFAKK06ZVY5PGF0
  • parallelSleepWorkflow | wrun_01M0F34YGQM5TDV0DHM4TXVTC2
  • sleepWinsRaceWorkflow | wrun_01M0F3526059FVJ1VTP8JW80D9
  • stepWinsRaceWorkflow | wrun_01M0F355PSSX33S0APNTZACGQG
  • nullByteWorkflow | wrun_01M0F3597FH2MMJ0QPTDCNJA8J
  • workflowAndStepMetadataWorkflow | wrun_01M0F35BMZ7K203H2AFV1KZVMN
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01M0F37JTFK071PHS25T6GMM3P
  • writableForwardedFromWorkflowWorkflow | wrun_01M0F38045HJPB4EVM7KEQMJ5B
  • writableForwardedFromStepWorkflow | wrun_01M0F3836FVA4XFZKAG93PR7YQ
  • fetchWorkflow | wrun_01M0F386Z69D4VN9X7576GDP74
  • promiseRaceStressTestWorkflow | wrun_01M0F38AGK6PQFH0A0H1306P1Q
  • 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()
  • error handling serialization failures step-argument serialization failure is catchable in workflow code
  • error handling serialization failures uncaught step-argument serialization failure fails the run as USER_ERROR without redelivery retries
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01M0F3CA8ARC7WHCVKBC89TAP6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01M0F3CQ7DQAS47NKYXW0BQCW1
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01M0F3D4V4Y1BZXK613992KSNP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01M0F3D7FFFJMD1J4B3QP2RHVY
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01M0F3DA62WB0TS36CW105B5KE
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01M0F3DCPWMKFA34122KR59WEF
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01M0F3DT5TREZHC6CZGWY30Z45
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01M0F3EN7RKXBEP9YPRB92FMS9
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01M0F3ESX5NHCPTT7EKDKG5CB8
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01M0F3F0D3GVXMX20YXHFKX7NZ
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01M0F3F4M5QN83N17KQ99HQ4CP
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01M0F3FED0WM6RDJTYNXJ5B4Q8
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01M0F3FNZ1FBEEW5FKAK001C3Z
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01M0F3G6Z32WVC39W4T0G7DRF0
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01M0F3GGTYQ282HJ033NJGDSSP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01M0F3GQ3VCSKKHTZT8KQA0QPY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01M0F3GSF262SWNGJRQA1C987J
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01M0F3H9AFD2BMXNGE674S31B6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01M0F3HFFTZEANDCM1MX6STESD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01M0F3HP0J0PQJBRJ12JY4X49F
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01M0F3HWJ6902C5VQJM1MPW8VM
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01M0F3J2JMFWK7006X7V5EP3ZT
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01M0F3J9QK51MX2NDRSRBHADRJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01M0F3JGWG40B50Q8Z6E37F357
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01M0F3JX0K6MNPMSQ2AYREV4M0
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01M0F3K5WM7HZ0Z1D76NB0WEGK
  • cancelRun - cancelling a running workflow | wrun_01M0F3KDBX0JSBV4XZMN8X5ZZX
  • cancelRun via CLI - cancelling a running workflow | wrun_01M0F3KJM71SV8VPPFQ4QA0NQD
  • 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 | wrun_01M0F3KTXT779Y1A9FTXTAD1PS
  • hookWithSleepFinalStepWorkflow - step only on final payload | wrun_01M0F3M7XE52GVFMBQQB5961JD
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01M0F3MHJVHNCM9RDJN5QN9FDW
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01M0F3MWCV04T7SQGFBVB7SJRM
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01M0F3N3Q6NCPTC8E1VSSRD131
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01M0F3N63C6MPSW5TNXP26VFY2
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01M0F3N8G7YKNMJXV8P8AZY84K

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9908
✅ example9908
✅ express9908
✅ fastify9908
✅ hono9908
✅ nextjs-turbopack10403
✅ nextjs-webpack10403
✅ nitro9908
✅ nuxt9908
✅ sveltekit9908
✅ vite9908
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable10106
✅ express-stable10106
✅ fastify-stable10106
✅ hono-stable10106
✅ nextjs-turbopack-canary88019
✅ nextjs-turbopack-stable10700
✅ nextjs-webpack-canary88019
✅ nextjs-webpack-stable10700
✅ nitro-stable10106
✅ nuxt-stable10106
✅ sveltekit-stable10106
✅ vite-stable10106
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10700
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev403
✅ redis-dev403
❌ redis67210
✅ turso-dev403
❌ turso3850
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable10106
✅ e2e-local-dev-tanstack-start-stable10106
✅ e2e-local-postgres-nest-stable10106
✅ e2e-local-postgres-tanstack-start-stable10106
✅ e2e-local-prod-nest-stable10106
✅ e2e-local-prod-tanstack-start-stable10106

📋 View full workflow run

@TooTallNate
TooTallNate enabled auto-merge (squash) August 20, 2026 18:43
@TooTallNate
TooTallNate merged commit 5556b4c into stableAug 20, 2026
156 of 165 checks passed
@TooTallNate
TooTallNate deleted the backport/pr-3675-to-stable branch August 20, 2026 18:44
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.

1 participant

@TooTallNate