Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks
, '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 #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings - #2414

Merged
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable
Jun 22, 2026
Merged

Backport #2055 + #2415 to stable: [world-vercel] v4 event wire format + lazy metadata-only listings#2414
VaguelySerious merged 9 commits into
stablefrom
backport/pr-2055-to-stable

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Combined backport to stable of two main-line changes to the v4 event wire format:

Note:#2547 (the decodeFrames frame-stream connection-leak fix) was briefly included here, then removed after it was reverted on main (#2554). It is no longer part of this PR.

Unlike the clean cherry-pick the backport bot assumed, #2055's wire format was co-designed with a runtime change that only exists on newer lines (there, the runtime serializes run/step errors into opaque bytes before events.create). On this line errors are still plain values, so this PR adapts the adapter — plus one small, additive @workflow/world schema fix — to carry them correctly. No breaking change: WorkflowRun.error / Step.error keep their StructuredError shape.

What this does

v4 wire format (#2055)

  • POST event body is one v4 frame: [u32_be meta_len][cbor meta][u32_be body_len][bytes]. Metadata rides in the CBOR meta; the user payload is the opaque body.
  • GET / LIST events return v4 binary frames (one per event + an end sentinel), dropping the per-event /refs round-trip.
  • Public adapter signatures and the EventResult / Event / PaginatedResponse<Event> shapes the runtime consumes are unchanged.

Lazy refs on metadata-only listings (#2415)

  • getWorkflowRunEvents maps resolveData: 'none'remoteRefBehavior: 'lazy' and sends it on both the runId and correlationId list queries, so the backend skips the per-event blob read and emits empty-body frames. resolveData: 'all' sends resolve (the default), unchanged.
  • Reuses the existing remoteRefBehavior param (same one v2/v3 use); no new wire concept.
  • Backward compatible with an older backend: one that predates the flag streams full bodies, and buildEventFromV4 still strips them for resolveData: 'none' — so it's purely a bandwidth optimization that kicks in once the backend honors the flag.

Stable-specific adaptations (vs. #2055)

  • Structured errors on the wire. This line's runtime sends run/step errors as a plain string (step_failed / step_retrying) or a { message, stack } object (run_failed), not dehydrated bytes. They are carried in the frame meta and decoded back on read, so the Vercel backend (world-vercel) materializes the same StructuredError the previous wire produced — the replay reducer reads .message / .stack directly and there is no hydrate step for errors on this line. Depends on the matching world-vercel backend change (parse error / stack from the v4 frame meta) being deployed first; until then the error-path E2E lanes report "Unknown error".
  • hook_created.isWebhook is kept on the wire and declared on HookCreatedEventSchema — the runtime emits it and the backend consumes it to reject public-webhook-endpoint resumption.
  • Dropped the meta fields that don't exist on this line's event schema or runtime (native run attributes / attr_set / isSystem). A schema-derived exhaustiveness guard keeps the wire allowlist in sync with the event schema in both directions.
  • Combination fix: the stable-only structured-error decode test lists with resolveData: 'all', which [world-vercel] Send remoteRefBehavior=lazy on v4 metadata-only event listings #2415 now maps to remoteRefBehavior=resolve; its mock interceptor was updated to match the new query param.

Test plan

  • Unit: v4 frame encoder/decoder, typed-error contract, POST alias round-trip, truncation guard
  • Unit: structured-error write routing + read-decode round-trip; hook_created.isWebhook routing
  • Unit: remoteRefBehavior mapping — resolveData: 'none' → lazy (strips any returned body), default → resolve (splices body bytes), on both runId and correlationId queries
  • world-vercel unit suite (157 tests) + typecheck green; exhaustiveness guard compiles against this line's schema
  • Local Dev / Local Postgres / Local Prod E2E green (unaffected worlds)
  • Vercel-Prod error-path E2E lanes — pass once the matched world-vercel backend change is deployed, then re-run

🤖 Generated with Claude Code

@changeset-bot

changeset-botBot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 10dd0d4

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

This PR includes changesets to release 20 packages
NameType
@workflow/world-vercelMinor
@workflow/worldPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/world-testingPatch
workflowPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@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 Jun 14, 2026

Copy link
Copy Markdown
Contributor

Comment threadpackages/world-vercel/src/events.ts
@github-actions

github-actionsBot commented Jun 15, 2026

Copy link
Copy Markdown
ContributorAuthor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production10440781122
✅ 💻 Local Development11380861224
✅ 📦 Local Production11380861224
✅ 🐘 Local Postgres11260981224
✅ 🪟 Windows10200102
❌ 🌍 Community Worlds76996181
✅ 📋 Other574038612
Total5198993925689

❌ Failed Tests

🌍 Community Worlds (99 failed)

redis (19 failed):

  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • 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
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

turso (80 failed):

  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • addTenWorkflow | wrun_01KVRM3328W0XS1N2C5HE39T3T
  • deploymentId: 'latest' is a no-op in non-Vercel worlds
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KVRM3Y1T6KHBW57S0C80X6P0
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KVRM3ANGT35E2BASBHHRKM0D
  • promiseRaceWorkflow | wrun_01KVRM3GKXQ4VN7V96BRT9VRA7
  • promiseAnyWorkflow | wrun_01KVRM3KST8TXFGQ4XEK6HQWA6
  • importedStepOnlyWorkflow | wrun_01KVRM4A0B6DJDER61Q317ZG7N
  • readableStreamWorkflow | wrun_01KVRM3NRR6ZY2HCDV83DTKV68
  • hookWorkflow | wrun_01KVRM429W2G5SYDH08PTW5NW9
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KVRM4AM1BKX39Y8JDGHVAPZ3
  • webhookWorkflow | wrun_01KVRM4F13T3BRPER571HYDJ25
  • parallelStepsThenWebhookWorkflow - no hook_conflict from same-tick replay race | wrun_01KVRM4MYXGF4TM05W5YBEYXK1
  • sleepingWorkflow | wrun_01KVRM5TQ6KSHWZQ9FVACHCZ86
  • parallelSleepWorkflow | wrun_01KVRM6BYXCTWG12KV218PENAV
  • nullByteWorkflow | wrun_01KVRM6G9NPJKBYA3P26V5Q21P
  • workflowAndStepMetadataWorkflow | wrun_01KVRM6JA9ZPZ2PV290ZMJPT9Y
  • 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_01KVRM99HG128B0KAFM8YN99HV
  • writableForwardedFromWorkflowWorkflow | wrun_01KVRM9TD6TEAQQCNJXA60S2JQ
  • writableForwardedFromStepWorkflow | wrun_01KVRMA0P9M7PGNXSVZP6XN52Q
  • fetchWorkflow | wrun_01KVRMA5PS82M50PQ0BFGSQ7EB
  • promiseRaceStressTestWorkflow | wrun_01KVRMA90P8P54269T5HH9FWTN
  • 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 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_01KVRMDQWXBJVJVGJWFTXD25K6
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KVRME387WWAP0HC0NER875SF
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KVRMEF2QTWDNWFD9FBK9J1MP
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KVRMEK41VY0T7T0D81W02AC1
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KVRMEPF24P9JFXZFZRXQ274B
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KVRMERNKJ6V4D1FXSWBHDDBW
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KVRMF751YPJ60HCV0N35CYN6
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KVRMG22233WY152MCJANPHCN
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KVRMG78SE4SYV3KZ00WD0Z83
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KVRMGDMQP22KSGCZY007K5C2
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KVRMGKM32DHZZYFG1CJXRWMS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KVRMGYEE3HVVZJC3WX7X63GX
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KVRMH6GH2XGE9F4DGQXTDQD4
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KVRMHPB7A1JPBMF85J3YSX5R
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KVRMHYMZWT1A1Q4NZ3YXKFJ7
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KVRMJ5KF52HY4H0WZSJYRHP9
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KVRMJA3KB71RHFD4PTF969S2
  • 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_01KVRMJSQ0XGA9DD4CK04XWK39
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KVRMJZB8VFH7KGJEJKPPQSDD
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KVRMK5Y9F5P03Z3HFBC75X37
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KVRMKC4PD5DX2WV3NPMQSM5E
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KVRMKM5MBAG63WMH9WTRFD2K
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KVRMKVFPW9C7Q8CB5Z6WS5E2
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KVRMM4BBAAZ6A5T0HMRXFYNW
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KVRMMKZ6WXZA87R82V0CVHHW
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KVRMMYZH79D3JCZRZ784C13Y
  • cancelRun - cancelling a running workflow | wrun_01KVRMN74N3RRSKVRT3ZR68ARG
  • cancelRun via CLI - cancelling a running workflow | wrun_01KVRMNGAQF2XP2S7PXWM0GPZP
  • 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_01KVRMNXT3TGETM2ACDD81FEH8
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KVRMPH4TWX325NVT9JP65CMY
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KVRMPWGK14C4P040B5ZQRPF1
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KVRMQ3YPFFGJDHCRPSK9P9AM
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KVRMQ5Z84HJZAHRGZ4MSPC6N
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KVRMQ7W4X9EG44JA5GVJ50VN

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro9408
✅ example9408
✅ express9408
✅ fastify9408
✅ hono9408
✅ nextjs-turbopack9903
✅ nextjs-webpack9903
✅ nitro9408
✅ nuxt9408
✅ sveltekit9408
✅ vite9408
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable9606
✅ express-stable9606
✅ fastify-stable9606
✅ hono-stable9606
✅ nextjs-turbopack-canary83019
✅ nextjs-turbopack-stable10200
✅ nextjs-webpack-canary83019
✅ nextjs-webpack-stable10200
✅ nitro-stable9606
✅ nuxt-stable9606
✅ sveltekit-stable9606
✅ vite-stable9606
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable9507
✅ express-stable9507
✅ fastify-stable9507
✅ hono-stable9507
✅ nextjs-turbopack-canary82020
✅ nextjs-turbopack-stable10101
✅ nextjs-webpack-canary82020
✅ nextjs-webpack-stable10101
✅ nitro-stable9507
✅ nuxt-stable9507
✅ sveltekit-stable9507
✅ vite-stable9507
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack10200
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev302
✅ redis-dev302
❌ redis64190
✅ turso-dev302
❌ turso3800
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable9606
✅ e2e-local-dev-tanstack-start-stable9606
✅ e2e-local-postgres-nest-stable9507
✅ e2e-local-postgres-tanstack-start-stable9507
✅ e2e-local-prod-nest-stable9606
✅ e2e-local-prod-tanstack-start-stable9606

📋 View full workflow run

@vercel
vercelBottemporarily deployed to Preview – workflow-docs June 15, 2026 10:14 Inactive
@VaguelySerious

VaguelySerious commented Jun 15, 2026

Copy link
Copy Markdown
Member

(AI) Updated this backport to actually work on stable.

The auto-backport was a clean git merge, but #2055's v4 wire format has a hard dependency on a runtime refactor that landed on newer lines but is not on stable:

  • On newer lines, the runtime dehydrates run/step errors into opaque Uint8Array blobs and hydrates them on read.
  • On stable, errors are still plain strings (step_failed/step_retrying) / { message, stack } objects (run_failed).

As-is, the v4 split's Uint8Array guard threw on every run/step failure. Two secondary schema-drift issues also broke the build: stack (present on stable's step schemas) was unrouted, and some meta fields that don't exist on this line's schema/runtime were stale in the wire allowlist.

This update carries stable's structured errors in the frame meta and decodes them back on read — no breaking change, no StructuredErrorUint8Array migration. It is a matched pair with a world-vercel backend change (parse error/stack from the v4 frame meta). That backend change must deploy before this merges, otherwise the structured-error path degrades to "Unknown error" on the deployed v4 routes.

github-actionsBotand others added 6 commits June 19, 2026 14:42
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The v4 wire format assumes the runtime hands `events.create` a dehydrated
`Uint8Array` for every payload field. On this line run/step errors are NOT
dehydrated — the runtime emits them as a plain string (step_failed /
step_retrying) or a `{ message, stack }` object (run_failed). The split's
Uint8Array guard therefore threw on every failure event.
Route a non-Uint8Array `error` field (plus the sibling `stack`) into the
frame meta instead, so the backend rebuilds the same StructuredError the
pre-v4 wire produced. On read, the backend returns that StructuredError as
the ref's CBOR bytes in the frame body, so decode the structured-error
event types back into `eventData.error` — the core step-event reducer
reads `.message` / `.stack` off it directly and has no hydrate step for
errors on this line.
Also drops the native-run-attributes and webhook/system-hook meta fields
from the wire allowlist: those eventData fields do not exist on this
line's @workflow/world schema, and the schema-derived exhaustiveness guard
flags them as stale. Requires the matching backend change to parse
`error` / `stack` from the v4 frame meta.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The runtime emits `isWebhook` on hook_created (the suspension handler) and
the backend reads it to mark webhook hooks, which must not be resumable via
the public webhook endpoint. The schema-derived wire-allowlist guard had
flagged `isWebhook` as stale because this line's @workflow/world
HookCreatedEventSchema did not declare it — so it was dropped, breaking
webhook hooks on the v4 wire.
Declare `isWebhook` on HookCreatedEventSchema (matching the field the
runtime already sends and the backend already consumes) and route it
through the v4 frame meta. Unlike isWebhook, isSystem / native run
attributes / attr_set are genuinely absent from this line's runtime and
schema, so they stay off the wire.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getWorkflowRunEvents applied resolveData only client-side: it always
downloaded the resolved payload bytes for every event, then discarded them
when resolveData was 'none'. The v4 list endpoints accept remoteRefBehavior
(resolve|lazy, default resolve), so map resolveData 'none' → lazy and send
it on the runId and correlationId list queries — the backend then emits
empty-body frames and skips the per-event blob read.
Safe against a backend that predates the flag: it ignores the param and
streams full bodies, and buildEventFromV4 still strips them for
resolveData 'none', so this is a pure bandwidth optimization either way.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
The structured-error decode test (stable-only, from this backport) lists
events with resolveData 'all', which the lazy-refs change maps to
remoteRefBehavior=resolve on the wire. Match the new query param in the
interceptor so the request resolves against it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
decodeFrames never cancelled response.body when a consumer stopped reading
before EOF — getEventV4 returns after the first frame and consumeListFrameStream
breaks at the sentinel — so the undici connection stayed checked out of the pool
(8 per origin) instead of being released, causing stalls/timeouts on the
event-read path.
Cancel the source in a try/finally (and cancel the reader in readerToIterator)
via a shared closeQuietly helper. Add regression tests for both decode branches
and a getEventV4 HTTP round-trip through undici MockAgent.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Approved after verifying this stable PR is scoped to backports of #2055, #2415, and #2547, and that each source PR was already reviewed and merged.

"@workflow/world": patch
---

New internal API format: separately encode event metadata from user payloads. Eliminates the need for calling separate endpoints for ref resolution, which improves performance especially on longer runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI review: Checked that PR #2414 is a stable backport of #2055, #2415, and #2547; all three source PRs are closed and merged into main, and each had review/approval activity before merge. I also checked that the stable-only adaptations called out in this PR body are limited to the v4 event wire-format/schema compatibility needed for the backport.

@github-actionsgithub-actionsBot mentioned this pull request Jun 22, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@VaguelySerious@karthikscale3@smaeda-ks