Pranay Prakash
90d · built 2026-11-06
Performance
What Pranay Prakash shipped in the selected window, measured in ETV, and how it compares with the 90 days before it.
Effective capacity
+4.2engineers
delivers like 5.2 (5.2x pre-AI)
Output (ETV)
47.6ETV
+49.9% vs 31.8 prior
Features share
21.2%
−3.1 pp vs prior window
Fixes share
15.1%
−7.7 pp vs prior window
Work mix
21.2% Features5.3% Maintenance44.9% Tests13.5% Docs15.1% Fixes
98 commits over 90 days, ending 2026-11-06.
Where this dev ranks
Percentile against the global top-100 leaderboard (all-time totals).
- By commits
- Top 85 %
- By Features share
- Top 64 %
Daily performance
Daily ETV, stacked by Features, Maintenance, Tests, Docs and Fixes.
Repository spread
Where this developer's commits land. Concentrated work (top1 > 80%) vs polymath spread (top1 < 30%).
Most impactful commits
Top 10 by ETV in the last 90 days.
- 5.1ETVAdd dynamic workflows, backed by encrypted ref storage (#2062) * feat: dynamic workflows, backed by encrypted ref storage Rebase of the dynamic-workflow-source prototype onto main, reworked to use the real server-side storage path instead of stashing generated code in plaintext run metadata. `start()` now accepts workflow source as a string, for orchestration whose shape is only known after you deploy — a workflow-builder UI, a customer-defined automation, an AI-generated plan over a fixed catalog of registered steps: await start(source, [{ userId }], { dynamic: { steps: { fetchUser } } }); The source is validated, compiled to workflow VM code, and stored with the run through the same pipeline as the run's input: compressed, then encrypted with the run's key. On worlds with a blob-ref layer it lands behind a ref — inline for a small definition, object storage for a large one (see the matching workflow-server PR). Replay hydrates it and evaluates *it* instead of the deployment's bundle, so a run always executes the exact code it started on. What changed from the prototype: - Generated code no longer rides `executionContext.dynamicWorkflow`. Only small plaintext metadata does — version, source hash, export name, and the alias-to-step-id map — which is what lets a run be identified as dynamic, and its step allowlist audited, without decrypting anything. It also has to fit the 2 KB execution-context budget, which real generated code does not. - The code rides `run_created` (and the queue message, for resilient start and the turbo path, which synthesizes the run snapshot rather than reading it) as a serialized payload, or as a ref for definitions too large to send inline. - `start()` verifies the created run came back carrying its code. A backend without dynamic-source storage drops the field rather than rejecting it, so without this the run would look fine and fail much later as an unregistered-workflow error on a queue delivery. - Compilation moved to its own module. The workflow id is derived from the source *and* its step bindings, so the same definition always gets the same durable id, and arbitrary source cannot claim a static workflow's. Docs: new "Dynamic Workflows" page. The v5 "How it works" section is renamed "Advanced" to fit it — the section explains the build-time execution model, and dynamic source is the escape hatch from it. Permanent redirects cover every `/v5/docs/how-it-works/*` slug; v4 keeps its own section at the unversioned path, so those are deliberately untouched until v5 becomes the default. Tests: 35 unit tests over compilation, id derivation and validation; 4 type-level tests pinning the overload resolution; 7 e2e tests over the real round trip (generated code executing against registered steps, stable ids, encrypted-at-rest storage, replay across a suspension, the deferred ref path, the step allowlist failing a run, and validation refusing to create one). The e2e file is added to `test:e2e`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix(web-shared): render a dynamic run's workflow code in the run detail view The run detail sidebar keys its display map off `WorkflowRun`'s fields via an exhaustive `Record<AttributeKey, ...>`, so adding `dynamicWorkflowCode` to the run schema broke the build until it had a renderer — which is the right outcome: a payload field with no renderer would otherwise be silently dropped from the one view that exists to show it. It gets the same locked-by-default treatment as input and output, which is what the RFC asks for: generated orchestration names internal step ids, prompts and business rules, so reading it goes through the existing decrypt flow rather than being displayed by default. Ordered after input/output — the code a dynamic run actually executed is the most useful thing on its detail view, and absent on every other run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix: point @workflow/core's packed docs at the renamed Advanced section `prepack` copies the v5 docs tree into the published package, and it named the section by its old path, so `pnpm pack` — and with it the tarballs preview deployment — failed on a missing directory rather than on anything about the docs themselves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * docs: make the dynamic-workflow approval sample self-contained The docs type-checker checks each code block on its own, so a sample that leaned on the imports of the block above it did not compile — and neither would a reader who copied it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * docs: use Run.status in the dynamic-workflow example There is no readStatus(); status is a promise-returning getter. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): skip dynamic-workflow tests on a backend without source storage Two fixes the first Vercel-prod run surfaced. The unsupported-backend path threw instead of skipping, so the whole dynamic suite came back red against production — which does not have the server-side storage deployed yet. It now issues a real vitest skip, the same mechanism the conformance gate uses: the gap is the backend's and the suite cannot close it, and these tests go live unchanged once the server ships. The validation test also called `getWorld()` without awaiting it, then read `.runs.list` off a promise. That assertion is gone rather than fixed: the run listing is served from an eventually-consistent store in e2e, so comparing it before and after would be a flake, and the ordering it was checking — that validation happens before any write — is pinned deterministically by the unit tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): read run records through the World, and skip the suspension case Three problems the first full e2e matrix surfaced, all in the test file. The assertions on stored state went through `getRun()`, which returns a Run handle whose fields are promise-returning getters over a small public surface — so `workflowName` compared two promises, and `executionContext` / `dynamicWorkflowCode` read as undefined. They now read the persisted record through `world.runs.get(runId, { resolveData: 'all' })`, which is what the rest of the suite does for storage assertions. The suspension test is skipped and left in place with the observation written down: it timed out waiting on `returnValue` on `world-local` while every non-suspending dynamic test passed on the same world, so dynamic execution works and something about the resume delivery does not. That delivery takes the read-back path in `resolveWorkflowCodeForRun` that no passing test covers. Not root-caused, and it should be before this ships beyond experiment — deleting the test would hide the finding. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix(world-local): keep a dynamic run's code across status transitions world-local rebuilds the run record field by field on every status change, so anything not named in those four literals is dropped the first time the run moves — which for a dynamic run meant losing the workflow code the moment it went `running`, leaving a run nothing could replay. Same failure mode the neighbouring `encryptionPublicKey` lines were added to avoid, and the reason the suspension e2e test hung rather than failed: the resume delivery is the only path that reads the code back off the record, and it found nothing, so the delivery threw and was redelivered until the test timed out. That test is re-enabled here — it is what caught this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): skip the stored-code assertion when the backend persisted nothing Two of the twenty-seven Vercel apps got past `start()`'s fail-fast check and then failed on the stored bytes instead of skipping. That is accurate, not noise: the check reads the created run off `run_created`'s own response, and a resilient start has no response to read — so a short dynamic run can still finish, because turbo executes it from the queue message inside one invocation, while the backend stored nothing. This assertion is the thing that notices. It is the same "no dynamic-source storage" fact the other tests skip on, reached one step later, so it skips with that stated instead of failing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): apply the stored-code skip to both assertion sites The deferred-ref test asserts stored bytes too, and only the first site got the skip — so it failed on the two apps whose runs happened to take the resilient-start path. Both now go through one helper, so a third site cannot drift from it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * chore: re-run CI The previous Vercel e2e matrix hit a backend-wide slowdown — every Vercel-facing job failed on 60s timeouts in pre-existing tests (promiseRaceStressTestWorkflow, closureVariableWorkflow, the abort suite) while all 84 local-world jobs passed. Empty commit to get a clean read, since re-running the failed jobs directly is not permitted for this token. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Pranay Prakash <1797812+pranaygp@users.noreply.github.com> * test(e2e): emit the dynamic runs' IDs as a CI artifact The dynamic tests track every run they start, but never wrote the sidecar that carries the IDs out — each e2e file runs in its own vitest worker with its own copy of the collector, and only `e2e.test.ts` was writing one. So the run IDs were collected in memory and thrown away, which is precisely what you want when you ask what a dynamic run looks like in production. Written under `e2e-dynamic-runs-<app>-vercel.json` rather than the shared per-app metadata name, which the last writer would otherwise clobber, and added to the four artifact upload lists. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): generate the dynamic workflows inside the deployment The dynamic e2e tests called `start(source, …)` from the vitest runner. That runs, but it is not the shape an app uses, and it skipped the most important part of the feature: `dynamic.steps` has to be given *imported* step functions, so the `.stepId` the build-time transform stamped on them is what binds generated source to a registered step. The runner holds no handle on those functions, so it had to look step ids up in the deployed manifest and pass `{ stepId }` — the escape hatch, not the documented path. The workflows are now generated inside the deployment, by fixtures in `workflows/99_e2e.ts` (one file, symlinked into every workbench app). Each fixture assembles source at runtime and starts it from a step with `{ steps: { add } }`, which is how a builder UI or an LLM-generated plan actually reaches `start()`. The tests start the static fixture, take the dynamic child's run id back, and assert on the child — so the same tests exercise Vercel, local dev/prod and Postgres with no per-world branching. Fixtures added: a plain generated workflow, one whose source suspends (the resume delivery is the only path that reads the stored code back), and one whose source calls a step it was not given. `getStepMetadata` goes with them — it existed only for the manifest lookup this replaces. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix: accept imported step functions in dynamic.steps `DynamicWorkflowStepReference` was `{ readonly stepId: string }`, so the call the docs advertise — `steps: { fetchUser, sendEmail }` with real imports — did not typecheck. The build-time transform stamps `.stepId` on step functions at runtime and nothing adds it to their declared type, so the only thing the type actually accepted was the `{ stepId }` escape hatch. Moving the e2e fixtures into the deployment is what surfaced this: app code is typechecked by the app's build, and the runner had only ever passed the escape hatch. The function arm is typed as any function, with the existing runtime check in `resolveStepId` as the real gate — it already reads `.stepId` off functions and fails with a message naming the alias. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix: name the created run when its dynamic code was not stored The error said the code was not stored but not which run it was talking about — and `start()` writes `run_created` *before* reading back what the backend kept, so on this path a real dynamic run does exist and only its replayability is missing. Naming it is what makes it inspectable. The e2e skip path now pulls that id out and tracks it, so the run-ID sidecar reports the run even when the test skips. Without it the ids of dynamic runs created against a backend that cannot store them were simply lost. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): capture the child's run id, not the wrapping parent's The error reaches the runner wrapped in the parent fixture's failure, which names the parent, so a loose `wrun_` match took that instead — every run id in the sidecar was the parent's, recorded twice. Anchored to the exact wording of the message `start()` raises about the run it created. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * test(e2e): label the dynamic run in the run-id sidecar The sidecar lists two bare ids per test — the parent fixture's and the dynamic child's — with nothing saying which is which. The dynamic one is the whole reason the artifact exists, so it is now tagged `[dynamic run]`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com> * fix: stop the module-syntax check rejecting identifiers that start with import/export `import` was allowed to be followed directly by an identifier character, so a line starting with `importData = …` was rejected as module syntax. The keyword now has to be followed by whitespace or a module-syntax token. `export{` and `export *` without a space are caught as well. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(dynamic-workflows): purge stored code, refuse Replay Run, parse source up front, hydrate code for o11y - $retention: 0 purges clear dynamicWorkflowCode on world-local and world-postgres alongside the other run payloads. - Replay Run refuses a dynamic run instead of creating one with no code behind it. - compileDynamicWorkflow parses the generated code, so TypeScript syntax, a reserved-word function name, or an unbalanced brace fail at start() rather than on every delivery; inline "use step" is rejected as the docs already state. - The stored code payload is real devalue under its devl prefix, so the generic hydrators (CLI inspect, web UI) can read it; hydration field lists in core, web-shared, and the CLI include dynamicWorkflowCode. - hydrateDynamicWorkflowCode normalizes a corrupt payload to SerializationError. - Changeset covers @workflow/cli and @workflow/web-shared; bump is minor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(dynamic-workflows): preflight runtime and backend support Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(dynamic-workflows): keep source out of local events Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(web): disable replay for dynamic runs Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * docs(dynamic-workflows): qualify source storage guarantees Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * test(core): exercise dynamic source compression Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * docs(dynamic-workflows): qualify changeset storage wording Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(web): guard Replay while run identity loads Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * docs(dynamic-workflows): clarify cross-deployment key preflight Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * feat(core): mark dynamic start options experimental Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(world): reject ambiguous dynamic code storage Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): isolate dynamic workflow compilation Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * docs(dynamic-workflows): explain runtime surface Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): validate top-level dynamic workflows Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): validate generated dynamic wrapper Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): isolate dynamic source bindings Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): pin dynamic syntax and preserve aliases Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(dynamic-workflows): validate queue names before start writes Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): gate dynamic starts on deployment opt-in and same deployment Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): fail dynamic deliveries that cannot safely execute stored code Require the deployment opt-in, a marker that derives the run's workflow name, and encr-only stored code when the run has key material. Each refusal records run_failed instead of redelivering, and executing stored code is recorded on the delivery span and in one log line. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(core): validate execution context size for dynamic starts only Static starts no longer serialize or reject their execution context before creation. world-vercel throws a WorkflowRuntimeError that names the dynamic step bindings as the cause. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(world-vercel): read a missing capabilities route as no capabilities A 404 from /v2/capabilities maps to an empty set so dynamic starts fail closed with the backend-support error; other failures still propagate. The dynamic E2E suite skips when the deployment has not opted in or its backend does not advertise dynamic-source storage. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(world): omit dynamic workflow code for resolveData none WorkflowRunWithoutData excludes dynamicWorkflowCode, and the local, Postgres, and Vercel Worlds strip it from get, getMany, and list. world-local list now filters through filterRunData. Replay reads the code back with resolveData all when a snapshot lacks it. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * docs(dynamic-workflows): document opt-in, same-deployment scope, and security model State that dynamic source runs with the deployment's full privileges and that steps is not a boundary, drop the customer-authored and AI-generated framing, and document the WORKFLOW_EXPERIMENTAL_DYNAMIC_WORKFLOWS opt-in, same-deployment-only starts, encr-only stored code, plaintext storage in Local and Postgres, the plaintext step map, and the 2,048-byte marker limit. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * refactor(core): drop the redundant dynamic runtime-version check from start Dynamic starts are same-deployment only and require the opt-in up front, so the start-local target dynamic version could only echo this process's own constant. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * ci: run dynamic workflow E2E on local and Postgres lanes The local dev, local prod, and Postgres servers opt in with WORKFLOW_EXPERIMENTAL_DYNAMIC_WORKFLOWS=1, and WORKFLOW_E2E_EXPECT_DYNAMIC_WORKFLOWS=1 makes the suite fail rather than skip on an opt-in refusal there. Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(world-vercel): skip decompressing dynamic workflow code on resolveData none reads Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> * fix(world-vercel): classify corrupt dynamic workflow code as a contract error Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> --------- Signed-off-by: Alex Langenfeld <alex.langenfeld@vercel.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com> Co-authored-by: Peter Wielander <peter.wielander@vercel.com> Co-authored-by: Alex Langenfeld <alex.langenfeld@vercel.com>github.com-vercel-workflow · 20e8440f · 2026-09-29
- 3.8ETVfeat(hooks): `createHook({ experimental_force: true })` takes a held token over (#4193) * feat(hooks): createHook({ experimental_force: true }) takes a held token over A run can now register a hook token another active run holds. The World disposes the previous owner's hook in that run's own event log (`hook_disposed{forceClaimedBy}`), re-points the token, and returns the new hook with `claimedFrom`; the claimer's runtime then wakes the previous owner from that record. A run awaiting a hook whose token was taken over gets the new `HookForceClaimedError` naming the claimer, after draining the payloads that landed before the takeover. Co-authored-by: Peter Wielander <mittgfu@gmail.com>github.com-vercel-workflow · 4f524386 · 2026-09-23
- 3.0ETV[core] Wait on child runs through a system hook instead of polling (#5048) ## Summary `await run.returnValue` on a run the current workflow started now suspends the parent on a **system hook** (`isSystem: true`, one per parent, shared by all of its children) that each child resumes when it finishes. Until now that await was a step that polled the child (long-polling where the World supports it), and the step held a worker slot for the whole wait. The docs told people to avoid this by hand-writing the hook handshake (`defineHook` + `withChildCompletionHook` wrapper + `startAndWait`). The SDK now does that handshake itself: ```ts export async function parent(ids: string[]) { "use workflow"; const runs = await Promise.all(ids.map((id) => start(child, [id]))); return await Promise.all(runs.map((run) => run.returnValue)); // no polling, no worker slot } ``` ## How it works 1. **`start()` from a workflow** (directly, or from one of its steps) stamps the parent's run id on the child (`executionContext.completionParentRunId`) and records it on the returned `Run`. It survives `Run` serialization, so a `Run` returned from a step of the parent works the same way. 2. **One system hook per parent.** When the parent awaits a child's `returnValue` (workflow VM only, and only in the run that started it), a per-run dispatcher registers the parent's completion hook, `wkf_child_run_completion:<parentRunId>`, created with `isSystem: true`, if it isn't open already. Once registration is committed, it reads every child awaited since its last read in **one** batched step (`Run.readFinishedRunIds`). Children that already finished are answered from that read. 3. **Every child resumes that same hook** with `{ runId, status }` **after** it writes `run_completed` / `run_failed`. This covers every terminal write site on both engines, including fatal setup errors, max-deliveries, replay timeout, and deployment mismatch. `Run.cancel()`, `cancelRun()` and `cancelRuns()` do the same for cancellations (the batch path once per cancelled run). The dispatcher hands each payload to the waiting child, which then reads its own result (`Run#readReturnValue`). 4. **Once no child is being waited on, the hook is disposed.** An open system hook makes every suspension of the parent path-changing, so leaving it open would turn off spec 9's run-ahead for the rest of the parent's run; closing it also stops children the parent never awaits from waking it. The next await registers it again under the same token. Resuming a token nobody registered is a cheap not-found and not an error. Why this ordering is race-free: the parent registers before it reads, and a child resumes after its terminal write. A resume that finds no hook therefore happened after the terminal write, and the parent's read, which happens after registration, sees it. **Per-child cost in the parent's log** for a fan-out of N: one `hook_received` plus one result-read step per child, plus a fixed one hook, one batched status read and one safety-net wait for the whole fan-out. The old polling path cost one long step per child, holding a worker slot. ### System hooks in the runtime The completion hook is a real system hook (`isSystem: true`). I fixed the spots that assumed every system hook is an `AbortController` hook: - **QuickJS `__releaseDisposedHook`** never released a disposed system hook's op. That exception exists so `abort()` can find its hook later, so it now applies to abort hooks only (a VM-local `isAbortSignal` marker). Without this, every dispose/re-register cycle of the completion hook leaked a pending op in the VM. `quickjs-system-hook-dispose.test.ts` fails on the old guard. - **Out-of-band observation**: adds `systemHookCount` (every SDK hook) next to `abortSignalHookCount` (abort hooks only). Both count as never inert, because other runs and steps resume them. The existing span attribute `workflow.out_of_band.abort_signal_boundaries` keeps its meaning, and a new `workflow.out_of_band.system_hook_boundaries` covers the completion hook too. - Terminal drain (node and QuickJS) already skips uncreated system hooks generically. I only corrected comments there and in the abort controller, which claimed `isSystem` exempts a hook from token-conflict checks. No World does that; Worlds only persist the flag. - `createHook` accepts an internal `isSystem` option (`SystemHookOptions`, kept off the public `HookOptions`) on both engines. ### Safety net for missed notifications While a parent waits on children, the dispatcher keeps **one** `sleep` open and, when it fires, re-reads every pending child in one step. The first check runs after 5 minutes, then the interval doubles up to 6 hours. There is never more than one outstanding wait per parent, reused across waits, so the most it costs is one extra wake. ## ⚠️ Cancellation gap: read this A parent is resumed **immediately** only when the child's own runtime records its outcome, or when the child is cancelled **through the SDK**: | How the child finished | Parent resumes | | --- | --- | | Child completed or failed (either engine) | Immediately | | `run.cancel()`, `cancelRun()`, `cancelRuns()` | Immediately | | `workflow cancel` CLI, `workflow web` (both call `cancelRun()` / `cancelRuns()`) | Immediately | | Any tool that writes the cancellation to the World / its backend API directly, without `@workflow/core` | **At the next safety-net check** (5 min → doubling → 6 h) | | The child's invocation dies after its terminal write but before the resume (the resume itself retries transient failures for ~10s) | **At the next safety-net check** | I couldn't verify from this repo how the Vercel dashboard cancels a run. If it calls the backend directly rather than through `@workflow/core`, it falls in the "next safety-net check" row: the parent isn't stranded, but it can sit for up to an interval before noticing. The real fix is for the World backend to resume `wkf_child_run_completion:<parentRunId>` itself whenever a run stamped with `completionParentRunId` reaches a terminal state, whoever wrote it. The token and payload are deliberately derivable from the child run alone so a backend can do exactly that; it's a follow-up outside this repo. The docs call this out in a warn callout and a table ([Cancellations that bypass the SDK](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/cookbook/advanced/child-workflows#cancellations-that-bypass-the-sdk)). ## Fallbacks to polling - `returnValue` awaited anywhere other than the parent: host code, steps, a workflow handed someone else's `Run`. - A child on another deployment that doesn't advertise the protocol (`childRunCompletionVersion` on the health check). A target that doesn't send it is never stamped. - The parent's token is held by another run (conflict). - `WORKFLOW_CHILD_RUN_COMPLETION_HOOK=0` stops new children from being stamped. Already-stamped children still notify. ## Tests - `child-run-completion.test.ts` drives the dispatcher through real replays on the node VM: register → batched read → park → notify → result, a fan-out sharing one hook and one status read, the safety net re-reading after its sleep fires (with backoff), dispose and re-register between waits, a shared wait for repeated awaits, and the non-parent and conflict fallbacks. A QuickJS case covers one system hook plus one batched read. - `quickjs-system-hook-dispose.test.ts`: a disposed system hook's op is released (fails on the old guard). - `start-child-run-completion.test.ts`: stamping (the parent id), the kill switch, cross-deployment with and without the advertised version, and `Run` serialization. - `run-child-completion.test.ts`: `Run.readFinishedRunIds` (order, metadata-only reads, missing runs, errors) and the cancel paths notifying. - `terminal-child-run-completion.test.ts` (node + QuickJS) and `max-deliveries-lifecycle.test.ts`: the parent is notified after `run_completed` / `run_failed`, never before. - `child-run-completion-notify.test.ts`: payload and token, not-found, retry, give-up. - E2E: `awaitChildReturnValueWorkflow` (success and failure) asserts exactly one completion hook, with `isSystem: true`, that the child resumed. The new `awaitChildrenFanOutWorkflow` asserts that 4 children produce **one** `hook_created` and 4 `hook_received`. - Locally: core unit tests and the full nextjs-turbopack e2e suite pass on the node VM (157) and on QuickJS. ## Docs The Child Workflows cookbook covers the one-hook-per-parent model and has a new **Cancellations that bypass the SDK** section (warn callout plus table). I updated `start()`, Starting Workflows, Workflow Composition, Runtime tuning (`WORKFLOW_CHILD_RUN_COMPLETION_HOOK`), the Postgres / Worlds worker sizing pages, the eager-processing changelog note, the world-postgres README, and the `workflow` skill. ### Docs Preview | Page | Link | | --- | --- | | Child Workflows (rewritten) | [/cookbook/advanced/child-workflows](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/cookbook/advanced/child-workflows) | | Child Workflows: Cancellations that bypass the SDK | [/cookbook/advanced/child-workflows#cancellations-that-bypass-the-sdk](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/cookbook/advanced/child-workflows#cancellations-that-bypass-the-sdk) | | `start()`: Inside a workflow function | [/docs/api-reference/workflow-api/start#inside-a-workflow-function](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/docs/api-reference/workflow-api/start#inside-a-workflow-function) | | Starting Workflows | [/docs/foundations/starting-workflows#starting-workflows-from-workflow-functions](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/docs/foundations/starting-workflows#starting-workflows-from-workflow-functions) | | Workflow Composition | [/cookbook/common-patterns/workflow-composition#adapting-to-your-use-case](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/cookbook/common-patterns/workflow-composition#adapting-to-your-use-case) | | Runtime tuning: `WORKFLOW_CHILD_RUN_COMPLETION_HOOK` | [/docs/configuration/runtime-tuning#workflow_child_run_completion_hook](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/docs/configuration/runtime-tuning#workflow_child_run_completion_hook) | | Worlds config: `queueConcurrency` | [/docs/configuration/worlds#queueconcurrency](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/docs/configuration/worlds#queueconcurrency) | | Postgres World: `WORKFLOW_POSTGRES_WORKER_CONCURRENCY` | [/worlds/postgres#workflow_postgres_worker_concurrency](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/worlds/postgres#workflow_postgres_worker_concurrency) | | Eager processing changelog | [/docs/changelog/eager-processing#parentchild-polling-holds-worker-slots](https://workflow-docs-git-auto-register-system-hook-for-child-wo-26a16d.vercel.sh/docs/changelog/eager-processing#parentchild-polling-holds-worker-slots) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com> Co-authored-by: Peter Wielander <29887157+VaguelySerious@users.noreply.github.com>github.com-vercel-workflow · e1bce44d · 2026-11-04
- 2.6ETVfix(world-vercel,world-local): hold process-wide state on globalThis (#3728) * fix(world-vercel,world-local): hold process-wide state on globalThis Both packages are bundled into the host application's server build, and a bundler keys module identity on (resource, layer) — Next.js alone builds `instrument`, app-route, `ssr` and `edge` layers, so one process holds one copy of each of these modules per layer. Every module-scope `const`/`let` in them was therefore per-copy state wearing the costume of a process singleton. vercel/workflow#3493 made `@workflow/world-vercel` bundled rather than external and the events WebSocket transport regressed to HTTP for exactly this reason: the queue consumer registered its channel in the `instrument` copy's `Map` and the write path looked it up in the route copy's empty one. A deterministic miss, for the life of the process. `@workflow/world-local` had the same exposure all along — including `runFileLocks`, where a duplicated mutex simply stops mutually excluding. Add `globalSingleton()` to `@workflow/utils` (the primitive `@workflow/core` already hand-rolls for its World cache) and route every mutable module-scope binding in both worlds through it. Regression cover, in three layers: - `global-singleton.test.ts` pins the primitive's semantics. - `ws-transport-module-copies.test.ts` imports the module twice in one process and asserts a transport registered by one copy is found by the other — it fails on a plain module-scope `Map`, which is the shipped bug. - `scripts/lint/module-scope-state.mjs` fails the class: an AST rule banning mutable module-scope state in these packages, with `// per-copy-ok: <why>` as the deliberate escape. Wired into both packages' `vitest run src`, with fixture self-tests so it cannot rot into a no-op. * test(world-postgres): pin the module-scope-state rule for the postgres world It is deduped today only because `getRuntimeRequire()` loads it — a property of how it is loaded, not how it is written, and exactly what changed for world-vercel in #3493. The package is already clean; this keeps it that way. * docs(worlds): codify "a world must not hold mutable module state" A world package is loaded one of two ways, and only one of them gives it a single module instance: a runtime `require()` (deduped by Node) or the host's bundler (one copy per layer). Which one you get is a property of how the world is loaded, not of how it is written, and it changed under `world-vercel` in #3493 — so the rule has to be "never rely on module scope", not "rely on it until someone flips a config". Written down in the four places someone can meet it: - `docs/content/worlds/{v4,v5}/building-a-world.mdx` — a "Process-wide state" section for custom-world authors, with the loading modes spelled out and a nudge to prefer World-instance state over a global. - `packages/world/README.md` — the same constraint on the contract package. - `CLAUDE.md` — so the next contributor working in these packages sees it. - `packages/core/src/runtime/world.ts` — at the two static imports, which is where the difference between a bundled world and a required one originates. The rule's own error message now teaches it too, rather than naming a helper. Consolidates the guard while here: `@workflow/utils` owns the rule and its fixture self-tests, and sweeps every *published* `packages/world-*` discovered at runtime, so a world package added later is covered without anyone remembering. Each world keeps a one-assertion mirror for locality. * style: drop prose em dashes from this branch's new text #3704 landed a repo-wide writing pass hours after this branch was written and took `world-vercel/src` from 406 em dashes to 130 (`ws-transport.ts` alone went 35 to 1). This branch's docs section, README, comments and lint messages were written before that and would have put 36 of them straight back into the files that were just cleaned. Rewritten sentence by sentence rather than by substitution: an em dash becomes a colon, a comma, a full stop or a parenthetical depending on what it was doing. Also fixes a real defect the sweep surfaced: `world-postgres`'s guard test was generated through a shell heredoc and had literal backslash-backticks in its doc comment. * Update .changeset/world-module-scope-state.md Co-authored-by: Peter Wielander <mittgfu@gmail.com> Signed-off-by: Pranay Prakash <pranay.gp@gmail.com> * fix(core): build the entrypoint's queue handler from getWorld() Adopted from #3666 by @MintedKenny, which implements #3665 and could not run CI as a fork PR. One line of behavior: `workflowEntrypoint`'s lazy handler init calls `getWorld()` rather than `getWorldHandlers()`. `getWorldHandlers()` owns a second, build-time-safe cache, so calling it from the runtime route built a *second* World in the same process. That costs a stateful World duplicate resources on every instance — world-postgres eagerly constructs a `pg.Pool` (default `max: 10`) and a nested world-local World in `createWorld()`, so self-hosted users have been paying for two of each — and, for a bundled world package, the two Worlds are built by two different module copies, which is the mechanism behind the WS transport regression the rest of this branch contains. The public `getWorldHandlers()` and its separate build-time cache are unchanged; only the runtime route stops using it. Kept from the original: the regression test asserting the factory runs exactly once, and the api-reference wording (re-applied over #3704's list punctuation). Not taken: renaming the `workflow.route.get_world_handlers` span. It is a distinct span from the per-request `workflow.route.get_world` at the top of the flow route, and reusing that name would collide with it in traces and in `runtime-trace-mode.test.ts`; a comment records why the name outlived the call. Co-authored-by: Kenneth <kenneth@standardforensics.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: address AI review on the module-scope work Two blocking findings, both real: - **Cross-version state sharing** (`ws-transport.ts`). A process can hold two *published versions* of `@workflow/world-vercel` (a transitive dependency pinning an older `@workflow/core`, which depends on this package by exact version). Both wrote to the same unversioned `Symbol.for` key, so one version's write path could be handed a `WsEventsTransport` built by the other's class and frame against a protocol it may not share — with no version negotiation on the socket to catch it. `shapeVersion` cannot express this: the container is stable, the hazard is its contents. The registry and the events dispatcher recycler are now keyed by package version. The plain connection pools stay unversioned; sharing those across copies is the point. - **The documented pattern failed the rule this PR adds.** The custom-world docs teach `store[StateKey] ??= …`, which the rule flagged as a field write. It now recognizes state rooted at `globalThis`, following one alias hop, which is also what `core/private.ts:23` and `next/src/index.ts:58` are already doing correctly (core drops 26 findings to 22, next 7 to 6). The docs also now say outright that `globalSingleton()` is the same thing, since AGENTS.md prescribes it and the page did not mention it. Rule precision, from the review's probes: - `.mts`/`.cts` are scanned. `@workflow/world-testing` is authored in `.mts`, so its entry in the sweep was passing vacuously — with the walk fixed it reports a real finding, now annotated (it is a standalone `serve()` entry). - Mutations in top-level statements no longer count. A table filled at module evaluation is identical in every copy; divergence needs a later write. - `static` class fields are collected, attributed to the class name. - An *exported* binding initialized to an empty collection is a finding on its own, which approximates the cross-file case the walk cannot resolve. Six fixtures pin the new behavior. The rule's header now states what it does not see, and AGENTS.md states where the sweep stops and why core is not gated yet. Also tags `resetGlobalSingletonForTest` `@internal`. * fix(lint): attribute a static-field write to the field, not the class The static-field support added in the previous commit keyed `declared` on the class name, so a class carrying more than one mutable static reported one finding instead of one per field, and labelled the survivor with whichever mutation was seen first. On a two-static fixture it reported `static Registry.latch (`.set()`)`: the name of one field, the reason belonging to the other, pointing the reader at the wrong line. Key static fields `Class.field` and resolve a write to the same shape, via a new `memberPath()` that takes the first two segments of a member chain and tries that key before the bare root identifier. Two follow-ons fall out of having the path: - `this.field` inside a `static` member resolves to the class, which is the ordinary way to write the mutation. `staticClassOf()` returns nothing for an instance member, where `this` is an instance and the state is per-instance rather than per-copy, and nothing inside a nested `function`, which rebinds `this`. - `state.count++` is now a finding, like the `state.count += 1` that `assignment()` already reported. Fixtures pin all four, including the instance-field case that must stay clean. The four world packages still report zero, and the extracted `recordMutation()` keeps the file at its previous two Biome complexity warnings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: make module duplication inert across every bundled package `@workflow/core` is bundled into the host server build the same way the worlds are, and always has been — the original repro measured three live copies in every arm, including the pre-#3493 external one. One instance is not reachable: layers cannot share a module, and core cannot be external because it *is* workflow code (`runtime/start.ts:253` and nine methods in `runtime/run.ts` are `'use step'`), so it must go through the SWC loader. The Next integration already encodes that rule by removing workflow-bearing packages from `serverExternalPackages`. So the duplication stays and the hazard is removed instead, everywhere the duplication can happen. `@workflow/core` (22 findings to 0): warn-once latches in `constants.ts`, `start.ts` and `telemetry.ts`; the source-map tracer cache; the VM script cache; the QuickJS compiled-assets and baseline caches; the dev-server port cache (its own comment already said "per process"); the text codecs; the zstd browser decoder; and the `useStep` closure brand, where a function marked by one copy was invisible to another. The one with teeth was `step-single-flight.ts`: a per-copy map is not single-flight. Two invocations reaching it through different layers would each believe they were alone in the process and both run the step body, silently degrading in-process dedup to the cross-process residual its own doc scopes out to the ownership lease. Also `@workflow/world` (a warn-once set, hand-rolled onto `globalThis` to keep that package dependency-free), `@workflow/ai` (the lazy OTel API), and `@workflow/nest` (bootstrap config in a module-level `let` and two static class fields — configure one copy, read another, and the controller is unconfigured for the life of the process). Five sites are deliberately per-copy and now say why: state keyed on objects that never cross copies (the barrier safety-net `WeakSet`, the QuickJS pending byte `WeakMap`), the synchronously-scoped guest-code sink, and the OTel diagnostic that reports what *this* copy sees. The sweep now covers all of it. Packages with a single module graph stay out (build-time code, the CLI, the o11y UI, the test runner) and AGENTS.md records which and why. Found while doing this: two static fields on one class collapsed into a single entry in the rule, so `WorkflowModule.options` was invisible behind `WorkflowModule.outDir`. Statics are now keyed `Class.field`. * fix(world): suppress noAssignInExpressions on the globalThis idiom The hand-rolled form trips Biome, as it does in `packages/core/src/private.ts`, which carries the same suppression. Restructuring it into a helper function instead would hide the state behind a call the module-scope rule cannot follow, so the binding would stop being recognized as off-module and the package would report a finding for correct code. * fix: sweep every bundled package, and mark utils side-effect free @shalabhc asked on review whether `@workflow/utils` needs this too. It does, and so do three others: `utils`, `errors`, `serde` and `workflow` all end up in the host application's server build and none were in the sweep. All four report zero today, which is exactly the state `world-testing` appeared to be in before the `.mts` walk was fixed and it turned out to have a real finding. Being clean and being *checked* are different properties, and only the second one survives the next contributor. `sideEffects: false` on `@workflow/utils`: verified that every module in the package only declares (no import-time work), so a bundler can now drop the unused parts of the barrel instead of keeping all ~64 KB of it because three packages import one 476-byte function. --------- Signed-off-by: Pranay Prakash <pranay.gp@gmail.com> Co-authored-by: Peter Wielander <mittgfu@gmail.com> Co-authored-by: Kenneth <kenneth@standardforensics.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Peter Wielander <peter.wielander@vercel.com>github.com-vercel-workflow · f7715854 · 2026-08-21
- 2.1ETV[cli] inspect: page steps/events JSON with --all, fix stream/step/event lookups and short -n names (#4760) ## Summary Fixes six `workflow inspect` problems that make the stock CLI unreliable for reading a long run, plus one alias bug found on the way. It's one commit per item, each with its own tests, plus two follow-up commits from review, and one minor changeset for the whole PR. Only `@workflow/cli` and one docs page change. | # | Problem | Fix | | --- | --- | --- | | 1 | `steps --json` / `events --json` print a bare array with no cursor, so a script can't read a run past one page (100 rows max) in full. The table hint only says "use --interactive" | `--all` (steps, events, sleeps) follows cursors to the last page. When a listing stops early it names the next `--cursor` (shell-quoted; on stderr in JSON mode). Also pins the read path after page 1 (see below) | | 2 | `inspect stream` prints "Failed to read stream" and exits 0 | exit 1 | | 3 | the stream hint says `workflow inspect stream <stream-id>`, which fails with "--run is required" after backend setup; the streams table has no hint | the hint includes `--runId=<the listed run>`, the streams table prints it, and `stream <id>` without `-r` fails before backend setup | | 3b | `inspect st` lists **steps**, though `st` is the documented stream alias | `st` → stream (`s` stays steps) | | 4 | the events hint suggests `inspect event <id>`, which is rejected ("Event-ID is not supported") | `inspect event <event-id> --runId=<run>` via `world.events.get` (every World implements it) | | 5 | `-n` only matches the full name (`workflow//./src/jobs/order//processOrder`); the short `processOrder` the runs table shows matches nothing | `inspect runs/attributes -n` resolve a short name against the 500 most recent runs; a full name is sent as before with no extra request | | 6 | `inspect step <id>` without `-r` looks in the most recent run ("Step … in run \<other\> not found") | require `--runId`, checked before backend setup; no latest-run guess | ## Why A durable agent harness that runs each session as a Workflow run, and uses the queue lease as its only crash backstop (no heartbeats of its own), relies on the stock CLI to show what a session did. Inspecting those sessions on world-local and world-postgres with `@workflow/cli` 5.0.2 hit all six problems. A session with more than 100 events (the largest page) could not be read in full as JSON, and the hints the CLI prints led to commands that fail. None of this changed since 5.0.2: before this PR, `commands/inspect.ts`, `lib/inspect/output.ts`, `stream.ts`, `pagination.ts` and `flag-bounds.ts` on `main` were byte-identical to the 5.0.2 sources. ## What changed Commits, in order (each signed, each with its tests): 1. `[cli] Page inspect steps, events and sleeps to the end with --all` 2. `[cli] Exit non-zero when inspect stream cannot read a stream` 3. `[cli] Show --runId in the inspect stream hints and require it up front` 4. `[cli] Read the inspect st alias as stream` 5. `[cli] Support inspect event <id> --runId` 6. `[cli] Accept the short workflow name the runs table shows in inspect -n` 7. `[cli] Require --runId for inspect step <id>` 8. `[cli] Keep an exact workflow name in inspect -n over a short-name match` (review follow-up). A value the name parser doesn't accept went through the short-name lookup even when a run's `workflowName` was exactly that value. The lookup could then rewrite it to another workflow whose short name matched, and list the wrong runs. An exact match among the scanned runs now keeps the value as given. 9. `[cli] Cover the sleeps fallback under inspect sleeps --all` (review follow-up). The analytics-to-event-log fallback relies on nothing having been printed when it catches. Its comment said one page is fetched, which `--all` changed. The comment is updated, and a test pins that a failing second analytics page still prints the event log's answer once. 10. `[cli] Fold the inspect changesets into one`: the seven per-item changesets become a single minor one. Details: - **Item 1 also fixes a latent paging bug.** `fetchStepsPage` and `fetchEventsPage` re-picked their source on every call. When analytics had no rows yet (a fresh run), page 1 fell back to storage, and page 2 then sent storage's cursor to analytics. The source is now pinned after page 1, which fixes `--interactive` too. A storage-fallback cursor is also not offered for reuse, since a new invocation given a cursor reads analytics. - **`--all`** is rejected before backend setup in these cases: - on `runs`/`hooks`/`attributes`, whose JSON already carries the cursor; - with an ID; - with `-i`; - with `--url`/`--web`. A repeated cursor, or `hasMore` without a cursor, throws instead of looping or returning a short answer. `--limit` is still the page size (default 20), so `--limit 100 --all` is the cheap form. - **Item 5 cost and scope.** A short name costs up to 5 list requests, and only when the value isn't a full `workflow//…//…` name. The lookup scans recent runs only (on Vercel, the analytics window: `--since` or the default 24h). - No match passes the value through with a warning. - A value that is some scanned run's exact `workflowName` is kept as given. - A short name shared by several workflows (the same export in two modules, or two dynamic workflow names) fails with the candidates. - `showStream`, `showEvent` and `showStep` keep their own no-run guard for direct callers. - Docs: `docs/content/docs/v5/configuration/cli-and-web-ui.mdx` documents `--all`, and updates `--cursor`, `--limit` (inspect), `--runId` and `--workflowName`. ## Compatibility and rollout CLI only: no World, API or storage change. - **Unchanged:** - JSON output shapes. `steps`, `events` and `sleeps` still print a bare array; `runs` and `hooks` still print their page object. - A full `-n` name is sent exactly as before, with no extra request. - The listings (`steps`, `events`, `streams`) keep their latest-run default when `-r` is omitted. - **New stderr output:** in JSON mode, a listing that stops with more rows prints a `[Warn]` line naming the next `--cursor` on stderr. stdout is unchanged. - **Behavior changes (released as patch, since both commands only worked by accident before):** - `inspect stream <id>` without `-r` now exits 1 before backend setup. It failed before too, but after setup and auth. - `inspect step <id>` without `-r` now exits 1 before backend setup. It used to work only when the step was in the newest run. - `inspect stream` exits 1 when it can't read or decode a stream (was 0). - `inspect st` now lists streams. It listed steps; `s` remains the step alias. - **Backports:** this mixes features (minor) and fixes (patch), so the backport bot will likely decline it for `stable`. See the open questions. ## How it was tested - Rebased on current `main`. `pnpm --filter @workflow/cli test`: 16 files, 248 tests pass (161 on `main`). - Every new test was run against the previous sources and fails there: the paging pin, the stream exit code, run-scoped lookups, the `st` alias, `showEvent`, short `-n`, and `showStep`. - New files: `pagination.test.ts` (`fetchAllPages`, the hint text and quoting), `stream.test.ts` (including a stream of plain JSON lines through the real `getDeserializeStream`), and `workflow-name.test.ts`. - Extended: `output.test.ts`, `flag-bounds.test.ts`, `inspect-flag-scope.test.ts` (rejected before `setupCliWorld`), and `inspect-flag-forwarding.test.ts`. - One existing test changed: `listAttributes` "passes the window, name filter and cursor" now passes a full workflow name, since a short one triggers the new lookup. - `pnpm --filter @workflow/cli typecheck`, `biome ci packages/cli docs/content` (no new diagnostics: the same 20 warnings and 6 infos as `main`), `node scripts/check-changesets.mjs`, and `node scripts/check-no-unrun-tests.mjs` all pass. - End to end with the built CLI against world-local, on a seeded run with 122 events (40 step lifecycles) and a stream of plain JSON lines: - `events --json --all --limit 100` → 122 rows. - `events --json --limit 100` → 100 rows plus `More results available. Pass --cursor key:evnt_…023 …` on stderr. That cursor returns the other 22. - `steps --json --all` → 40 rows (2 pages of 20). - `stream <name> -r <run>` → exit 1. Without `-r` → exit 1 before backend setup. - `event evnt_…003 -r <run> --json` → the `step_created` event. - `runs -n <short name from the runs table>` → that workflow's run. - `step step_001` → exit 1. With `-r` → the step. - `st -r <run>` → the streams listing. ## Open questions for reviewers 1. **`--all` vs a page object for `steps`/`events`/`sleeps --json`.** This PR keeps the bare array and adds `--all` plus the stderr cursor, which is non-breaking. The array is pinned on purpose (`output.test.ts` "preserves the JSON array output", #2648), and `test-bulk-cancel.sh` iterates it. Printing `{ data, cursor, hasMore }` like `runs`/`hooks` would be more consistent, but it's a breaking change for the next major. OK to keep `--all` for 5.x? 2. **Strict `-r` for `stream <id>` / `step <id>` / `event <id>`.** These exit 1 up front without `--runId`. A softer variant, which tries the latest run and then fails with "add --runId", is easy to add if preferred. Is the strict exit, released as a patch, acceptable? 3. **Short `-n` lookup.** Up to 5 extra list requests and 500 recent runs. Is that the right bound? `workflow cancel -n` stays exact on purpose, since a short-name match on a destructive command deserves its own review. Its own example (`--workflowName=myWorkflow`, `commands/cancel.ts`) matches nothing today. Worth a follow-up? 4. **`--all` page size.** It keeps `--limit`'s default of 20, so a 1,000-event run costs 50 requests unless `--limit 100` is passed. Telling the default apart from an explicit `--limit 20` would need a flag change. Fine as documented? 5. **Backport.** The stream exit code (2) and the `st` alias (3b) are self-contained fixes. Should they be split out for `stable`, or is 5.x-only fine? ## Related PRs and merge order Independent. It touches only `packages/cli` and `docs/content/docs/v5/configuration/cli-and-web-ui.mdx`, which no other open PR in this series changes. It can merge in any order. ## Docs Preview | Section | v5 | | --- | --- | | `--all` (new) | [configuration/cli-and-web-ui#--all](https://workflow-docs-git-pgp-cli-inspect-fixes.vercel.sh/docs/configuration/cli-and-web-ui#--all) | | `--cursor` | [#--cursor](https://workflow-docs-git-pgp-cli-inspect-fixes.vercel.sh/docs/configuration/cli-and-web-ui#--cursor) | | `--limit` (inspect) | [#--limit-inspect](https://workflow-docs-git-pgp-cli-inspect-fixes.vercel.sh/docs/configuration/cli-and-web-ui#--limit-inspect) | | `--runId` / `-r` | [#--runid---r](https://workflow-docs-git-pgp-cli-inspect-fixes.vercel.sh/docs/configuration/cli-and-web-ui#--runid---r) | | `--workflowName` / `-n` | [#--workflowname---n](https://workflow-docs-git-pgp-cli-inspect-fixes.vercel.sh/docs/configuration/cli-and-web-ui#--workflowname---n) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>github.com-vercel-workflow · 1342a96a · 2026-10-08
- 2.0ETV[nest] Adversarial edge-case and UX pass on the NestJS integration (#4604) Co-authored-by: Peter Wielander <mittgfu@gmail.com> Co-authored-by: Peter Wielander <peter.wielander@vercel.com>github.com-vercel-workflow · 482b9183 · 2026-10-05
- 1.4ETVfeat(core): resolve run.returnValue via a World long poll instead of a 1s poll (#3570) Co-authored-by: Peter Wielander <mittgfu@gmail.com> Co-authored-by: Peter Wielander <peter.wielander@vercel.com>github.com-vercel-workflow · 9454d51d · 2026-08-20
- 1.4ETVAdd support for 'noop' event type - spec version 7 (#3634) Co-authored-by: Peter Wielander <peter.wielander@vercel.com>github.com-vercel-workflow · 7b79ba37 · 2026-08-21
- 1.4ETVFix the local-dev e2e reload race and recurring CI flakes (#5243) ## Why `main` is red `Tests` has failed on every `main` commit since #5211 (nuxt 4.6.3, which also moved vite to 8.3 and rollup to 4.67). The job that fails every time is **E2E Local Dev Tests** on the Nitro-based lanes (hono, fastify, nitro, nuxt). The suite fails in `beforeAll` before any test runs: ``` Failed to fetch manifest from http://localhost:3000/.well-known/workflow/v1/manifest.json: 500 "read ECONNRESET" ``` On nuxt the same thing shows up as `Hook timed out in 150000ms`. **Cause.** Each fixture write and restore in `dev.test.ts` triggers a Nitro `dev:reload`. The Nitro integration runs a full workflow rebuild (4–10s on CI) for every reload, and it queued those rebuilds one after another. Cleaning up after the last test therefore set off one failed build and three serial rebuilds, ending about 16s after the suite. Each finished rebuild ends in a dev worker restart. Nitro's runner (`env-runner`'s `RunnerManager.reload`) closes the previous worker straight away, resetting every request in flight. CI waited a fixed `sleep 10` before starting the e2e suite. On the last green commit the suite's first request cleared the final rebuild by 0.8s. The dependency bump shifted timing just enough that it now lands mid-restart. I reproduced this locally on hono: with a 6s gap the suite fails with the same `ECONNRESET` / `socket hang up`. ## Fixes - **`@workflow/nitro`: coalesce dev rebuilds.** `build()` calls made while a build runs now share one queued build. That build starts after all of them and reads the input files then, so it covers every change. A burst of file events (save-all, branch switch, a test restoring fixtures) now costs at most one follow-up rebuild instead of one per event, so the server settles sooner: locally about 8s after `dev.test.ts` instead of about 16s. Nitro still restarts its dev worker once per `dev:reload`; those restarts now happen back to back after the shared build. The next two changes are what close the race. - **`dev.test.ts` hands the dev server on settled.** A new `afterAll` waits for the HMR log to drain (Next), then for the generated workflow outputs to stop changing for a quiet window, then for the manifest to answer. The window is 1.5× the longest gap seen between two output writes, with a 12s minimum. The fixed `sleep 10` after it in CI is removed. - **`fetchManifest` retries transient failures.** It retries connection resets, timeouts, 5xx and 429 within a bounded window, each attempt with its own timeout. A 4xx still fails at once. Concurrent callers share one request. Verified locally on hono: starting the e2e suite with no delay after `dev.test.ts` passes 3/3. Before the fix, a 6s delay failed. ## Recurring flakes fixed I went through the failing jobs of the last ~50 failed `Tests` runs on `main`: - **Whole Vercel runs failing on a GitHub OIDC 503** (up to 26 lanes in one run): `Failed to mint GitHub Actions OIDC token: 503 Service Unavailable`. One failed mint failed the lane's whole suite. `scripts/trusted-sources-headers.mjs` now retries 5xx, 429 and network errors with backoff (5 attempts) and gives each attempt a 10s timeout so an endpoint that never answers is retried. An early refresh that still holds a valid token tries once and then falls back to that token. A 4xx is still final. - **Windows: `spec-stamp-world-local` › `stamps every message of a spec 8 run ('quickjs')`** (`expected 0 to be greater than 0`). On a slow runner the workflow's `sleep("1s")` has already elapsed when the run suspends. The spec 8 engine then correctly resumes it with a plain wake, not a timer message, so the test's timer assertion failed. Not a runtime bug. Reproduced 16/16 under CPU contention, same message and ~22s duration as on CI. The cases that assert a timer now sleep 3s, and pass 16/16 under the same load. - **Windows: `orchestrator.runtime` › `starts the inline bodies while the background steps are dispatched`** (`expected +0 to be 3`). Under load the inline bodies start 1–2.5s late, and over 10s late for the file's first run (module loading), which is past the test's 2s `waitFor`. They still start while the dispatch is held, which is what the test checks. The budget is now 30s. The step batch is held until the test releases it, so the assertion keeps its meaning. Reproduced 10/12 at 12× contention; the fixed test passes 12/12. - **`workflow health` reachability probe** (`nextjs-webpack` canary): the local-server check before the health check used a hardcoded 5s fetch timeout and ignored `--timeout`. It also reported a server that answered with an error status as unreachable. It now uses `--timeout`, and an error status gets its own message. - **Windows: `inline-step-writes` › three-creation-batch fan-outs** (QuickJS, `Test timed out in 60000ms`): each step outcome replays a fan-out of about 190 steps, about 6s locally and 28–54s on Windows in recent `main` runs. These four tests get a 180s timeout. Not changed: - The hook-token e2e failures (`hookCleanupTestWorkflow`, the concurrent hook token conflict test, `hookClaimOnlyMutexWorkflow`, …) almost all come from one run in which every Vercel lane timed out at once, on a docs-only commit. That points to an outage on that day, not a code regression. - `fence-lock` SIGKILL was already deflaked in #5162. ## Tests - `packages/nitro`: build coalescing and failure isolation (the coalescing test fails on the old builder). - `packages/core/e2e/utils.test.ts`: `fetchManifest` against a local server that resets connections and answers 5xx/4xx (two of the three fail on the old code). - `scripts/trusted-sources-headers.test.mjs`: mint retry, no retry on 4xx, bounded attempts, a hung attempt, keeping a still-valid token after one attempt. - `packages/cli/src/commands/health.test.ts`: the probe honours its timeout, and reports an error status as an answering server. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>github.com-vercel-workflow · 9bed0a71 · 2026-11-04
- 1.3ETV[world-postgres] Renew running deliveries' job locks and redeliver abandoned jobs after a configurable stale window (opt-in) (#4759) **Summary.** Adds an opt-in lease for `@workflow/world-postgres` deliveries. With `jobLockStaleSeconds` / `WORKFLOW_POSTGRES_JOB_LOCK_STALE_SECONDS` set, a running delivery renews its Graphile job lock, and every process that runs workers releases this World's jobs whose locks have gone unrenewed for that many seconds, so another process redelivers them. Today a job whose worker died stays locked for Graphile Worker's fixed 4 hours. **The default is `0` (off)**, so upgrading changes nothing until a deployment opts in. `30` is the recommended value for deployments with more than one process. This is the lease model #3992 and #3993 ask for ("a lease/visibility-timeout model where a delivery that stops being renewed is simply redelivered"), for crashed deliveries. It doesn't change retired jobs. Signed-off-by: Pranay Prakash <pranay.gp@gmail.com> Co-authored-by: Peter Wielander <mittgfu@gmail.com> Co-authored-by: Peter Wielander <peter.wielander@vercel.com>github.com-vercel-workflow · c07a6a39 · 2026-10-28