Skip to content

[DO NOT MERGE] CI dry-run: QuickJS as the default workflow VM engine - #3253

Closed
TooTallNate wants to merge 36 commits into
quickjs-vm-threshold-snapshotsfrom
quickjs-vm-default
Closed

TooTallNate wants to merge 36 commits into
quickjs-vm-threshold-snapshotsfrom
quickjs-vm-default

Conversation

@TooTallNate

@TooTallNate TooTallNate commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Warning

Not intended to merge. This PR exists to exercise the full CI matrix — and the event-log-race-repro stress workflow (via its label) — with QuickJS as the default engine, as a dress rehearsal for an eventual real default flip. It stays a draft; when the underlying stack (#3048 → #3049 → #3250 → #3251, plus #3263) is merged, a fresh flip PR will be cut against main with the learnings from this one.

What it changes (for the dry run)

  • useQuickJSVm defaults to the QuickJS engine when neither the run's stamped executionContext.workflowVm nor WORKFLOW_VM specifies one; WORKFLOW_VM=node is the explicit node:vm opt-in.
  • CI matrix inverted to match: quickjs legs leave WORKFLOW_VM unset (exercising the default-selection path end to end); node legs opt in explicitly. Labels/artifacts unchanged via MATRIX_VM.
  • Entrypoint test suites that assert node replay-loop internals pin WORKFLOW_VM=node (see the comment at each pin).
  • Docs updated for the flipped default.

Findings so far (feeding the real flip PR)

  • The event-ceiling gap this PR's CI exposed (event-limit red) was real and is fixed on QuickJS engine: inline step execution + WASM module caching #3049 (in-loop re-check + run_failed/MAX_EVENTS_EXCEEDED conversion).
  • The global-surface gap is substantially closed on Add opt-in QuickJS WASM VM engine (WORKFLOW_VM=quickjs) #3048 (deterministic crypto, frozen process.env, loud Intl/locale guards); remaining differences are enumerated in the docs.
  • Outstanding requirement for the real flip: unconditional engine stamping at start() — under a flipped default, unset WORKFLOW_VM currently produces unstamped runs that would switch engines mid-run on rollback (review finding on this PR). The real flip PR must stamp the resolved engine.

@TooTallNate
TooTallNate requested review from a team and ijjk as code owners July 31, 2026 08:52
Copilot AI review requested due to automatic review settings July 31, 2026 08:52
@changeset-bot

changeset-bot Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a78801

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

This PR includes changesets to release 16 packages
Name Type
@workflow/core Minor
@workflow/builders Minor
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/web Patch
workflow Minor
@workflow/world-testing 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jul 31, 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 Aug 11, 2026 8:25am
example-nextjs-workflow-webpack Ready Ready Preview Aug 11, 2026 8:25am
example-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-astro-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-express-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-fastify-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-hono-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-nestjs-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-nitro-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-nuxt-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-python-workflow Error Error Aug 11, 2026 8:25am
workbench-sveltekit-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-tanstack-start-workflow Ready Ready Preview Aug 11, 2026 8:25am
workbench-vite-workflow Ready Ready Preview Aug 11, 2026 8:25am
workflow-docs Ready Ready Preview, v0 Aug 11, 2026 8:25am
workflow-swc-playground Ready Ready Preview Aug 11, 2026 8:25am
workflow-tarballs Ready Ready Preview Aug 11, 2026 8:25am
workflow-web Ready Ready Preview Aug 11, 2026 8:25am

@TooTallNate TooTallNate added the event-log-race-repro Run the event log race reproduction job label Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

❌ Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

express-quickjs (1 failed):

📦 Local Production (1 failed)

astro-stable-node (1 failed):

  • webhookWorkflow | wrun_41KZQYSH9X0GZQBXQC793JBE48

E2E Test Summary

Summary
Passed Failed Skipped Total
❌ ▲ Vercel Production 3465 1 590 4056
✅ 💻 Local Development 3829 0 539 4368
❌ 📦 Local Production 3965 1 558 4524
✅ 🐘 Local Postgres 3966 0 558 4524
✅ 🪟 Windows 312 0 0 312
✅ vercel-multi-region 27 0 0 27
Total 15564 2 2245 17811
Details by Category

❌ ▲ Vercel Production

App Passed Failed Skipped
✅ astro-node 128 0 28
✅ astro-quickjs 128 0 28
✅ example-node 128 0 28
✅ example-quickjs 128 0 28
✅ express-node 128 0 28
❌ express-quickjs 127 1 28
✅ fastify-node 128 0 28
✅ fastify-quickjs 128 0 28
✅ hono-node 128 0 28
✅ hono-quickjs 128 0 28
✅ nest-node 128 0 28
✅ nest-quickjs 128 0 28
✅ nextjs-turbopack-node 153 0 3
✅ nextjs-turbopack-quickjs 153 0 3
✅ nextjs-webpack-node 153 0 3
✅ nextjs-webpack-quickjs 153 0 3
✅ nitro-node 128 0 28
✅ nitro-quickjs 128 0 28
✅ nuxt-node 128 0 28
✅ nuxt-quickjs 128 0 28
✅ sveltekit-node 147 0 9
✅ sveltekit-quickjs 147 0 9
✅ tanstack-start-node 128 0 28
✅ tanstack-start-quickjs 128 0 28
✅ vite-node 128 0 28
✅ vite-quickjs 128 0 28

✅ 💻 Local Development

App Passed Failed Skipped
✅ astro-stable-node 130 0 26
✅ astro-stable-quickjs 130 0 26
✅ express-stable-node 130 0 26
✅ express-stable-quickjs 130 0 26
✅ fastify-stable-node 130 0 26
✅ fastify-stable-quickjs 130 0 26
✅ hono-stable-node 130 0 26
✅ hono-stable-quickjs 130 0 26
✅ nest-stable-node 130 0 26
✅ nest-stable-quickjs 130 0 26
✅ nextjs-turbopack-canary-node 137 0 19
✅ nextjs-turbopack-canary-quickjs 137 0 19
✅ nextjs-turbopack-quickjs-snapshot 156 0 0
✅ nextjs-turbopack-stable-node 156 0 0
✅ nextjs-turbopack-stable-quickjs 156 0 0
✅ nextjs-webpack-canary-node 137 0 19
✅ nextjs-webpack-stable-node 156 0 0
✅ nextjs-webpack-stable-quickjs 156 0 0
✅ nitro-stable-node 130 0 26
✅ nitro-stable-quickjs 130 0 26
✅ nuxt-stable-node 130 0 26
✅ nuxt-stable-quickjs 130 0 26
✅ sveltekit-stable-node 149 0 7
✅ sveltekit-stable-quickjs 149 0 7
✅ tanstack-start-node 130 0 26
✅ tanstack-start-quickjs 130 0 26
✅ vite-stable-node 130 0 26
✅ vite-stable-quickjs 130 0 26

❌ 📦 Local Production

App Passed Failed Skipped
❌ astro-stable-node 129 1 26
✅ astro-stable-quickjs 130 0 26
✅ express-stable-node 130 0 26
✅ express-stable-quickjs 130 0 26
✅ fastify-stable-node 130 0 26
✅ fastify-stable-quickjs 130 0 26
✅ hono-stable-node 130 0 26
✅ hono-stable-quickjs 130 0 26
✅ nest-stable-node 130 0 26
✅ nest-stable-quickjs 130 0 26
✅ nextjs-turbopack-canary-node 137 0 19
✅ nextjs-turbopack-canary-quickjs 137 0 19
✅ nextjs-turbopack-quickjs-snapshot 156 0 0
✅ nextjs-turbopack-stable-node 156 0 0
✅ nextjs-turbopack-stable-quickjs 156 0 0
✅ nextjs-webpack-canary-node 137 0 19
✅ nextjs-webpack-canary-quickjs 137 0 19
✅ nextjs-webpack-stable-node 156 0 0
✅ nextjs-webpack-stable-quickjs 156 0 0
✅ nitro-stable-node 130 0 26
✅ nitro-stable-quickjs 130 0 26
✅ nuxt-stable-node 130 0 26
✅ nuxt-stable-quickjs 130 0 26
✅ sveltekit-stable-node 149 0 7
✅ sveltekit-stable-quickjs 149 0 7
✅ tanstack-start-node 130 0 26
✅ tanstack-start-quickjs 130 0 26
✅ vite-stable-node 130 0 26
✅ vite-stable-quickjs 130 0 26

✅ 🐘 Local Postgres

App Passed Failed Skipped
✅ astro-stable-node 130 0 26
✅ astro-stable-quickjs 130 0 26
✅ express-stable-node 130 0 26
✅ express-stable-quickjs 130 0 26
✅ fastify-stable-node 130 0 26
✅ fastify-stable-quickjs 130 0 26
✅ hono-stable-node 130 0 26
✅ hono-stable-quickjs 130 0 26
✅ nest-stable-node 130 0 26
✅ nest-stable-quickjs 130 0 26
✅ nextjs-turbopack-canary-node 137 0 19
✅ nextjs-turbopack-canary-quickjs 137 0 19
✅ nextjs-turbopack-quickjs-snapshot 156 0 0
✅ nextjs-turbopack-stable-node 156 0 0
✅ nextjs-turbopack-stable-quickjs 156 0 0
✅ nextjs-webpack-canary-node 137 0 19
✅ nextjs-webpack-canary-quickjs 137 0 19
✅ nextjs-webpack-stable-node 156 0 0
✅ nextjs-webpack-stable-quickjs 156 0 0
✅ nitro-stable-node 130 0 26
✅ nitro-stable-quickjs 130 0 26
✅ nuxt-stable-node 130 0 26
✅ nuxt-stable-quickjs 130 0 26
✅ sveltekit-stable-node 149 0 7
✅ sveltekit-stable-quickjs 149 0 7
✅ tanstack-start-node 130 0 26
✅ tanstack-start-quickjs 130 0 26
✅ vite-stable-node 130 0 26
✅ vite-stable-quickjs 130 0 26

✅ 🪟 Windows

App Passed Failed Skipped
✅ nextjs-turbopack-node 156 0 0
✅ nextjs-turbopack-quickjs 156 0 0

✅ vercel-multi-region

App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0

📋 View full workflow run

@TooTallNate
TooTallNate marked this pull request as draft July 31, 2026 08:53

@VaguelySerious VaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review: blocking issues found

Comment thread packages/core/src/runtime/vm-mode.ts
Comment thread docs/content/docs/v5/configuration/runtime-tuning.mdx
Comment thread docs/content/docs/v5/configuration/runtime-tuning.mdx
Comment thread packages/core/src/runtime.test.ts
…based PRNG fast-forward, unified host-callback list, lifecycle hardening

- SnapshotMetadata gains eventCount, rngDraws and formatVersion. The
  max-events guard now compares restored total + delta (both at entry
  and per loop turn) — previously a run that kept snapshotting could
  never accumulate enough delta to trip the ceiling it exists for.
- Correlation-id generation is position-based across snapshots: the
  runtime seeds from the BASE seed and fast-forwards the persisted draw
  count instead of mixing the snapshot cursor into the seed. Ids are now
  identical across snapshot generations AND identical to a no-snapshot
  run, so overlapping invocations straddling a snapshot save still
  collide on the world's dedup (new test pins restored ids == full-replay
  ids). Snapshots without a draw count fall back to full replay.
