Commit Graph

1221 Commits

Author SHA1 Message Date
github-actions[bot] 05e46fa3f6 Version Packages (beta) (#2326)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@5.0.0-beta.14
2026-06-11 08:22:01 -07:00
Peter Wielander 884bd8db76 [ci] Fix flaky windows unit tests (#2359) 2026-06-11 14:16:47 +02:00
Peter Wielander c000462502 Capture Vercel runtime logs when e2e Vercel Prod lanes fail (#2356) 2026-06-11 12:36:39 +02:00
Peter Wielander 4e8a9657c9 Fix e2e failure reporting under vitest 4 and preserve fetch error causes (#2355) 2026-06-11 12:36:31 +02:00
Nathan Rajlich a813382216 [core] Fix process crash from rejected waitUntil promises (#2336)
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-11 11:18:04 +02:00
Pranay Prakash bf44d4dd0a [core] Remove duplicate waitUntil for suspension handler async operations (#2345)
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-11 10:36:25 +02:00
Justin Xu 95d7009e8a Prevent local tests from hanging (#2338)
* Prevent local tests from hanging

This commit allows manually running pnpm test:
- use vitest run to stop world-vercel and world-testing when complete
- disable Nuxt telemetry to prevent interactive telemetry prompt

Signed-off-by: Justin Xu <xu.justin.j@gmail.com>

* Disable Nuxt telemetry via workspace .nuxtrc instead of inline env vars

The inline NUXT_TELEMETRY_DISABLED=1 in package.json scripts doesn't work
on Windows (pnpm runs scripts through cmd.exe). A workspace-root .nuxtrc
is cross-platform, and @nuxt/kit resolves it from the pnpm workspace root,
so it also covers workbench/nuxt's build/dev, which hit the same
first-run consent prompt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Signed-off-by: Justin Xu <xu.justin.j@gmail.com>
Co-authored-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 21:28:56 -07:00
Will Sather 4670c4b92d feat(core): add optional namespace for queue topic prefix (#2305)
* feat(core): add optional namespace for queue prefix

* fix(world-postgres): job queue prefix validation

* fix: changeset description

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Will Sather <56037657+willsather@users.noreply.github.com>

* fix: add world-postgres to changeset

* fix: world-postgres handle namespaced job queue names

* fix: resolve namespace via env var in core runtime

* fix: world-postgres job queue name task handler

* fix(world-postgres): honor namespace on consumer side

* Fix namespaced queue routing reliability (#2340)

* Fix namespaced queue routing reliability

* Inline queue namespace in generated routes

* Avoid loading Vercel functions during runtime import

---------

Signed-off-by: Will Sather <56037657+willsather@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2026-06-10 20:21:17 -07:00
Mitul Shah eb2b8c988d [web-shared] Show precise durations in the new trace viewer (#2335)
* [web-shared] Show precise durations in the new trace viewer

The events list and timeline bar labels now render two-decimal seconds for
durations over 1s instead of rounding to whole seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>

* [web-shared] Fix duration rounding at unit boundaries

formatDurationPrecise bucketed durations on the raw ms value but only
rounded at display time, so inputs just below a unit boundary carried
into the next unit without re-bucketing (e.g. 59999ms -> "60.00s").

Round to centisecond precision FIRST, then decompose in integer
centisecond space so the seconds component stays in [0.00, 59.99] and
carries re-bucket into the next unit (59999ms -> "1m 0.00s").

Co-authored-by: Cursor <cursoragent@cursor.com>

* [web-shared] Simplify precise duration formatting

Reuse the existing MS_IN_* constants instead of the centisecond decomposition; behavior is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 20:57:29 +00:00
Pranay Prakash f5f6d0ede6 Validate unique workflow step IDs at build time (#2018)
* Validate unique step ids at build time

* Fall back to file-path IDs for non-exported package files

Instead of synthesizing a 'name/dist/<path>@version' specifier (which
hardcoded the dist/ output convention), non-exported workspace/node_modules
files now return moduleSpecifier: undefined and let the SWC plugin's
'./{filepath}' fallback produce per-file IDs. This is the same path local
app files have always taken and avoids the dist/ assumption flagged in
review. The build-time duplicate-ID check stays as the safety net.

* Dedupe virtual-entry imports by canonical module identity

When both the source and the compiled-dist copies of the same workspace
package export end up in discoveredSteps/discoveredWorkflows (e.g. the
'workflow' package's internal/builtins in monorepo dev), they resolve to
the same module via esbuild's package resolution. The virtual entry was
emitting BOTH 'import "workflow/internal/builtins";' (the built-in
preamble) and 'import "../../packages/workflow/src/internal/builtins.ts";'
(via the isWorkspaceSourceBackedPackageFile carve-out in createImport),
which made the swc plugin transform both copies and generate duplicate
step IDs.

Track a per-bundle set of emitted module identities (package specifier
when reachable, otherwise the file path) and skip files whose identity
has already been imported. The steps bundle pre-seeds the set with the
built-in steps specifier so workspace step files at that path don't
emit a competing relative-path import.

* Stop rewriting workspace package /dist/ -> /src/ during Next.js discovery

The Next.js deferred builder's `resolveSourceBackedPackagePath` rewrote
any discovered `/dist/` path to its `/src/` sibling for workspace
packages and for `workflow`/`@workflow/*` tarballs. That made the
discovered step file list point at source files while base-builder's
esbuild bundle (which builds the workflow VM and step registrations)
resolved the same package imports through `pkg.exports` to
`/dist/`. The workflow proxy ID — generated from the dist path —
didn't match the step bundle's registration ID — generated from the
src path — producing "Step function not registered" failures at
runtime, most visibly with @workflow/ai's doStreamStep on Vercel and
Windows Next.js deployments.

App code that imports a package by name should resolve naturally
through pkg.exports; the loader has no business reaching into the
package's source tree. Drop the rewrite (and the now-unused
`resolveCopiedStepImportTargetPath` helper that supported it).
Workspace packages are still discovered — that's a separate predicate
(`shouldPreferSourceBackedPackagePath`) which only gates inclusion,
not path translation.

Verified locally with the nextjs-turbopack workbench: agent e2e suite
(19 tests, including the failing `agentBasicE2e`) and the
addTenWorkflow duplicate-name suite all pass.

* Address review nits: extract stripPackageVersion, expand duplicate-ID hint, note new build-time check in changeset

---------

Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-10 12:59:12 -07:00
Mitul Shah b5396bc932 Move run attributes into their own detail card (#2327)
* Move run attributes into their own detail card

Render the run's `attributes` field as a dedicated collapsible
DetailCard in the detail panel instead of as a cramped JSON value
inside the top metadata key/value list.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Create empty-worlds-throw.md

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>

* Render attributes card after Input/Output

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 12:10:50 -07:00
Peter Wielander eb976db35b [core] Forward-port stream reconnect to getReadable level (#2318) 2026-06-10 20:41:20 +02:00
Peter Wielander b549342c5c [docs] Add "Step executed multiple times" error page (#2310) 2026-06-10 20:37:22 +02:00
Mitul Shah 3e49c6ebf4 Fix flickering on the detail panel when navigating the trace viewer (#2325)
* ok

* Update events-list.tsx

* Apply suggestion from @VaguelySerious

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Mitul Shah <mitulxshah@gmail.com>

---------

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-06-10 12:43:36 -04:00
github-actions[bot] 73e64bba03 Version Packages (beta) (#2254)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@5.0.0-beta.13
2026-06-09 11:03:11 -07:00
Pranay Prakash bb6ff9ac99 Patch vulnerable package dependencies (#2301)
* chore: patch package dependency vulnerabilities

Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>

* Prefer direct dependency upgrades for security fixes

---------

Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
2026-06-08 16:29:26 -07:00
Karthik Kalyan 3ae0ae2917 Deprecate DurableAgent and update it with WorkflowAgent in v5 docs (#2285)
* docs: deprecate DurableAgent in v5

* docs: fix workflow docs CI failures

* docs: trim deprecated DurableAgent guidance

* docs: point v5 cookbook to WorkflowAgent

* docs: fix v5 cookbook navigation

* docs: align WorkflowAgent guide

* docs: add WorkflowAgent cookbook heading

* docs: expand WorkflowAgent cookbook handoff
2026-06-08 16:02:18 -07:00
Pranay Prakash 867e33903d [codex] Fix partial world-local exclusive writes (#2296)
* fix(world-local): publish exclusive files atomically

* fix(world-local): guard temp cleanup
2026-06-08 13:04:56 -07:00
Nathan Rajlich c19f38d907 [world-vercel] Validate ref resolve responses before use (#2035)
* [world-vercel] Validate ref resolve responses before use

When workflow-server returns a ref body to the SDK, the bytes are
fed into the workflow runtime's event log and deserialized via
`decodeFormatPrefix`. The SDK always writes ref payloads with at
least a 4-byte format prefix (see `encodeWithFormatPrefix` in
`@workflow/core`), so a zero-byte response — or one whose length
disagrees with `Content-Length` — is never a valid stored value.

Before this change, `resolveRefDescriptor` had no validation: a
200 with an empty body would be passed downstream as a zero-length
Uint8Array, which then failed deep inside replay with:

    Data too short to contain format prefix: expected at least 4 bytes, got 0

By that point the workflow's in-memory event snapshot is already
poisoned with the empty payload, so every subsequent replay
deterministically reproduces the same failure, downstream
`resumeHook()` calls surface as `Hook not found`, and the run
only unsticks when stale-run cleanup terminates the sandbox.

This catches the failure at the transport boundary instead, where
it can be retried as a `WorkflowWorldError`. Both an empty body
and a length mismatch (truncated streaming response) are rejected.

This is the SDK-side companion to vercel/workflow-server#432, which
adds the same validation on the server side.

* Address review: reject <4-byte bodies, handle malformed Content-Length

Three review changes:

1. Reject any body shorter than the 4-byte format-prefix length, not
   just zero-byte bodies. The SDK guarantees every stored ref payload
   starts with a 4-byte format prefix (FORMAT_PREFIX_LENGTH in
   @workflow/core), so a 1-3 byte body would also fail downstream
   replay with the same 'Data too short to contain format prefix'
   error this PR exists to prevent.

2. Parse Content-Length safely with parseInt + Number.isFinite +
   non-negative checks instead of bare Number(). A non-numeric value
   like 'abc' would otherwise produce NaN and silently surface as a
   'truncated' error, masking the real cause. Malformed values are
   treated as absent; the minimum-length check still defends against
   actual truncation in that case.

3. Add tests for the truncated-body-without-Content-Length case
   (chunked transfer where Content-Length validation can't see the
   truncation), and for a malformed Content-Length header that should
   be ignored rather than misreported as truncation.

The validation logic also moves into a small assertValidRefBody
helper to keep the inner trace function under the noExcessiveCognitiveComplexity limit.

* Address review: scope 4-byte minimum to binary refs, strict Content-Length parsing

- Only apply the 4-byte format-prefix minimum to application/octet-stream
  payloads; CBOR refs can legitimately be 1-byte primitives (true/0/null).
- Require Content-Length to be a plain run of digits before comparing;
  parseInt would otherwise accept numeric-prefixed garbage ('12junk' -> 12).
- Make the changeset succinct.

* Address review: skip Content-Length check for compressed responses

fetch/undici transparently decompresses gzip/br bodies but leaves
Content-Length describing the encoded (compressed) size, so comparing it
against the decompressed byteLength would reject valid compressed refs as
a phantom 'ref-body-length-mismatch'. Skip the comparison when a
non-identity Content-Encoding is present; an absent or 'identity' encoding
is still validated. Adds regression tests for both cases.
2026-06-08 12:34:28 -07:00
Pranay Prakash aa628b7a8f fix: bump devalue to 5.8.1 (#2292) 2026-06-08 12:04:38 -07:00
Pranay Prakash ccd37e9a59 Handle lazy stream key request failures (#2257)
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
2026-06-08 12:01:39 -07:00
Nathan Rajlich 0e39f3b657 fix(docs): declare Nitro auto-import globals for code samples (#2290)
The nitro-native-build changelog sample calls useStorage() (a Nitro
server-side auto-import) from a step, which the docs type-checker
couldn't resolve and failed with TS2552. Add liberal global
declarations for useStorage/useDatabase/useRuntimeConfig so Nitro
auto-imports type-check in docs samples.
2026-06-08 11:29:05 -07:00
Peter Wielander 0fd0891cc4 [core] Preserve event-log order in hook-vs-sleep replay races (#2171) (#2185)
Co-authored-by: Nathan Rajlich <n@n8.io>
2026-06-08 10:39:32 -07:00
Rihan Arfan 5b448ceb03 docs: add nitro changelog (#2232) 2026-06-08 16:06:55 +01:00
Will Binns-Smith a51910b29a fix(next): always apply turbopack content condition regardless of builder mode (#2253)
* fix(next): always apply turbopack content condition regardless of builder mode

When lazy discovery is enabled (deferred builder), shouldApplyTurboCondition
was false, so turbopack.rules were added with no content filter — causing the
workflow loader to run on every JS/TS file. Apply the content condition
unconditionally so the loader only fires on files with workflow directives.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* add changeset

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2026-06-05 14:31:18 -07:00
Casey Gowrie 81bda490ef Update @vercel/queue from 0.2.1 to 0.3.0 (#2255)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-05 11:39:53 -07:00
Peter Wielander d674d6fccd [nest] Use AST-based CommonJS import rewriting (#2080)
Signed-off-by: yao <zhangyaoruo@outlook.com>
Co-authored-by: yao <zhangyaoruo@outlook.com>
2026-06-05 18:09:03 +02:00
Nathan Rajlich 8d75491a07 [core] Surface workflowCoreVersion from healthCheck() result (#1854)
Co-authored-by: Peter Wielander <peter.wielander@vercel.com>
2026-06-05 18:07:41 +02:00
JJ Kasper 0b8b077345 Fix Next lazy step route imports (#2263) 2026-06-05 09:05:19 -07:00
Karthik Kalyan 63f1a9906d [web-shared] Fix message-only error rendering (#2251)
* Fix message-only error rendering

* Handle non-string error stacks
2026-06-04 15:39:47 -07:00
Mitul Shah 9398065812 Cleaning up trace viewer code (#2252)
* cleanup

* remove dead code

* Delete .changeset/postgres-pin-event-now.md

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>

* Update icons.tsx

* Update event-list.tsx

* Update timeline.tsx

* Create trace-viewer-cleanup.md

---------

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
2026-06-04 16:25:03 -04:00
github-actions[bot] ff66ee9f2b Version Packages (beta) (#2216)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@5.0.0-beta.12
2026-06-04 13:06:39 -07:00
Karthik Kalyan 5bf2c167a5 Add serializable reviver compatibility check (#2250) 2026-06-04 12:50:32 -07:00
Karthik Kalyan 24a96d8301 Fix HookConflictError web hydration (#2249) 2026-06-04 11:47:07 -07:00
Casey Gowrie ddc8a79741 Update @vercel/queue from 0.1.7 to 0.2.1 (#2246)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-04 16:17:53 +00:00
Andrew Barba 3a16272bd3 feat(world-vercel): allow a custom dispatcher (#2235)
* feat(world-vercel): allow a custom dispatcher

Add a `dispatcher` option to `APIConfig`/`createVercelWorld` so callers can
supply a custom undici dispatcher. It is threaded through every request path
(HTTP and the queue) and defaults to the shared undici RetryAgent.

* docs(world-vercel): explain why dispatcher is typed unknown
2026-06-04 02:15:30 +00:00
Mitul Shah fe41b3be3c Reduce width on trace viewer detail pane (#2209)
* Update trace-viewer.tsx

* Create narrow-trace-detail-pane.md
2026-06-03 21:40:22 +00:00
Peter Wielander b8a337c945 [world-local] [world-vercel] Update undici from 7.22.0 to 7.26.0 (#2231) 2026-06-03 18:07:38 +02:00
Pranay Prakash 12c35b54eb fix(core): skip terminal event replay on main (#2215) 2026-06-02 13:04:22 -07:00
Rihan Arfan a65105235c feat(nitro): add /_workflow web ui during dev (#2110) 2026-06-02 14:43:56 +01:00
Peter Wielander 249196935a [docs] Reduce noise in changelog files (#2075) 2026-06-02 12:17:59 +02:00
Pranay Prakash 52d63d1b61 fix(core): advance workflow clock only for consumed events (#2206) (#2211)
* fix(core): advance workflow clock only for consumed events

* test(core): hammer replay branch clock determinism

* fix(core): address consumed event replay review feedback

* test(core): bound replay regression concurrency

(cherry picked from commit 1e32d05758)
2026-06-01 23:49:39 -07:00
Pranay Prakash 2a3b11bcb4 Retry replay divergence before failing event logs (#2212)
(cherry picked from commit 813cd9a9de)
2026-06-02 08:48:00 +02:00
github-actions[bot] 275316fac4 Version Packages (beta) (#2183)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@5.0.0-beta.11
2026-06-01 20:49:30 -07:00
Pranay Prakash 3867270be8 Reduce unnecessary CI runtime (#2151)
* Reduce unnecessary CI runtime

* Fix shared E2E artifact extraction path

* Stabilize getWorkflowPort timeout test on Windows

* Preserve UI unit coverage on CI fast path
2026-06-02 02:49:20 +00:00
Peter Wielander 7994629b8b [world-vercel] Retry transient response-body parse failures in the HTTP client (#2204)
* fix(world-vercel): retry transient response-body parse failures in the HTTP client

A sporadic failure reading/decoding a 2xx response body (truncated or
terminated stream, connection reset mid-body, or a gateway returning a
non-CBOR/JSON body) was surfaced immediately as a PARSE_ERROR. The
shared RetryAgent only retries connection/5xx failures — body
consumption happens after it returns the response, so these escape its
retry logic.

Retry such failures inside `makeRequest` with bounded exponential
backoff, scoped to idempotent methods (GET/HEAD) so writes are never
replayed. This fixes the reported `events.list` parse failure at the
adapter layer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(core): propagate exhausted transient world errors to the queue

Pairs with the world-vercel in-adapter retry: when a response-body parse
failure survives the adapter's retries (or comes from a non-idempotent
write that is never retried in-process), it must not fail the run.
Re-throw such transient world errors from the replay loop so they
propagate to the queue handler, which replays the whole run — safe
because replay is idempotent. Schema-validation contract errors stay
fatal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Revert "fix(core): propagate exhausted transient world errors to the queue"

This reverts commit 7bb62e9f81.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 13:49:49 -07:00
Mitul Shah 445ec8c7e6 Add virtualization to the trace viewer (#2205)
* loading state

* Update trace-viewer.tsx

* Update use-trace-viewer.test.ts

* virtualization

* Create swift-parks-move.md

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>

---------

Signed-off-by: Mitul Shah <mitulxshah@gmail.com>
2026-06-01 20:22:30 +00:00
Mitul Shah f0f002ae05 Trace viewer: scroll-load events past an auto-load cap (#2200)
* loading state

* Update trace-viewer.tsx

* Update use-trace-viewer.test.ts
2026-06-01 15:42:47 -04:00
Pranay Prakash 8f68d3525c fix(core): resolve forwarded stream keys across deployments (#2191) 2026-06-01 18:38:38 +00:00
Peter Wielander ae3c833acd [e2e] Improve error labeling in event-log-race-repro CI job (#2190) 2026-06-01 11:07:50 +02:00