vercel[bot] fde116558e [core] Complete a due wait even when its run is already terminal
A pending wait parks a delayed continuation message on the workflow queue;
when it fires, the delivery's job is to record the wait's `wait_completed`.
If the run finished first — a `Promise.race([sleep('1h'), hook])` whose hook
won, a cancellation, a failure — every path that discovers the terminal state
returned and acked without writing it, so the wait stayed open in the log
forever: replay, `inspect`, and the dashboard timeline all read a run that
terminated while still sleeping.

The completion is now unconditional on run status. On a terminal run it is all
the delivery does — no replay, no suspension dispatch — and the message is
acked only after the write settles, so a transient World failure redelivers
instead of dropping the completion. Not-yet-due waits are left to their own
continuations.

The Worlds refused the write too: a terminal transition reaps the run's waits
(`run.resources-released`), and `wait_completed` against a reaped wait was
`Wait "…" not found`. world-local, world-postgres, and world-sim now accept it
and record the event without resurrecting the entity, deduplicating against
the surviving `.completed` claim (local) or the event log (postgres, sim).
Older backends that still refuse are logged and acked rather than nacked —
redelivery cannot change that verdict.

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

Co-Authored-By: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
2026-08-22 17:03:45 +00:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2026-02-05 16:19:16 -08:00
2025-10-23 12:07:52 +03:00
2026-08-14 16:56:05 -04:00
2025-10-23 12:07:52 +03:00

Workflow SDK logo

Workflow SDK

Vercel logo NPM version License Join the community on GitHub

Workflow SDK makes TypeScript and JavaScript functions durable. It persists workflow progress, retries failed steps, and provides built-in observability. Workflows can suspend without using compute while they wait.

Quick start

Install the SDK in an existing project:

npm install workflow

Configure the integration for your framework. For example, with Next.js:

// next.config.ts
import { withWorkflow } from 'workflow/next';

export default withWorkflow({});

Then start a workflow from an API route, Server Action, or other server-side code:

import { start } from 'workflow/api';
import { onboardUser } from './workflows/onboard-user';

await start(onboardUser, ['hello@example.com']);

Run your app, then open the local observability UI in another terminal:

npm run dev
npx workflow web

Choose your framework in the getting-started guides.

Note

The workflow package includes its full documentation, so coding agents can read version-matched guides locally from node_modules/workflow/docs.

Run anywhere

Local development uses the bundled backend with no configuration. Deploy to Vercel for managed storage, queuing, scaling, and observability. To self-host, use the Postgres backend or implement a custom World.

There are many third-party Worlds (both self-hosted or managed), see the Worlds page for a list of maintainer-curated third party worlds. Submit your world by opening updating the Worlds Manifest.

Community

The Workflow SDK community lives on GitHub Discussions, where you can ask questions, share ideas, and show what you have built.

Contributing

Contributions are welcome. Use issues and discussions to collaborate with the team and wider community. By participating, you agree to our Code of Conduct.

Security

If you believe you have found a security vulnerability in Workflow SDK, we encourage you to responsibly disclose this and not open a public issue.

To participate in our Open Source Software Bug Bounty program, please email responsible.disclosure@vercel.com. We will add you to the program and provide further instructions for submitting your report.

S
Description
workflow: Creates durable, resumable workflows using Vercel's Workflow SDK. Use when building workflows that need to survive restarts, pause for external events, retry…; workflow-init: Install and configure Vercel Workflow SDK before it exists in node_modules. Use when the user asks to "install workflow", "set up workflow", "add durable…
Readme 140 MiB
Languages
TypeScript 88.8%
JavaScript 5.9%
Rust 4%
CSS 0.5%
Python 0.4%
Other 0.3%