- Host callbacks are declared in ONE list that drives both the fresh-boot
  install and the restore re-registration, so adding a callback can't
  silently skip the restore path.
- Preloaded events are used again with snapshotting enabled (the first
  qualifying suspension skips its save — no cursor yet); short runs keep
  the zero-round-trip fast path.
- Snapshot persist runs off the response path (waitUntil), with a 32MB
  plaintext size ceiling (skip + warn). Loads that fail format/shape
  checks warn instead of silently miming a miss. Terminal deletes are
  gated on a snapshot actually existing and now also fire on the runGone
  path; a server-side TTL remains the backstop for unobserved
  cancellations.
…ck into node:vm)

- useQuickJSVm defaults to the QuickJS engine when neither the run's
  stamped executionContext.workflowVm nor WORKFLOW_VM specifies one;
  WORKFLOW_VM=node is the explicit node:vm opt-in.
- CI matrix inverted to match: quickjs legs leave WORKFLOW_VM unset so
  the default-selection path is exercised end to end; node legs opt in
  explicitly (labels/artifacts unchanged via MATRIX_VM).
- Entrypoint tests that assert node replay-loop internals against mock
  worlds pin WORKFLOW_VM=node (the quickjs path would instantiate a WASM
  VM per call).
- Docs + changeset updated. Runs keep the engine stamped at start().
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 8a78801 · Tue, 11 Aug 2026 08:56:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 2251 (+113%) 🔻 2517 🔴 (+114%) 🔻 2575 🔴 (+114%) 🔻 2706 🔴 (+58%) 🔻 30
TTFS stream 2315 (+122%) 🔻 2522 🔴 (+121%) 🔻 2576 🔴 (+121%) 🔻 3136 🔴 (+159%) 🔻 30
TTFS hook + stream 2262 (+81%) 🔻 2784 🔴 (+104%) 🔻 2967 🔴 (+112%) 🔻 4659 🔴 (+209%) 🔻 30
STSO 1020 steps (inline) 314 (+227%) 🔻 1124 (+585%) 🔻 1278 (+530%) 🔻 1508 (+94%) 🔻 1017
STSO 1020 steps (queue-hop) 4181 5129 5129 5129 2
WO 1020 steps 876491 (+411%) 🔻 876491 (+411%) 🔻 876491 (+411%) 🔻 876491 (+411%) 🔻 1
SL stream latency 119 (+31%) 🔻 151 🔴 (-1.9%) 160 🔴 (-7.0%) 378 🔴 (-32%) 💚 30
SO stream overhead (text) 150 (+14%) 226 (-18%) 💚 231 (-30%) 💚 516 (-34%) 💚 30
SO stream overhead (structured) 152 (+25%) 🔻 245 (±0%) 352 (+13%) 397 (-12%) 30
📈 STSO distribution vs main (inline / queue-hop histograms)

