Commit Graph

707 Commits

Author SHA1 Message Date
Vercel Release Bot 09343c1b13 Version Packages (beta) (#1238) workflow@4.1.0-beta.63 2026-03-03 12:47:33 -08:00
Nathan Rajlich 2b1c2bd8e6 [world-vercel] Fix run_failed event schema validation with separate resolve/lazy wire schemas (#1222)
* Fix run_failed event schema validation failure in lazy ref mode

The EventResultWireSchema used the strict WorkflowRunSchema (discriminated
union) which requires error: StructuredErrorSchema for status 'failed'. When
run_failed events use remoteRefBehavior 'lazy', the server returns the error
field as a RemoteRef or undefined, causing Zod validation to fail.

Switch to WorkflowRunWireBaseSchema which accepts error as string, structured
object, or undefined, and apply deserializeError() to normalize the run entity
before returning it to consumers.

Closes #1180

* Use strict WorkflowRunSchema for resolve mode, loose wire schema for lazy mode

Split EventResultWireSchema into two variants based on remoteRefBehavior:
- EventResultResolveWireSchema uses WorkflowRunSchema (discriminated union)
  for events where the client reads result.run (run_created, run_started,
  step_started), preserving type safety.
- EventResultLazyWireSchema uses WorkflowRunWireBaseSchema for events where
  the client discards the response, allowing error to be a string or
  undefined in lazy ref mode.

* Update changeset to reflect resolve/lazy schema split

* Simplify changeset description
2026-03-03 12:20:18 -08:00
JJ Kasper a9fea9132e Update workbench tests to build and run outside of monorepo (#1230)
* Setup fixes

* ci: run local e2e against staged tarball workbenches

* ci: update staged workbench tarball setup script

* chore: set nextjs workbenches back to next 16.1.6

* update lock

* test(e2e): resolve workbench path from WORKBENCH_APP_PATH

* fix: address deferred builder issues outside monorepo

* ci: stage tarball workbenches only for nextjs local e2e

* fix(next): discover deferred steps imported via workflows

* test(core): gate deferred step-discovery dev test to canary

* test(e2e): cover cross-file imported step in build/start lanes

* fix(e2e): use local manifest in local runs and relax dev rebuild timeout

* fix(workbench): add imported-step workflow symlink for sveltekit/astro

* test(e2e): scope imported-step workflow test to nextjs lanes

* fix(next): rebuild deferred entries on discovered file updates

* fix(next): watch transitive deferred step deps for dev rebuilds

* fix(next): restore socket-driven deferred step rebuilds

* add changeset

* chore: address review feedback on deferred e2e updates

* fix(cli): guard stream flush against closed write streams
2026-03-03 11:17:39 -08:00
John Lindquist 4ac75f4806 Add Fluid compute callout to Vercel World docs (#1242)
* Add Fluid compute warning callout to Vercel World docs

Follow-up from #1216 review feedback to include the
FluidComputeCallout on the Vercel World page.

* Register FluidComputeCallout in worlds/[id] page

The /worlds/vercel route uses a separate page component from
/docs/... and was missing the FluidComputeCallout in its MDX
component map, causing a 500 error.
2026-03-02 19:43:23 -08:00
Karthik Kalyan e2420bed29 fix sync front dispatch job (#1244) 2026-03-02 18:24:54 -08:00
Peter Wielander ece45a0d7c Lint after biome update (whitespace changes only) (#1243) 2026-03-02 17:21:23 -08:00
Pranay Prakash 4ab4412ae6 Add Run.wakeUp() method to interrupt pending sleeps (#1232)
* feat: add testing section and navigation link

Create new 'testing/' section and update Foundations index page.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* docs: fix testing page API references and examples

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* fix: update testing.mdx and meta.json for docs-writer guidelines

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: clarify unit testing focus on steps, remove workflow example

Update documentation to emphasize unit testing for steps only.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: reorganize testing page and fix unit test section

Move testing to top-level, fix content and update meta files.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: add Nitro server setup and observability section to tests

Add 'globalSetup' script and vitest config, and update docs for test debugging.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* [ci] Disable claude code CI (#1231)

* feat: add `Run.wakeUp()` method to programmatically interrupt pending sleeps

Exposes the existing `wakeUpRun` logic as an instance method on the `Run`
class, allowing users to skip sleep() calls in tests or custom UIs.

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

* fix: address PR review comments

- Fix JSDoc @returns to describe StopSleepResult object instead of number
- Clean up global world state in afterEach to prevent test leakage
- Add delay before wakeUp() in docs example to allow workflow replay

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

* chore: restore claude.yml to match base branch

The file was removed on main but still exists on the base branch.
Restoring it so this PR's diff only contains relevant changes.

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

* fix: add imports to standalone code snippet in get-run docs

The docs test type-checks each code block independently, so the
standalone wakeUp snippet needs its own imports and run variable.

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

* fix: use @setup preamble for standalone wakeUp snippet

Use the // @setup comment pattern to provide type context without
rendering the setup line, keeping the snippet lean.

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

* docs: document // @setup preamble pattern in docs-writer agent

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

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-02 16:43:01 -08:00
Nathan Rajlich 809339ba1c fix(builders): enable directive discovery in dot-prefixed files and directories (#1228)
* fix(builders): enable directive discovery in dot-prefixed files and directories

The glob-based file scanning in getInputFiles() was using tinyglobby's
default behavior which skips dot-prefixed files/directories. This prevented
discovering files with 'use step' / 'use workflow' directives inside paths
like .config/step.ts or .hidden-workflow.ts.

Switch to relative glob patterns with per-directory cwd and dot: true to
ensure dot-files are scanned while still respecting the explicit ignore
list (.git, .next, .vercel, etc.).

* test: add E2E tests for dot-directory directive discovery

Add workbench fixtures and E2E tests verifying that 'use step' / 'use
workflow' directives inside dot-prefixed directories (.well-known/agent/)
are correctly discovered, included in manifests, and executed at runtime.

* fix: normalize paths in getInputFiles tests for Windows compatibility

tinyglobby returns forward-slash paths even on Windows, while Node's
path.join() uses backslashes. Normalize both sides to forward slashes
before comparison.

* refactor: use dirname() instead of join(.., '..') in test helper

Cleaner and more idiomatic way to get the parent directory.

* fix: add .nuxt and other build tool dot-directories to ignore list

With dot: true enabled, framework build output directories like .nuxt/
are now traversed and their generated files picked up as input files.
This caused a circular dependency in the nuxt builder where generated
.nuxt/workflow/steps.mjs was being re-discovered as an input file.

Add .nuxt, .turbo, .cache, .yarn, and .pnpm-store to the ignore list,
matching the directories already ignored by the eager builder's watcher.
2026-03-02 14:36:12 -08:00
John Lindquist 42361d651b Add Fluid compute warning callout across deployment docs (#1216)
Signed-off-by: John Lindquist <johnlindquist@gmail.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-03-02 14:31:02 -08:00
Karthik Kalyan 8e0d2a8a9c [web-shared] Fix date parsing logic for display on the detail panel (#1235)
* Fix date parsing error in the detail panel

* Update .changeset/brown-chicken-act.md

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>

* [workflow o11y] add error boundary tests

---------

Signed-off-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-03-02 20:28:34 +00:00
Karthik Kalyan 596f9bf139 [workflow] dispatch front release PR sync workflow (#1224)
* sync front release PR on changeset

* Add github dispatcher for raising PRs on workflow releases on front
2026-03-02 11:57:11 -08:00
Pranay Prakash 329ad19806 Add Testing documentation as top-level page (#1229)
* feat: add testing section and navigation link

Create new 'testing/' section and update Foundations index page.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* docs: fix testing page API references and examples

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* fix: update testing.mdx and meta.json for docs-writer guidelines

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: clarify unit testing focus on steps, remove workflow example

Update documentation to emphasize unit testing for steps only.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: reorganize testing page and fix unit test section

Move testing to top-level, fix content and update meta files.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: add Nitro server setup and observability section to tests

Add 'globalSetup' script and vitest config, and update docs for test debugging.

Slack-Thread: https://vercel.slack.com/archives/C09125LC4AX/p1772375177894629?thread_ts=1772375177.894629&cid=C09125LC4AX
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
2026-03-02 10:17:25 -08:00
Peter Wielander d69c80b79d [ci] Disable claude code CI (#1231) 2026-03-01 12:53:39 -08:00
JJ Kasper 0ecb9872c1 Disable lazy discovery for turbopack workbench (#1223) 2026-02-27 15:40:50 -08:00
Vercel Release Bot a602fcbf6b Version Packages (beta) (#1215) workflow@4.1.0-beta.62 2026-02-27 14:20:42 -08:00
Peter Wielander 1cfb8b12e7 [world-vercel] Use undici for request HTTP 2 and automatic re-tries (#1211) 2026-02-27 21:53:18 +00:00
Nathan Rajlich 6f2cbcda9d fix: prioritize custom class serialization over generic Error serialization (#1172)
Move the Instance and Class reducers before the Error reducer in
getCommonReducers() so that Error subclasses implementing
WORKFLOW_SERIALIZE are serialized using custom class serialization
instead of the generic Error reducer. devalue uses first-match-wins,
so the previous ordering caused custom Error subclasses to lose their
custom fields (only name/message/stack were preserved).
2026-02-27 13:11:04 -08:00
Pranay Prakash 028a828de1 feat(core): warn on uncommitted operations when workflow completes (#1185)
* feat(core): add hook.dispose() method to release hook tokens early

Add a `dispose()` method to the Hook interface that allows workflows to
explicitly release hook tokens for reuse by other workflows while the
current workflow is still running. This enables handoff patterns where
one workflow can transfer a hook token to another workflow.

- Add `dispose()` method to Hook interface in create-hook.ts
- Implement dispose functionality in workflow/hook.ts
- Add HookDisposedInvocationQueueItem to global.ts
- Handle hook_disposed events in suspension-handler.ts
- Update documentation in hooks.mdx and create-hook.mdx
- Add e2e test for hook token reuse after explicit disposal

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* feat(core): implement TypeScript Disposable spec for hooks

Add Symbol.dispose to Hook interface to support the TC39 Explicit Resource
Management proposal. This allows hooks to be used with the `using` keyword
for automatic disposal when exiting scope.

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* docs: prefer `using` keyword for hooks and webhooks

Update all documentation and e2e tests to use the `using` keyword as the
recommended approach for creating hooks and webhooks. This leverages the
TC39 Explicit Resource Management proposal for automatic disposal.

- Update e2e tests to use `using` syntax
- Update foundational hooks guide to recommend `using`
- Update create-hook API reference with `using` examples
- Update create-webhook API reference with `using` examples
- Update example workflow to use `using`

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* chore: simplify `using` examples in docs and e2e tests

Remove unnecessary block scopes and excessive comments about automatic
disposal. Block scopes are only used when early disposal is relevant
(like in the handoff test).

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* docs: add brief explanation of `using` in first examples

Add a one-liner explaining the `using` keyword in the intro examples
of the API reference docs, so new users understand the syntax.

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* fix: address PR review comments

- Restore code highlights (`[!code highlight]`) that were unintentionally
  removed from pre-existing doc examples
- Move `using` explanation from prose to inline code comment in intro
  examples
- Add `{/* @skip-typecheck */}` to incomplete manual dispose() snippet
- Add 409 (conflict/duplicate) error handling for hook_disposed events
  in suspension handler to handle workflow re-invocation

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

* fix: polyfill Symbol.dispose in workflow VM context

The workflow VM sandbox doesn't have Symbol.dispose/Symbol.asyncDispose
available, causing `using` keyword to fail with "Symbol.dispose is not
defined" at runtime. Add polyfill in the VM context creation.

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

* fix: use VM's Symbol.dispose for hook disposable support

The workflow VM sandbox has its own Symbol object with a polyfilled
Symbol.dispose. The hook object was using the host's Symbol.dispose,
which is a different symbol instance. The SWC-compiled `using` keyword
looks up the VM's Symbol.dispose on the object, causing "Object not
disposable" errors.

Fix by setting Symbol.dispose on the hook object dynamically using the
VM's globalThis.Symbol.dispose from the orchestrator context.

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

* fix: revert webhookWorkflow to create all webhooks upfront

The webhookWorkflow e2e test creates 3 webhooks that must all exist
before the test sends HTTP requests. Using `using` with sequential
creation meant only the first webhook existed at the first suspension
point. Revert to `const` since all webhooks need to be created upfront.

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

* fix: eliminate hook_disposed queue item, use flag pattern for disposal

Instead of adding a separate HookDisposedInvocationQueueItem to the
queue on dispose, keep the HookInvocationQueueItem throughout the
hook lifecycle and track state with flags (hasCreatedEvent, disposed).
A closure variable (hasDisposedEvent) makes disposeHook() a pure no-op
on replay, avoiding redundant server calls and 409 errors.

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

* fix: delete hook from invocations queue on hook_disposed terminal event

Match the pattern used by steps (step_completed/step_failed) and waits
(wait_completed) where the queue item is removed on the terminal event.

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

* test: verify dispose() is safe when called twice after replay

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

* test: add comprehensive edge case tests for hook disposal

- WorkflowSuspension counts disposed hooks separately from active hooks
- Dispose after hook_created replay produces correct suspension
- Dispose before first suspension (needs both create + dispose)
- Multiple hooks where only one is disposed
- Dispose on a conflicted hook is safe (no crash)
- Symbol.dispose calls disposeHook correctly (using keyword pattern)
- Iterator break without dispose keeps hook alive in queue
- Await after dispose on first invocation triggers suspension

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

* fix: remove unsafe cast by adding Symbol.dispose to hook object literal

Add [Symbol.dispose] directly to the hook object so it satisfies the
Hook<T> type without `as unknown as`. The VM's Symbol.dispose is still
added separately when it differs from the host's.

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

* fix: address remaining Copilot review comments

- Rename test to match new behavior (hooks stay in queue, not removed)
- Use neutral "processed" verb in WorkflowSuspension message when
  mixed item types are present
- Remove extends Disposable from Hook interface to avoid requiring
  lib.esnext.disposable in downstream consumers (explicit
  [Symbol.dispose]() method is still declared on the interface)

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

* fix: drain pending promises in disposeHook to prevent orphaned awaits

When dispose() is called while a promise is pending (e.g., iterator
suspended on yield await this, or direct await hook after dispose),
the promise would hang forever since the event consumer will never
deliver another hook_received. Now disposeHook() clears the promises
array and triggers a WorkflowSuspension so the runtime processes the
disposal cleanly.

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

* chore: remove workflow from changeset, keep only @workflow/core

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

* feat(core): warn on uncommitted operations when workflow completes

Log a warning when a workflow run completes or fails with uncommitted
operations still in the invocations queue (unawaited steps, hooks, or
sleeps). This helps users diagnose forgotten `await` calls.

Hook disposals are excluded from the warning since the backend
auto-disposes all hooks when a run reaches a terminal state.

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

* test: add tests for pending queue warning on workflow completion

Test that:
- Unawaited step triggers warning on successful completion
- Unawaited step triggers warning on workflow failure
- hook_disposed items are excluded from warning
- Clean workflow completion produces no warning

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

* fix: update warnPendingQueueItems filter for new hook flag pattern

Filter out hooks with hasCreatedEvent && !disposed (alive hooks) instead
of the removed hook_disposed queue item type.

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

* fix: address PR review comments

- Remove workflow from changeset (transitive via @workflow/core)
- Add default case to switch for exhaustiveness
- Use correlationId instead of token in warning message to avoid leaking
  user-provided tokens into logs
- Remove step events from warning tests so unawaited steps stay pending
  in the queue (step_completed would clear the item during replay)

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

* fix: address PR review comments on pending queue warnings

- Filter out disposed hooks from warning (not just created hooks)
- Show hook token instead of correlationId in warning (user-facing)
- Rename test to "should not warn when hooks are properly disposed"

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 13:00:06 -08:00
Pranay Prakash 02681dce4a feat(core): add hook.dispose() method to release hook tokens early (#1181)
* feat(core): add hook.dispose() method to release hook tokens early

Add a `dispose()` method to the Hook interface that allows workflows to
explicitly release hook tokens for reuse by other workflows while the
current workflow is still running. This enables handoff patterns where
one workflow can transfer a hook token to another workflow.

- Add `dispose()` method to Hook interface in create-hook.ts
- Implement dispose functionality in workflow/hook.ts
- Add HookDisposedInvocationQueueItem to global.ts
- Handle hook_disposed events in suspension-handler.ts
- Update documentation in hooks.mdx and create-hook.mdx
- Add e2e test for hook token reuse after explicit disposal

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* feat(core): implement TypeScript Disposable spec for hooks

Add Symbol.dispose to Hook interface to support the TC39 Explicit Resource
Management proposal. This allows hooks to be used with the `using` keyword
for automatic disposal when exiting scope.

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* docs: prefer `using` keyword for hooks and webhooks

Update all documentation and e2e tests to use the `using` keyword as the
recommended approach for creating hooks and webhooks. This leverages the
TC39 Explicit Resource Management proposal for automatic disposal.

- Update e2e tests to use `using` syntax
- Update foundational hooks guide to recommend `using`
- Update create-hook API reference with `using` examples
- Update create-webhook API reference with `using` examples
- Update example workflow to use `using`

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* chore: simplify `using` examples in docs and e2e tests

Remove unnecessary block scopes and excessive comments about automatic
disposal. Block scopes are only used when early disposal is relevant
(like in the handoff test).

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* docs: add brief explanation of `using` in first examples

Add a one-liner explaining the `using` keyword in the intro examples
of the API reference docs, so new users understand the syntax.

https://claude.ai/code/session_01AkvrXduyFTbtV2joTPHrDH

* fix: address PR review comments

- Restore code highlights (`[!code highlight]`) that were unintentionally
  removed from pre-existing doc examples
- Move `using` explanation from prose to inline code comment in intro
  examples
- Add `{/* @skip-typecheck */}` to incomplete manual dispose() snippet
- Add 409 (conflict/duplicate) error handling for hook_disposed events
  in suspension handler to handle workflow re-invocation

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

* fix: polyfill Symbol.dispose in workflow VM context

The workflow VM sandbox doesn't have Symbol.dispose/Symbol.asyncDispose
available, causing `using` keyword to fail with "Symbol.dispose is not
defined" at runtime. Add polyfill in the VM context creation.

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

* fix: use VM's Symbol.dispose for hook disposable support

The workflow VM sandbox has its own Symbol object with a polyfilled
Symbol.dispose. The hook object was using the host's Symbol.dispose,
which is a different symbol instance. The SWC-compiled `using` keyword
looks up the VM's Symbol.dispose on the object, causing "Object not
disposable" errors.

Fix by setting Symbol.dispose on the hook object dynamically using the
VM's globalThis.Symbol.dispose from the orchestrator context.

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

* fix: revert webhookWorkflow to create all webhooks upfront

The webhookWorkflow e2e test creates 3 webhooks that must all exist
before the test sends HTTP requests. Using `using` with sequential
creation meant only the first webhook existed at the first suspension
point. Revert to `const` since all webhooks need to be created upfront.

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

* fix: eliminate hook_disposed queue item, use flag pattern for disposal

Instead of adding a separate HookDisposedInvocationQueueItem to the
queue on dispose, keep the HookInvocationQueueItem throughout the
hook lifecycle and track state with flags (hasCreatedEvent, disposed).
A closure variable (hasDisposedEvent) makes disposeHook() a pure no-op
on replay, avoiding redundant server calls and 409 errors.

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

* fix: delete hook from invocations queue on hook_disposed terminal event

Match the pattern used by steps (step_completed/step_failed) and waits
(wait_completed) where the queue item is removed on the terminal event.

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

* test: verify dispose() is safe when called twice after replay

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

* test: add comprehensive edge case tests for hook disposal

- WorkflowSuspension counts disposed hooks separately from active hooks
- Dispose after hook_created replay produces correct suspension
- Dispose before first suspension (needs both create + dispose)
- Multiple hooks where only one is disposed
- Dispose on a conflicted hook is safe (no crash)
- Symbol.dispose calls disposeHook correctly (using keyword pattern)
- Iterator break without dispose keeps hook alive in queue
- Await after dispose on first invocation triggers suspension

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

* fix: remove unsafe cast by adding Symbol.dispose to hook object literal

Add [Symbol.dispose] directly to the hook object so it satisfies the
Hook<T> type without `as unknown as`. The VM's Symbol.dispose is still
added separately when it differs from the host's.

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

* fix: address remaining Copilot review comments

- Rename test to match new behavior (hooks stay in queue, not removed)
- Use neutral "processed" verb in WorkflowSuspension message when
  mixed item types are present
- Remove extends Disposable from Hook interface to avoid requiring
  lib.esnext.disposable in downstream consumers (explicit
  [Symbol.dispose]() method is still declared on the interface)

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

* fix: drain pending promises in disposeHook to prevent orphaned awaits

When dispose() is called while a promise is pending (e.g., iterator
suspended on yield await this, or direct await hook after dispose),
the promise would hang forever since the event consumer will never
deliver another hook_received. Now disposeHook() clears the promises
array and triggers a WorkflowSuspension so the runtime processes the
disposal cleanly.

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

* chore: remove workflow from changeset, keep only @workflow/core

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-27 12:59:54 -08:00
Peter Wielander 963a5e904e [docs] Split the Worlds page into sections (#1156)
* [docs] Split the Worlds page into sections

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

* Wording

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

* Update text

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

* remove benchmark numbers

Signed-off-by: Peter Wielander <mittgfu@gmail.com>

---------

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
2026-02-27 12:16:50 -08:00
Peter Wielander 274ea8b572 [world-vercel] Vary ref resolution concurrency based on header (#1220) 2026-02-27 11:23:05 -08:00
Peter Wielander eea4a02f77 [ai] Convert tool call errors to error-text results (#1212) 2026-02-27 10:50:18 -08:00
Pranay Prakash e55c63678b Update dependencies (#1217)
Bump zod 4.1→4.3, esbuild 0.25→0.27, turbo 2.5→2.8, biome 2.2→2.4,
vitest 3.2→4.0, @vercel/functions 3.1→3.4, @vercel/oidc 3.0→3.2,
@vercel/queue 0.0→0.1, @oclif/core 4.0→4.8, AWS SDK 3.609→3.972.
Fix duplicate workspace name for nitro/nitro-v3 (turbo 2.8 strictness).
Fix vitest 4 constructor mock in world-vercel queue tests.
drizzle-orm 0.44→0.45, drizzle-kit 0.31.6→0.31.9, dotenv 16→17,
postgres 3.4.7→3.4.8, hono 4.9→4.12, @hono/node-server 1.19.5→1.19.9,
enhanced-resolve 5.18→5.19, tinyglobby 0.2.14→0.2.15,
@oclif/plugin-help 6.2.31→6.2.37, semver 7.7.3→7.7.4,
watchpack 2.4→2.5, @nuxt/kit 4.2→4.3, @nuxt/schema 4.2→4.3,
exsolve 1.0.7→1.0.8, shiki 3.13→4.0, streamdown 1.6→2.3,
lucide-react 0.469→0.575, tailwind-merge 2.5→3.5,
react-virtuoso 4.12→4.18, @xyflow/react 12.9→12.10,
@react-router/* 7.13.0→7.13.1, @testcontainers/postgresql 11.7→11.12,
lint-staged 16.1→16.2, @changesets/cli 2.29.5→2.29.8

Co-authored-by: Peter Wielander <mittgfu@gmail.com>
2026-02-27 18:49:49 +00:00
Casey Gowrie f3b2e08adb Update to latest queue client version (#1218) 2026-02-27 10:03:18 -08:00
Sathya Gunasekaran 905b94ac12 [ai] Ensure abortSignal is passed through WorkflowChatTransport reconnect logic (#1199) 2026-02-26 20:18:54 -08:00
Vercel Release Bot 6930e3c763 Version Packages (beta) (#1154)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
workflow@4.1.0-beta.61
2026-02-26 17:38:07 -08:00
Casey Gowrie b06e491a47 New queue version (#1188)
* New queue package

* Update null messageId

* add comment

* changeset

* Update queue

* token

* queue proxy URL

* fix proxy URL

* update

* name

* comment
2026-02-26 16:49:45 -08:00
Pranay Prakash 40f54cf323 Add preview deployment badge with clipboard safety guard (#1202)
* feat: add PreviewBadge component and integrate into home page

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772085714762119?thread_ts=1772085714.762119&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: enhance clipboard copy error handling in preview-badge component

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772085714762119?thread_ts=1772085714.762119&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
2026-02-26 16:14:19 -08:00
Nathan Rajlich b224521cb0 [world-vercel] Move event ref resolution from server-side to client-side (#1189) 2026-02-26 13:27:24 -08:00
Peter Wielander 49d1b6d57e [world-vercel] Expose total blob and stream storage bytes on run entity (#1196) 2026-02-26 13:13:50 -08:00
Nathan Colosimo 339c343922 [next] Avoid package.json resolver failures in loader dep tracking (#1192)
Signed-off-by: nathancolosimo <nathancolosimo@gmail.com>
2026-02-26 13:01:12 -08:00
Michael Han 71d09c57f2 [ai] Strip OpenAI itemId from providerMetadata to fix Responses API tool call errors (#889) 2026-02-26 10:53:35 -08:00
Pranay Prakash 2838fb9de0 Render structured error stack traces as readable text across all error views (#1201)
* fix: render error stack as readable text in attribute-panel

Update 'error' display to show stack trace as '<pre>' text.

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772083947691689?thread_ts=1772083947.691689&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: create new changeset for PR updates

Add new changeset following format and style guidelines.

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772083947691689?thread_ts=1772083947.691689&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: enhance tab state and accessibility

Add shared 'TabbedContainer' and fix ARIA roles/keyboard nav; reset tab state on error change.

Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: render error stack traces as readable text and add copy button

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772083947691689?thread_ts=1772083947.691689&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* feat: render structured error stack traces in multiple UI components

Slack-Thread: https://vercel.slack.com/archives/C09G3EQAL84/p1772083947691689?thread_ts=1772083947.691689&cid=C09G3EQAL84
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

* fix: resolve TypeScript type and import errors

Remove unnecessary type cast and add missing toast import.

Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

---------

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
2026-02-26 07:58:14 -08:00
Nathan Rajlich c6144564ea Pass teamId to the run-key endpoint (#1183) 2026-02-25 00:49:29 +00:00
Karthik Kalyan f0823dc79b [web-shared][web] Fix trace viewer pagination issues (#1182)
* [web-shared] Fix trace viewer pagination issue

* [web-shared] Fix trace viewer pagination issue

* [web-shared] Fix trace viewer pagination issue

* [workflow o11y] bump package and fix trace viewer pagination issue

* [workflow o11y] bump package and fix trace viewer pagination issue
2026-02-24 16:04:20 -08:00
Ali Waleed a0b99c8ec8 [web] Decompose workflow-api-client.ts into focused modules and add unit tests (#1070) 2026-02-24 15:34:53 -08:00
Nathan Rajlich 70223a9091 Don't enforce client-side generated runId in start() for v1Compat (#1178) 2026-02-24 08:11:41 +00:00
Pranay Prakash 45800b474b Fix OG image routing under i18n (#1176)
* Fix og route handling in i18n middleware

* Add docs CI smoke test for OG and sitemap

* Run docs OG checks against Vercel preview

* Refactor docs CI checks and rename smoke test

* Use docs Vercel token for preview checks

* Expand docs OG smoke coverage

* Check docs HTML OG metadata
2026-02-23 23:40:46 -08:00
Nathan Rajlich e1a2f475aa [world-vercel] Handle null key response from run-key API endpoint (#1174)
* [@workflow/world-vercel] Handle null key response from run-key API endpoint

The API endpoint now returns { key: null } instead of a 404 when a
deployment has no encryption key. Update fetchRunKey to accept the
nullable response and return undefined, signaling that encryption
is disabled for that workflow run.

* [@workflow/world-vercel] Add changeset for null run-key handling

* Address review feedback: improve error message and fix test mock cleanup

- Include Zod error details in the validation error message for better debugging
- Move fetch mock restoration to afterEach to prevent mock leakage on test failure
2026-02-23 22:51:20 -08:00
Nathan Rajlich 81a883bc9b ci: don't cancel in-progress CI runs on main branch (#1166)
* fix: use types.isNativeError() for cross-VM Error serialization

FatalError was not properly serialized when passed from workflow code into a step function because the Error reducer checked `value instanceof global.Error` where `global` is the VM's globalThis. Errors created in the host context (like FatalError from @workflow/errors) have a different Error prototype than the VM context, so the instanceof check returned false and the error was silently dropped.

Replaced with `types.isNativeError()` from `node:util` which uses V8's internal type tag and works across VM context boundaries.

* ci: don't cancel in-progress CI runs on main branch
2026-02-24 06:50:59 +00:00
Robert Vollmer 79a730aa68 [world-postgres] Hide also "info" logs from Graphile Worker by default (#1171)
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
2026-02-23 17:17:44 -08:00
Nathan Rajlich a78af46f0e Configure Release job for OIDC trusted publishing (#1138) 2026-02-23 16:47:34 -08:00
Peter Wielander 2b7e7daca0 [ci] Add code owners file (#1173) 2026-02-23 16:14:26 -08:00
Robert Vollmer c8c98fe463 [ai] Pass optional request metadata through WorkflowChatTransport (#1023)
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
2026-02-23 15:23:10 -08:00
Robert Vollmer 0735b2a55b [world-postgres] Fix race conditions in Postgres streamer (#1002)
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
2026-02-23 15:17:43 -08:00
Peter Wielander dda67421cf [world-postgres] [cli] Skip graphile logs for CLI json mode, observe DEBUG env (#1167) 2026-02-23 22:25:02 +00:00
Nathan Rajlich d99ca9cfed fix: use types.isNativeError() for cross-VM Error serialization (#1164)
FatalError was not properly serialized when passed from workflow code into a step function because the Error reducer checked `value instanceof global.Error` where `global` is the VM's globalThis. Errors created in the host context (like FatalError from @workflow/errors) have a different Error prototype than the VM context, so the instanceof check returned false and the error was silently dropped.

Replaced with `types.isNativeError()` from `node:util` which uses V8's internal type tag and works across VM context boundaries.
2026-02-23 20:07:58 +00:00
Karthik Kalyan bf3e75f7c3 [web-shared] Traceviewer Sidepanel improvements/bugfixes (#1162)
* Bring back sitemap

* Bring back sitemap

* Add pre commit hooks for sitemap

* Add pre commit hooks for sitemap

* Fix failing queue test

* Revert queue test failure

* Add unit tests

* Fix sleep state in side panel

* Side panel improvements

* Side panel improvements

* Side panel improvements

* Side panel improvements

* Side panel improvements
2026-02-23 11:29:54 -08:00
Ben Smith f5ea16fbf5 Fix: Update devalue to resolve alerts (#1135)
* Update devalue
Fix security warnings from devalue 5.6.0 by updating to 5.6.3.

* Create cyan-apes-fry.md

Signed-off-by: Nathan Rajlich <n@n8.io>

---------

Signed-off-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Nathan Rajlich <n@n8.io>
2026-02-23 09:32:40 -08:00
Peter Wielander c9186f9870 [world-postgres] Add migrations from pg-boss to graphile-worker queue (#1126) 2026-02-20 18:25:08 -08:00