Peter Wielander a0bb3121fc [core] Poll for the deferred check instead of sleeping past it
`Unit Tests (windows-latest)` has a second failure family alongside the
world-local preload timeout: `events-consumer.test.ts`, rotating between
lines 1005 and 1123 across main runs.

Eleven call sites slept `MIN_DEFERRED_CHECK_DELAY_MS * 4` and then asserted
an outcome the deferred check produces. That check is not on a fixed
schedule. It waits for delivery to go idle, which is its own poll loop, and
only then arms a `getDeferredCheckDelayMs()` timer, so the sleep is a lower
bound on when the timer becomes eligible rather than a guarantee it has run.
The helper's own comment already said assertions that a check DID fire should
poll instead; every one of the eleven ignored it.

Replace the sleep with `afterDeferredCheck`, which polls the assertion block.
The positive assertions gate the poll and the negatives alongside them are
evaluated once the check is known to have fired, which is what they mean.

Reproduced without a Windows runner by raising the stubbed delay 20x, which
makes the fixed sleep too short by construction: the old file fails exactly
at 1005 and 1123, the two lines CI reports, and the new file passes 45/45 at
the same delay.

Also drop the changeset to an empty one. Neither change affects users.
2026-08-12 13:14:48 -07: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
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%