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-actions github-actions Bot 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

@github-actions github-actions Bot requested a review from a team as a code owner June 14, 2026 11:19
@changeset-bot

changeset-bot Bot 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
Name Type
@workflow/world-vercel Minor
@workflow/world Patch
@workflow/cli Patch
@workflow/core Patch
@workflow/web Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/world-local Patch
@workflow/world-postgres Patch
@workflow/world-testing Patch
workflow Patch
@workflow/builders Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch

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

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

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jun 22, 2026 9:36pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jun 22, 2026 9:36pm
example-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-astro-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-express-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-fastify-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-hono-workflow Building Building Preview, Comment Jun 22, 2026 9:36pm
workbench-nitro-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workbench-vite-workflow Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Jun 22, 2026 9:36pm
workflow-swc-playground Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workflow-tarballs Ready Ready Preview, Comment Jun 22, 2026 9:36pm
workflow-web Ready Ready Preview, Comment Jun 22, 2026 9:36pm

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

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 1044 0 78 1122
✅ 💻 Local Development 1138 0 86 1224
✅ 📦 Local Production 1138 0 86 1224
✅ 🐘 Local Postgres 1126 0 98 1224
✅ 🪟 Windows 102 0 0 102
❌ 🌍 Community Worlds 76 99 6 181
✅ 📋 Other 574 0 38 612
Total 5198 99 392 5689

❌ 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
App Passed Failed Skipped
✅ astro 94 0 8
✅ example 94 0 8
✅ express 94 0 8
✅ fastify 94 0 8
✅ hono 94 0 8
✅ nextjs-turbopack 99 0 3
✅ nextjs-webpack 99 0 3
✅ nitro 94 0 8
✅ nuxt 94 0 8
✅ sveltekit 94 0 8
✅ vite 94 0 8
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 96 0 6
✅ express-stable 96 0 6
✅ fastify-stable 96 0 6
✅ hono-stable 96 0 6
✅ nextjs-turbopack-canary 83 0 19
✅ nextjs-turbopack-stable 102 0 0
✅ nextjs-webpack-canary 83 0 19
✅ nextjs-webpack-stable 102 0 0
✅ nitro-stable 96 0 6
✅ nuxt-stable 96 0 6
✅ sveltekit-stable 96 0 6
✅ vite-stable 96 0 6
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 96 0 6
✅ express-stable 96 0 6
✅ fastify-stable 96 0 6
✅ hono-stable 96 0 6
✅ nextjs-turbopack-canary 83 0 19
✅ nextjs-turbopack-stable 102 0 0
✅ nextjs-webpack-canary 83 0 19
✅ nextjs-webpack-stable 102 0 0
✅ nitro-stable 96 0 6
✅ nuxt-stable 96 0 6
✅ sveltekit-stable 96 0 6
✅ vite-stable 96 0 6
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 95 0 7
✅ express-stable 95 0 7
✅ fastify-stable 95 0 7
✅ hono-stable 95 0 7
✅ nextjs-turbopack-canary 82 0 20
✅ nextjs-turbopack-stable 101 0 1
✅ nextjs-webpack-canary 82 0 20
✅ nextjs-webpack-stable 101 0 1
✅ nitro-stable 95 0 7
✅ nuxt-stable 95 0 7
✅ sveltekit-stable 95 0 7
✅ vite-stable 95 0 7
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 102 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 2
✅ redis-dev 3 0 2
❌ redis 64 19 0
✅ turso-dev 3 0 2
❌ turso 3 80 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 96 0 6
✅ e2e-local-dev-tanstack-start-stable 96 0 6
✅ e2e-local-postgres-nest-stable 95 0 7
✅ e2e-local-postgres-tanstack-start-stable 95 0 7
✅ e2e-local-prod-nest-stable 96 0 6
✅ e2e-local-prod-tanstack-start-stable 96 0 6

📋 View full workflow run

@vercel vercel Bot temporarily 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-actions Bot and 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>

@karthikscale3 karthikscale3 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-actions github-actions Bot mentioned this pull request Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants