Skip to content

Revert "Statically inject workflow world target" (#2752) - #3142

Open
VaguelySerious wants to merge 1 commit into
mainfrom
peter/revert-static-world-target
Open

Revert "Statically inject workflow world target" (#2752)#3142
VaguelySerious wants to merge 1 commit into
mainfrom
peter/revert-static-world-target

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Reverts #2752 ("Statically inject workflow world target"). The world package is once again resolved at runtime from WORKFLOW_TARGET_WORLD instead of being aliased into host bundles at build time.

Why this is a surgical revert

141 commits have landed on top of #2752, several of which build on it, so git revert alone leaves the tree unbuildable. This branch removes the static-injection mechanism and restores the pre-#2752 runtime resolution while keeping everything that landed after it.

Removed

  • world-target modules in @workflow/core, @workflow/builders, and the Statically inject workflow world target #2752 additions to @workflow/utils
  • the bundler aliases / defines wired through next, nitro, nuxt, astro, sveltekit, rollup, and both nest builders
  • the @workflow/core/runtime/world-target export, its tsconfig/vitest path aliases
  • the pg-native stub alias and the extracted node-compat banner constants, which only existed because the world package was forced into the SSR bundle (the sveltekit typescript stub alias from fix(sveltekit): production server crash from bundled TypeScript compiler #2799 goes with them for the same reason)

Kept

Note on the o2flow incident that motivated #2752

The o2flow failure (Cannot find module as expression is too dynamic on sandboxDoneHook.resume()) was caused by the world registration being tree-shaken out of an isolated route bundle, which made getWorldLazy() fall through to an obfuscated import() that Turbopack stubs. That path is fixed by the world-init side-effect import on every host entrypoint plus the loud "world runtime was not initialized" error — both of which this revert keeps, along with #3001's regression test. o2flow runs on the Vercel world, which core imports statically, so it never reaches the dynamic resolution path this revert restores.

A follow-up PR stacked on this one proposes hardening the remaining dynamic path (custom world packages under Turbopack/webpack) without reintroducing build-time injection.

Verification

  • pnpm build, pnpm typecheck green
  • unit tests for the affected packages green

This reverts the static world-target injection and restores runtime
resolution of the world package from `WORKFLOW_TARGET_WORLD`.

Because 141 commits have landed on top of #2752, this is a surgical
revert rather than a mechanical one. Removed: the `world-target` modules
in core/builders/utils, the bundler aliases and `define`s wired through
next/nitro/nuxt/astro/sveltekit/rollup/nest, the
`@workflow/core/runtime/world-target` export, and the
pg-native/node-compat-banner helpers that only existed to support the
statically bundled world.

Kept (later work that builds on #2752):
- `createWorldFromModule` / `WorldFactoryModule` in core (used by
  world-testing and the nitro dev handler)
- `world-init` / `world-init-stub` / `getWorldLazy` and their
  registration of `getWorld` on globalThis, plus the #3001 isolated
  route bundle regression test
- #2804 (web), #2806 (cli dynamic community backends), #3112 (world
  factory alias removal), #2988 (nest vercel builder), #2925/#2908
  (nitro), #2799 (sveltekit typescript stub is dropped with the
  injection it existed for), next basePath support, and the windows /
  canary test timeout tuning

Co-Authored-By: Claude Opus 5 <[email protected]>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code owners July 27, 2026 22:19
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jul 27, 2026 10:24pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jul 27, 2026 10:24pm
example-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-astro-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-express-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-fastify-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-hono-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-nestjs-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-nitro-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workbench-vite-workflow Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Jul 27, 2026 10:24pm
workflow-swc-playground Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workflow-tarballs Ready Ready Preview, Comment Jul 27, 2026 10:24pm
workflow-web Ready Ready Preview, Comment Jul 27, 2026 10:24pm

@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 003f800

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

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

Click here to learn what changesets are, and how to add one.

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

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
Passed Failed Skipped Total
✅ ▲ Vercel Production 1455 0 239 1694
✅ 💻 Local Development 1621 0 227 1848
✅ 📦 Local Production 1621 0 227 1848
✅ 🐘 Local Postgres 1621 0 227 1848
✅ 🪟 Windows 154 0 0 154
✅ 📋 Other 1020 0 212 1232
✅ vercel-multi-region 27 0 0 27
Total 7519 0 1132 8651
Details by Category

✅ ▲ Vercel Production

App Passed Failed Skipped
✅ astro 126 0 28
✅ example 126 0 28
✅ express 126 0 28
✅ fastify 126 0 28
✅ hono 126 0 28
✅ nextjs-turbopack 151 0 3
✅ nextjs-webpack 151 0 3
✅ nitro 126 0 28
✅ nuxt 126 0 28
✅ sveltekit 145 0 9
✅ vite 126 0 28

✅ 💻 Local Development

App Passed Failed Skipped
✅ astro-stable 128 0 26
✅ express-stable 128 0 26
✅ fastify-stable 128 0 26
✅ hono-stable 128 0 26
✅ nextjs-turbopack-canary 135 0 19
✅ nextjs-turbopack-stable 154 0 0
✅ nextjs-webpack-canary 135 0 19
✅ nextjs-webpack-stable 154 0 0
✅ nitro-stable 128 0 26
✅ nuxt-stable 128 0 26
✅ sveltekit-stable 147 0 7
✅ vite-stable 128 0 26

✅ 📦 Local Production

App Passed Failed Skipped
✅ astro-stable 128 0 26
✅ express-stable 128 0 26
✅ fastify-stable 128 0 26
✅ hono-stable 128 0 26
✅ nextjs-turbopack-canary 135 0 19
✅ nextjs-turbopack-stable 154 0 0
✅ nextjs-webpack-canary 135 0 19
✅ nextjs-webpack-stable 154 0 0
✅ nitro-stable 128 0 26
✅ nuxt-stable 128 0 26
✅ sveltekit-stable 147 0 7
✅ vite-stable 128 0 26

✅ 🐘 Local Postgres

App Passed Failed Skipped
✅ astro-stable 128 0 26
✅ express-stable 128 0 26
✅ fastify-stable 128 0 26
✅ hono-stable 128 0 26
✅ nextjs-turbopack-canary 135 0 19
✅ nextjs-turbopack-stable 154 0 0
✅ nextjs-webpack-canary 135 0 19
✅ nextjs-webpack-stable 154 0 0
✅ nitro-stable 128 0 26
✅ nuxt-stable 128 0 26
✅ sveltekit-stable 147 0 7
✅ vite-stable 128 0 26

✅ 🪟 Windows

App Passed Failed Skipped
✅ nextjs-turbopack 154 0 0

✅ 📋 Other

App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 128 0 26
✅ e2e-local-dev-tanstack-start- 128 0 26
✅ e2e-local-postgres-nest-stable 128 0 26
✅ e2e-local-postgres-tanstack-start- 128 0 26
✅ e2e-local-prod-nest-stable 128 0 26
✅ e2e-local-prod-tanstack-start- 128 0 26
✅ e2e-vercel-prod-nest 126 0 28
✅ e2e-vercel-prod-tanstack-start 126 0 28

✅ vercel-multi-region

App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0

📋 View full workflow run

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 003f800 · Mon, 27 Jul 2026 22:42:23 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 238 (-68%) 💚 1374 🔴 (+21%) 🔻 1408 🔴 (+16%) 🔻 1708 🔴 (+25%) 🔻 30
TTFS stream 242 (-23%) 💚 1347 🔴 (+23%) 🔻 1384 🔴 (+21%) 🔻 1396 🔴 (+19%) 🔻 30
TTFS hook + stream 400 (-68%) 💚 1555 🔴 (+11%) 1601 🔴 (+9.6%) 1624 🔴 (-0.7%) 30
STSO 1020 steps (1-20) 167 (-1.8%) 273 🔴 (-9.6%) 283 🔴 (-20%) 💚 347 🔴 (-8.4%) 19
STSO 1020 steps (101-120) 206 (+4.6%) 302 🔴 (-11%) 477 🔴 (+17%) 🔻 2242 🔴 (+348%) 🔻 19
STSO 1020 steps (1001-1020) 472 (-2.3%) 551 🔴 (-4.0%) 591 🔴 (-8.5%) 1103 🔴 (+68%) 🔻 19
WO 1020 steps 411119 (-6.4%) 411119 (-6.4%) 411119 (-6.4%) 411119 (-6.4%) 1
SL stream latency 101 (+8.6%) 148 🔴 (-12%) 179 🔴 (-24%) 💚 250 🔴 (-1.2%) 30
SO stream overhead (text) 115 (-12%) 185 (-36%) 💚 209 (-41%) 💚 401 (-4.8%) 30
SO stream overhead (structured) 124 (-8.1%) 209 (-20%) 💚 256 (-7.9%) 430 (+4.1%) 30
ℹ️ Metric definitions & methodology

Best/P75/P90/P99 deltas compare against the most recent benchmark run on main at the time of this run. 🔻 flags a delta worse than +15%, 💚 one better than −15%.

Metrics — TTFS: time to first step body (in-deployment start() → first step body, deployment clocks) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · SL: stream latency (in-deployment write → read propagation, readAt - writtenAt) · SO: stream overhead (end-to-end write+consume time beyond the modelled generation window)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · stream latency: parallel reader/writer steps on a dedicated stream; SL is the in-deployment write->read propagation (readAt - writtenAt) · stream overhead (text): writer streams 300 variable-length text token deltas paced at 100/s for 3s (a haiku-size LLM's token throughput) while a parallel reader drains the whole stream; SO is the end-to-end write+consume time beyond the 3s generation window (overhead/backpressure) · stream overhead (structured): same workload as stream overhead (text), but each delta is an AI-SDK-style structured object ({ type: 'text-delta', id, text }) instead of a raw string, so the SO gap vs the text scenario is the added serialization cost

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

All metrics are measured from deployment-side timestamps only. Runs are triggered by an in-deployment route that stamps the anchor (clientStart) right before start(), so the CI runner’s request and its path through api.vercel.com sit outside every measured window. TTFS = in-deployment start() → first step body (turbo uses the in-process fast path, non-turbo the dispatch path), and includes the VQS dispatch hop plus any /flow cold start. STSO/WO are measured between step bodies on the deployment. SL is measured inside the workflow (parallel reader/writer steps), so it no longer includes the api.vercel.com read path.

Cold starts are kept in the numbers on purpose — they are part of real bursty-workload latency. The workbench deployment cold-starts the /flow invocation for a large fraction of runs, inflating P75+; the Best column shows the fastest (warm-start) sample for comparison.

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.

1 participant