1020 steps (inline)

Cumulative STSO time: main 170410ms → this run 864672ms (Δ +694262ms, +407%)

   50-100 ms  ┃                         main   1  this   0    -1
  100-150 ms  ┃███████████████████████  main 627  this   0  -627
  150-200 ms  ┃██████████               main 279  this   0  -279
  200-250 ms  ┃█                        main  59  this   0   -59
  250-300 ms  ┃                         main  17  this   0   -17
  300-350 ms  ┃                         main   8  this  30   +22
  350-400 ms  █┃                        main   3  this  48   +45
  400-450 ms  █░┃                       main   2  this  74   +72
  450-500 ms  █┃                        main   1  this  61   +60
  500-550 ms  █┃                        main   2  this  43   +41
  550-600 ms  ░┃                        main   0  this  42   +42
  600-650 ms  ┃                         main   2  this  25   +23
  650-700 ms  ┃                         main   4  this  36   +32
  700-750 ms  █┃                        main   3  this  45   +42
  750-800 ms  █┃                        main   2  this  54   +52
  800-850 ms  █┃                        main   3  this  60   +57
  850-900 ms  █┃                        main   1  this  52   +51
  900-950 ms  ░┃                        main   0  this  40   +40
 950-1000 ms  ┃                         main   1  this  34   +33
