Skip to content

fix(core): reuse runtime World for route handlers - #3666

Draft
MintedKenny wants to merge 2 commits into
vercel:mainfrom
MintedKenny:agent/reuse-runtime-world-for-route-handlers
Draft

fix(core): reuse runtime World for route handlers#3666
MintedKenny wants to merge 2 commits into
vercel:mainfrom
MintedKenny:agent/reuse-runtime-world-for-route-handlers

Conversation

@MintedKenny

@MintedKenny MintedKenny commented Aug 19, 2026

Copy link
Copy Markdown

Description

Fixes #3665.

workflowEntrypoint() now initializes its request-time queue handler from getWorld() instead of getWorldHandlers(). This makes route initialization and subsequent runtime operations share one process-level World instance.

The public getWorldHandlers() API, its signature, and its intentionally separate build-time-safe cache are unchanged.

Previously, route initialization populated the handler-only cache and the first runtime operation independently populated the runtime cache. Stateful async World factories could therefore create duplicate database pools, listeners, queue workers, or similar process-scoped resources.

How did you test your changes?

  • Added a regression test with an async World factory that initializes a workflow route and then calls getWorld().
  • Confirmed the regression test fails on the prior implementation because the factory is called twice.
  • Confirmed the focused regression test passes after the change.
  • Ran the complete @workflow/core suite on Node 24: 101 test files passed, 1 skipped; 2,180 tests passed, 3 expected failures, 1 skipped.
  • Ran @workflow/core typechecking successfully.
  • Ran the documentation link validator successfully.
  • Ran Biome formatting and lint checks; lint completed with the repository's existing advisory warnings and no errors attributable to this change.

The full documentation code-sample harness requires built workspace package declarations. The partial local build cannot produce every package because the SWC package requires a Rust toolchain that is not installed; CI remains the authoritative full-workspace result.

Docs Preview

Vercel did not produce an accessible workflow-docs preview for this fork PR: its deployment checks require Vercel Labs authorization. The changed v5 routes are:

  • /v5/docs/api-reference/workflow-runtime/workflow-entrypoint
  • /v5/docs/api-reference/workflow-runtime/get-world-handlers

PR Checklist - Required to merge

  • 📦 pnpm changeset was run to create a patch changelog for this PR
  • 🔒 DCO sign-off passes (git commit --signoff)
  • 📝 Ping @vercel/workflow once the PR is ready for review

Signed-off-by: Kenneth <kenneth@standardforensics.com>
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 77b28b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
workflow Patch
@workflow/core Patch
@workflow/world-testing Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/web Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@MintedKenny is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: Kenneth <kenneth@standardforensics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workflowEntrypoint initializes a separate World before getWorld

1 participant