1000-1050 ms  ┃                         main   1  this  35   +34
1050-1100 ms  ░┃                        main   0  this  50   +50
1100-1150 ms  ░┃                        main   0  this  59   +59
1150-1200 ms  ░┃                        main   0  this  60   +60
1200-1250 ms  ┃                         main   0  this  36   +36
1250-1300 ms  █┃                        main   1  this  48   +47
1300-1350 ms  ┃                         main   1  this  32   +31
1350-1400 ms  ┃                         main   0  this  21   +21
1400-1450 ms  ┃                         main   0  this  11   +11
1450-1500 ms  ┃                         main   0  this   7    +7
1500-1550 ms  ┃                         main   0  this   5    +5
1550-1600 ms  ┃                         main   0  this   5    +5
1600-1650 ms  ┃                         main   0  this   1    +1
1650-1700 ms  ┃                         main   1  this   2    +1
1800-1850 ms  ┃                         main   0  this   1    +1

1020 steps (queue-hop)

Cumulative STSO time: 9310ms over 2 samples

No main baseline with raw samples yet — showing this run's distribution on its own; the diff appears once a run on main has recorded them.

4000-4500 ms  ████████████████████████  steps 1
5000-5500 ms  ████████████████████████  steps 1
📜 Previous results (4)

c671016

Mon, 10 Aug 2026 20:52:43 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 393 (-60%) 💚 1346 🔴 (+12%) 2318 🔴 (+86%) 🔻 2723 🔴 (+104%) 🔻 30
TTFS stream 435 (+68%) 🔻 2303 🔴 (+104%) 🔻 2489 🔴 (+109%) 🔻 2653 🔴 (+90%) 🔻 30
TTFS hook + stream 633 (+48%) 🔻 2718 🔴 (+80%) 🔻 2823 🔴 (+73%) 🔻 6004 🔴 (+184%) 🔻 30
STSO 1020 steps (inline) 254 (+176%) 🔻 1203 (+634%) 🔻 1411 (+635%) 🔻 1746 (+306%) 🔻 1016
STSO 1020 steps (queue-hop) 2656 6300 6300 6300 3
WO 1020 steps 915613 (+473%) 🔻 915613 (+473%) 🔻 915613 (+473%) 🔻 915613 (+473%) 🔻 1
SL stream latency 102 (-8.9%) 155 🔴 (-18%) 💚 167 🔴 (-62%) 💚 222 🔴 (-62%) 💚 30
SO stream overhead (text) 142 (+3.6%) 249 (+4.6%) 294 (-21%) 💚 540 (-57%) 💚 30
SO stream overhead (structured) 144 (-5.3%) 294 🔴 (+13%) 349 (-7.7%) 723 (+5.1%) 30

d41872a

Mon, 10 Aug 2026 19:58:41 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 907 (+298%) 🔻 2458 🔴 (+127%) 🔻 2568 🔴 (+130%) 🔻 2864 🔴 (+139%) 🔻 30
TTFS stream 2350 (+963%) 🔻 2518 🔴 (+133%) 🔻 2595 🔴 (+137%) 🔻 2658 🔴 (+125%) 🔻 30
TTFS hook + stream 2603 (+666%) 🔻 2806 🔴 (+111%) 🔻 2870 🔴 (+110%) 🔻 3038 🔴 (+102%) 🔻 30
STSO 1020 steps (inline) 237 (+121%) 🔻 996 (+538%) 🔻 1152 (+544%) 🔻 1515 (+376%) 🔻 1017
STSO 1020 steps (queue-hop) 3953 5702 5702 5702 2
WO 1020 steps 779592 (+403%) 🔻 779592 (+403%) 🔻 779592 (+403%) 🔻 779592 (+403%) 🔻 1
SL stream latency 100 (+6.4%) 137 🔴 (-5.5%) 146 🔴 (-23%) 💚 524 🔴 (-35%) 💚 30
SO stream overhead (text) 118 (-16%) 💚 160 (-44%) 💚 190 (-41%) 💚 321 (-77%) 💚 30
SO stream overhead (structured) 112 (-23%) 💚 156 (-65%) 💚 191 (-77%) 💚 297 (-72%) 💚 30

74bd053

Tue, 04 Aug 2026 01:01:14 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 2144 (+213%) 🔻 2365 🔴 (+148%) 🔻 2481 🔴 (+150%) 🔻 6410 🔴 (+291%) 🔻 30
TTFS stream 2087 (+125%) 🔻 2270 🔴 (+132%) 🔻 2337 🔴 (+135%) 🔻 2587 🔴 (+153%) 🔻 30
TTFS hook + stream 2171 (+505%) 🔻 2423 🔴 (+99%) 🔻 2463 🔴 (+86%) 🔻 2846 🔴 (+66%) 🔻 30
STSO 1020 steps (inline) 221 (+163%) 🔻 1005 (+553%) 🔻 1237 (+583%) 🔻 1614 (+386%) 🔻 1018
STSO 1020 steps (queue-hop) 4439 (+113%) 🔻 4439 (+113%) 🔻 4439 (+113%) 🔻 4439 (+113%) 🔻 1
WO 1020 steps 776076 (+399%) 🔻 776076 (+399%) 🔻 776076 (+399%) 🔻 776076 (+399%) 🔻 1
SO stream overhead (text) 127 (-5.2%) 188 (-28%) 💚 235 (-26%) 💚 518 (+24%) 🔻 30
SO stream overhead (structured) 116 (-4.1%) 184 (-17%) 💚 193 (-43%) 💚 311 (-51%) 💚 30

6af2c2c

Fri, 31 Jul 2026 23:40:21 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
STSO 1020 steps (inline) 218 (+69%) 🔻 1062 (+134%) 🔻 1253 (+147%) 🔻 1578 (+120%) 🔻 1017
STSO 1020 steps (queue-hop) 4670 (+213%) 🔻 6273 (+99%) 🔻 6273 (+99%) 🔻 6273 (+99%) 🔻 2
WO 1020 steps 835997 (+114%) 🔻 835997 (+114%) 🔻 835997 (+114%) 🔻 835997 (+114%) 🔻 1
SL stream latency 95 (+27%) 🔻 139 🔴 (+21%) 🔻 144 🔴 (+13%) 448 🔴 (+32%) 🔻 30
SO stream overhead (text) 112 (+12%) 218 (+60%) 🔻 254 (+49%) 🔻 513 (+134%) 🔻 30
SO stream overhead (structured) 135 (+32%) 🔻 265 🔴 (+39%) 🔻 406 (+73%) 🔻 1205 🔴 (+86%) 🔻 30
ℹ️ Metric definitions & methodology

The collapsed STSO distribution section above buckets every step gap of the sequential-steps run (not a sampled window), split by whether the step ending the gap ran inline — in the same warm process as the step before it, so the gap is pure framework overhead — or after a queue-hop — the first step of a fresh process, which pays queue dispatch, client reinit and event-log replay. Bars overlay the two runs: █ is main, ┃ marks where this run lands, ░ bridges the gap when this run has more samples in a bucket.

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

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.

@pranaygp

pranaygp commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ran the event-log-race-repro storm locally against this branch on world-local and world-postgres (24 step-storm + 24 hook-storm per condition, concurrency 6, nextjs-turbopack production server; same harness as the event-log-race-repro CI label). Control = this same branch with WORKFLOW_RUNTIME=node, so the only delta is the VM.

condition world step-storm hook-storm
node VM (control) local 24 corrupted / 0 completed 21 corrupted / 3 completed
QuickJS local 0 corrupted / 24 stuck 0 corrupted / 24 stuck
node VM (control) postgres¹ 3 corrupted / 12 stuck 0 corrupted / 6 stuck
QuickJS postgres¹ 0 corrupted / 12 stuck 0 corrupted / 6 stuck + 1 err

¹ partial runs (21 and 19 landed of 48) — the launch budget cut them short.

Caveat before reading the zero: under QuickJS not a single storm run completed — every run blew past the harness's 240s cap (stuck = alive but too slow, not wedged). The storm's corruption mechanism needs tight races (watchdog-vs-step within ~300ms windows, concurrent replays interleaving), and the interpreter is slow enough that those races mostly never happen. So on this evidence QuickJS starves the repro rather than beating it — the 0 is a throughput artifact, not a demonstrated determinism win. The node control on the same branch reproducing main-level saturation (24/24, 21/24 on local) confirms the harness itself was working.

A fair comparison needs EVENT_LOG_RACE_REPRO_RUN_TIMEOUT_MS raised (600s+) so QuickJS runs can actually complete, then corruption compared per completed run. For reference, the same harness on the storage-side fix (#3269) reached hook-storm 0 corrupted / 24 completed on world-postgres — completions are what make a zero meaningful.

…hreads

Merge resolution — main's #3048 finals carried into the inline-loop
architecture:
- namespace + run-origin nextTraceCarrier threaded through
  runWorkflowWithQuickJS into every publish (step handoffs, hook_conflict
  requeue, wait continuations, immediate requeues)
- suspended-exit requeues converted to FRESH messages (never
  { timeoutSeconds } visibility-redelivery of the current message — the
  hookInput redelivery trap fixed on #3048); exit wait sweep enqueues the
  continuation for the soonest unscheduled wait directly
- entrypoint-side hookInput materialization dropped in favor of main's
  engine-agnostic prologue re-ensure in runtime.ts (with #3230's
  (runId, resumeId) claim protocol); dispatch stays inside the replay
  loop's try so engine failures classify into run_failed
- interrupt handler keeps the perf branch's per-burst mutable budget,
  with main's configurable getReplayTimeoutMs() as the ceiling

Review fixes (PR #3049 threads):
- CRITICAL overflow wedge: overflow steps are handed to the queue in the
  same turn their step_created is written, BEFORE the event feed — the
  feed always observes those writes and continued the loop, so the old
  handoff was unreachable on the only turn that classified the steps as
  fresh (the cause of promiseRaceStressTestWorkflow hanging in the
  quickjs CI legs)
- backstop gating: the deliveryAttempt > 1 gate (common case on worlds
  that advance attempts on routine redeliveries) is replaced with the
  node engine's ownership decision table — lease-active steps owned by
  another message arm a DELAYED backstop for the lease remainder under
  an epoch-scoped key; owner redeliveries and expired/unstamped steps
  dispatch immediately under the bare-correlationId key. Ownership is
  derived host-side from observed step_started/step_retrying events
- ack-without-requeue: inline step terminals the feed has not surfaced
  raise the requeue signal, so the loop never acks with durably written
  terminals and nothing scheduled to consume them
- idempotency keys bucketed by purpose (dispatch / backstop:<epoch> /
  retry:<n>) so worlds that retire used keys cannot swallow a later
  publish for the same step
- live-feed terminal buffering: step/wait/attr terminals arriving before
  this VM constructs the corresponding resolver are buffered
  (__terminalBuffer, mirroring __hookPayloadBuffer) and settle the
  promise at construction — the single-scan continuation path previously
  dropped them and the await never settled

Validated: core 1888 passed, full e2e 136/136 under WORKFLOW_VM=quickjs
(nextjs-turbopack dev, world-local).
…-snapshots

Carries the #3049 merge down the stack. Resolution notes:
- inline loop's post-batch feed keeps BOTH sides: zero-event feeds raise
  pendingRequeueSignal before breaking (ack-without-requeue fix from
  #3049) and non-empty feeds advance eventsProcessedSinceSnapshot
- quickjs-runtime.test.ts keeps both trailing suites (VM snapshot/restore
  + hook dispose-then-sleep replay)

Validated: core 1899 passed; hook (26/26) and promiseRace e2e green
under WORKFLOW_VM=quickjs with WORKFLOW_SNAPSHOT_THRESHOLD=5.
@pranaygp

pranaygp commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Re-ran against the latest head (6af2c2c) with the harness run-timeout raised 240s → 600s so QuickJS runs get a fair chance to complete, plus a variant with the newest stack layer (#3263's cecd664a0, host-side serde via handles — not yet restacked into this branch) merged on top. Node control = same build, WORKFLOW_VM=node. 24 step-storm + 24 hook-storm per condition, world-postgres numbers from the per-run event logs.

condition (600s timeout) world step-storm hook-storm completed-run time
node control local 18 corrupt / 6 stuck / 0 ok 14 corrupt / 2 stuck / 8 err —
node control postgres 15 corrupt / 9 ok 1 corrupt / 23 ok p50 72s / p90 84s
QuickJS (this head) local 0 corrupt / 24 stuck 0 corrupt / 24 stuck none completed
QuickJS (this head) postgres 0 corrupt / all stuck 0 corrupt / all stuck none completed
QuickJS + #3263 serde (local merge) local 0 corrupt / 24 stuck 0 corrupt / 24 stuck none completed
QuickJS + #3263 serde (local merge) postgres 0 corrupt / 16 stuck / 2 err 0 corrupt / 24 stuck none completed

Performance (postgres, from event-log forensics):

  • node control: completed runs write ~603 events over ~71s ≈ 9 events/s sustained.
  • QuickJS as-shipped: runs were still appending when the 600s cap hit — p50 739 events at cutoff ≈ 1.2 events/s, a ~7–8× slowdown, with zero runs completing a workload node finishes in 72s. Storms this shape can't race at that speed, so "0 corrupted" remains a throughput artifact; the node control on the identical build still reproduces heavily.
  • QuickJS + the new QuickJS engine: host-side, side-effect-free serialization via handles #3263 serde commit: not slow — dormant. 38/42 runs burst ~98 events in the first ~8s (near node pace!) and then append nothing for the remaining ~10 minutes, no errors logged; stalled runs end on step_completed / hook_received — i.e. work landed and the run was never successfully resumed. The other 4 failed with USER_ERROR ("QuickJS runtime: workflow failed"). Caveat: I produced this tree by locally merging quickjs-host-serde onto this branch (clean, serde-scoped merge) since the restack hasn't happened — so it could be a serde×snapshotting interaction rather than QuickJS engine: host-side, side-effect-free serialization via handles #3263 alone, but the delta vs this head (continuous slow progress → hard stall at round ~1) is stark and reproducible across 62 runs.

Takeaways: (1) the corruption repro is alive on this branch under node; (2) a QuickJS corruption comparison is not yet meaningful — completion rate is 0/144 across every QuickJS condition even at 600s; (3) the ~8× interpreter gap is the first-order blocker, and the new serde layer (as merged here) introduces a wake/dormancy bug worth catching before the restack. Happy to share the harness setup (run-storm.sh) or the per-run forensics queries.

# Conflicts:
#	packages/core/src/runtime/quickjs-entrypoint.ts
#	packages/core/src/runtime/quickjs-runtime.ts
#	packages/world-postgres/src/drizzle/migrations/meta/_journal.json
#	packages/world-vercel/src/trace-propagation.test.ts
Port threshold snapshotting onto the post-#3263/#3342 engine:

- Snapshot format v2: per-run snapshot metadata now carries the host-serde
  capture root's snapshot-portable token (serdeRootPtr) and the monotonic
  correlation-id ULID factory's last output (lastUlid). v1 snapshots
  (in-VM serde era) are treated as a miss.
- Restore path rebuilds the host-side serde by re-adopting the capture
  root from the restored memory image (adoptSerdeRoot) — no guest code
  executes after user code has run, same mechanism as baseline snapshots.
- ULID continuation: the factory's monotonic state lives host-side and
  does not survive into the memory image; restores continue the sequence
  via incrementUlidRandom (byte-equivalent to the ulid package's
  same-timestamp increment, asserted by test), so a restored invocation
  emits the exact ids full replay would — keeping concurrent invocations
  dedupable via per-(runId, correlationId) uniqueness.
- __generateUlid joins the shared host-callback list (host functions are
  name-referenced from the WASM heap and must be re-registered on
  restore).
- Preloaded event logs (no cursor) are ignored when restoring from a
  snapshot; the caller-attested complete preload fast path is kept for
  the no-snapshot paths.
@github-actions

github-actions Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Event Log Race Repro

4 of 14 latest repro runs hit event-log regressions.

Run History

Metric 2026-08-10 19:34 UTC #1
logs / deploy
2026-08-10 20:24 UTC #1
logs / deploy
2026-08-11 08:26 UTC #1
logs / deploy
Result no regressions 2/14 regressions 4/14 regressions
Total 14 14 14
completed 14 12 10
CORRUPTED_EVENT_LOG 0 0 4
USER_ERROR 0 2 0
RUNTIME_ERROR 0 0 0
stuck 0 0 0
other 0 0 0
infra 0 0 0
Config 14 runs / step-storm 6, hook-storm 6, hook-sleep 2 / c8 / 6x8 14 runs / step-storm 6, hook-storm 6, hook-sleep 2 / c8 / 6x8 14 runs / step-storm 6, hook-storm 6, hook-sleep 2 / c8 / 6x8
Timing watchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms watchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms watchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

Scenario Total completed CORRUPTED_EVENT_LOG USER_ERROR RUNTIME_ERROR stuck other infra
step-storm 6 6 0 0 0 0 0 0
hook-storm 6 2 4 0 0 0 0 0
hook-sleep 2 2 0 0 0 0 0 0

Latest Non-Completed Runs

Scenario Attempt Outcome Status Error code Run
hook-storm 5 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KZQYT2GF0GGFCK46VENJ1PKX
hook-storm 4 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KZQYT2GF0GGFCK46VENJ1PKW
hook-storm 2 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KZQYT2GF0GGFCK46VENJ1PKT
hook-storm 3 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KZQYT2GF0GGFCK46VENJ1PKV

…ent delete, gated diagnostics

- @workflow/world: snapshots interface is now OPTIONAL on Storage (a
  World that can't store blobs simply omits it; consumers feature-detect
  and fall back to full replay) — keeps this a true minor for community
  worlds. New encodeSnapshotEnvelope/decodeSnapshotEnvelope helpers pack
  metadata + bytes into ONE self-describing blob; decode validates via
  the schema (passthrough for forward compat) and returns null for
  anything torn/corrupt/foreign — never fabricated metadata.
- world-local: single envelope file per run replaces the .bin/.json pair
  — the torn-save window (crash or concurrent load between two renames
  pairing bytes with another suspension's cursor) is structurally gone.
- world-postgres: data column stores the envelope; full metadata
  round-trips losslessly (new fields need no migration). Columns remain
  as denormalized observability copies.
- world-vercel: envelope is the PUT/GET body, so the full metadata
  round-trips without any workflow-server change; loads never invent
  metadata from headers/wall time (undecodable body = clean miss).
  DELETE treats 404 as success (idempotent like local/postgres).
  WORLD_SNAPSHOT_DIAG logs gated behind the package's HTTP debug flag.
…ck restore, off-path compression, ceiling latch, optional snapshots

- Blocking round-trip fix: full snapshot metadata now survives postgres
  and vercel via the snapshot envelope (see the world-side commit on
  quickjs-vm-snapshots) — the load gate no longer rejects every snapshot
  on production worlds.
- world.snapshots is optional: the entrypoint feature-detects and forces
  the threshold to 0 when absent (pure full replay, always correct).
- Engine-build pin: quickjs-wasi's version is baked into the generated
  assets module, stamped into snapshot metadata (engineVersion), and
  compared on load — the QJSS heap header is identical across builds, so
  a cross-build restore would execute as undefined behavior (live hazard
  mid-rollout). Mismatch = clean miss.
- Deterministic clock high-water (clockMs) persists in metadata and
  primes the restored VM's clock — Date.now() no longer regresses to
  run-creation time until the first delta event.
- Snapshot compression truly off the response path: the waitUntil IIFE
  yields past the current tick before touching bytes, and compress()
  gains preferAsync (zstd via the libuv threadpool with sync fallback;
  identical output bytes) so a multi-MB heap no longer blocks the loop.
- restoredEventCount resets when a restore fails and the fallback
  refetches the full log — the ceiling no longer double-counts
  pre-snapshot events, and the next save no longer stamps an inflated
  eventCount.
- Size-ceiling latch: a run whose heap once exceeded
  MAX_SNAPSHOT_PLAINTEXT_BYTES skips future captures outright (linear
  memory never shrinks), instead of re-paying two full heap copies per
  suspension to discard the result.
Combines the QuickJS-default dry-run with divergence-detection and
write-fencing parity (#3453) so the event-log-race repro measures the
same corruption classes on both engines. Conflict resolutions:

- makeLiveSession takes both the snapshot-state accessor and the
  observed-events ledger; the snapshot-restore path runs the divergence
  sweep against its delta view (a throw there falls back to a fresh
  full replay, whose sweep is authoritative).
- The precondition view tracker seeds its event count from the restored
  snapshot's metadata.eventCount (delta ids sort above the snapshot
  cursor, so watermark+count still describe the full log); snapshots
  without an eventCount fail open, and the restore-failure fallback
  rebuilds the view from the refetched full log.
@TooTallNate

TooTallNate commented Aug 11, 2026 •

Copy link
Copy Markdown
Member Author

Repro readout after merging quickjs-divergence-parity (#3453)

The 2026-08-11 08:26 run is the first repro pass where the QuickJS engine carries the node engine's divergence detection + write fencing. The instrument now works, and the picture changes materially:

Before parity (this PR's earlier runs) After parity (08:26 run)
step-storm 6/6 completed 6/6 completed
hook-storm 0 CORRUPTED_EVENT_LOG, 0–2 USER_ERROR, rest "completed" 4/6 CORRUPTED_EVENT_LOG, 0 USER_ERROR
hook-sleep 2/2 2/2

All four failures decrypt to the exact same signature as the node engine's hook-storm failures:

step event step_created for step_... belongs to "recoverStep",
but the current step consumer is "finalizeStep"
(diverged 4 times after 3 recovery replays)

i.e. the racing-writer / correlation-id-renumbering class — not a false positive of the new detection (a genuine one-off log would be reproduced by the recovery replays; these diverge identically on every recovery pass, which is the definition of an unsatisfiable log).

What this means

  • QuickJS was never immune to the corruption class — it was blind to it. Its earlier "zero corruptions" here decomposed into USER_ERROR (self-HookConflictError when the shifted ordinal hit a hook token) and, for step-ordinal hits, silently wrong completions counted as green. With stepName validation those now classify identically to node.
  • The two engines now report the same disease with the same instrument: node (with the EventsConsumer rewrite) showed 1/6 hook-storm corruption; QuickJS shows 4/6 (small samples — but the direction is consistent with QuickJS's inline continuation loop holding live views across more writes).
  • No SDK-side engine work reaches zero on hook-storm; the racing branch-decision writes need write-side ordering (event slots / commit-ordered positions).

The merge also closed the entrypoint's precondition-guard KNOWN GAP (all replay-context writes now fenced, including snapshot-restore-aware view seeding from metadata.eventCount) — worth keeping in mind when comparing rates against runs before this merge.

This branch had an error being deployed

1 failed and 17 active deployments
Preview – workflow-swc-playground — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workflow-docs — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – example-nextjs-workflow-webpack — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – example-nextjs-workflow-turbopack — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-sveltekit-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-nuxt-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – example-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-tanstack-start-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-vite-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-astro-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-fastify-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-express-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-hono-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-nitro-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-nestjs-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workflow-tarballs — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workflow-web — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Preview – workbench-python-workflow — 8a78801e Deployed Aug 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

event-log-race-repro Run the event log race reproduction job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants