Skip to content

[measurement] Storm repro with call-site ids + sequential replays - #3180

Draft
VaguelySerious wants to merge 15 commits into
mainfrom
peter/tmp-corrupt-test-callsite-seq
Draft

[measurement] Storm repro with call-site ids + sequential replays#3180
VaguelySerious wants to merge 15 commits into
mainfrom
peter/tmp-corrupt-test-callsite-seq

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement only — do not merge.

Same code as #3179 (call-site correlation IDs), with WORKFLOW_SEQUENTIAL_REPLAYS=1 added to the workbench app on top of WORKFLOW_CALLSITE_CORRELATION_IDS=1.

Why: #3179 cut the storm repro by 84% / 95%, and every one of the residual corrupted runs classified so far fails on a step that only exists on one branch of Promise.race([settle, sleep(watchdogMs)]) — two concurrent replays taking different branches, which no correlation-ID scheme can fix. Sequential replays remove the concurrency that makes the branches disagree. Measured alone (#3175) it was step-storm-neutral; the question is whether it is additive once the rename amplifier is gone.

pranaygp and others added 14 commits July 27, 2026 16:35
…by event-log position

Two production runs on `@workflow/core@5.0.0-beta.36` burned all three
divergence-recovery replays at the same event and terminated with
CORRUPTED_EVENT_LOG:

  wrun_41KYJENABV0GSF5YTE9EETV5DD  (step vs wait)
  wrun_41KYJEE01S0GPC9RWT5MEKVCX8  (step vs hook)

  Replay divergence: step event step_created for step_X belongs to "A",
  but the current step consumer is "B"

`useStep` proxies draw deterministic ULIDs in invocation order, so the
ULID -> stepName allocation is a function of the order in which promise
resolutions are delivered to workflow code. The delivery-barrier registry
pinned that order to event-log position for hook payloads and wait
completions, but step results were delivered straight off the serial
`promiseQueue` — and their latency varies between replays of the SAME
invocation, because the first replay pays full hydration while later
replays memo-hit primitive results in the shared `ReplayPayloadCache`.
A step completion adjacent in the log to a `wait_completed` was therefore
delivered wait-first on a cold replay and step-first on a warm one;
whichever order the invocation that wrote the follow-up `step_created`
events happened to see became law, and every replay computing the other
order diverged permanently.

Step results and step failures now register a 'step' delivery barrier at
their event-log index and resolve from a detached continuation after every
relevant earlier-in-log delivery, mirroring the hook payload path:
hydration stays inside the serial queue slot (which also releases
`pendingDeliveries`), while the barrier wait and the resolve run off the
queue so a queue slot never blocks on a resolution the queue itself drives.
Waits and hook payloads likewise defer behind earlier step results.

Two details are what actually make the ordering hold, and both were found
by testing rather than by reading the code:

The deferral set is captured while CONSUMING the event, not at the start of
the hydration slot. Captured at slot start it is not merely less
deterministic, it is usually empty: an earlier delivery whose own slot runs
first on the serial queue has typically already resolved and deregistered
its barrier before the later slot begins, so the later delivery does not
defer at all. Every event in one drain window is consumed before any slot
runs, so consumption time sees all of them.

A delivery that had to wait then yields a macrotask before resolving. An
earlier delivery being "delivered" only means its `resolve()` ran; the
branch it woke may need arbitrarily many further microtask hops before it
reaches its next `useStep` call (a `for await` over a hook resumes the
generator, settles the promise from `next()`, and only then runs the loop
body). Ordering the `resolve()` calls alone therefore buys a fixed hop or
two of margin and leaves a hop-count race that holds only for the shortest
consumers; yielding a macrotask lets the earlier branch drain completely,
whatever its shape.

One asymmetry is load-bearing: a step result skips any earlier delivery
that will not resolve on its own, i.e. one blocked directly or
transitively on a buffered hook payload no consumer has claimed. Such a
payload is delivered only when the workflow next reads the hook, and
reaching that read commonly requires the step result itself, so gating the
step on it stalls the run until the barrier's idle safety net fires — which
then releases every delivery queued behind that payload at once and loses
the very race the ordering exists to protect. Waits and hooks keep gating
on unclaimed payloads, where waiting for the claim IS the guarantee.

Tests come in two files. `step-delivery-ordering.test.ts` is byte-identical
to the file in the repro-only companion PR #3137 apart from
two `it.fails` markers there (which let a repro-only branch have green CI);
`sed 's/it\.fails(/it(/g' | cmp` verifies it. Each of its five cases
replays one committed log twice through a shared `ReplayPayloadCache`, and
the two warm-replay cases fail on main with the production error text.

`step-delivery-hop-count.test.ts` exists because those five cases cannot
tell "delivered in log order" apart from "resolves a hop or two later than
before". It replays logs a live run legitimately produced — the live
invocation received the two events in separate deliveries, so the first
branch finished long before the second event existed — while the replay
receives both in one drain window, and pads the consumer with a varying
number of extra awaits so hop count is the only variable. It covers step
results against both wait completions and hook payloads, plus step
FAILURES against wait completions, since a rejection decides whether a
`catch` continuation runs and so which ULID the `useStep` there draws. All
18 cases fail on main; of the 12 that predate the macrotask, 9 still fail
with the resolve-ordering-only version of this fix; all 18 pass here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Follow-up on the step-delivery barrier work, addressing three cases the
registry did not yet cover. Each has a regression test in the new
`delivery-barrier-coverage.test.ts` that reproduces the production
`ReplayDivergenceError` when its fix is reverted.

- Step results now defer behind earlier STEP results. The old exclusion
  assumed the serial `promiseQueue` fixes step-vs-step order, which stopped
  holding once a step began resolving from a detached continuation instead
  of its queue slot: two steps consumed in different drain windows can
  disagree on their deferral set, and the earlier one — parked on the
  macrotask yield — gets overtaken.

- `sleep.ts` and `hook.ts` (waiting-consumer path) now capture their
  deferral at event-consumption time, as `step.ts` already does. Reading
  the registry after their queue work misses an earlier step or hook that
  delivered and retired its barrier in the meantime, skipping both the gate
  and the macrotask yield. The buffered hook payload path deliberately
  keeps evaluating at claim time; a consumption-time snapshot there stalls
  the e2e `hookWithSleepWorkflow`.

- Abort deliveries participate in the registry. `_setAborted` fires the
  signal's listeners, which may invoke a step and draw a ULID, so an abort
  is as branch-deciding as any other delivery.

Also memoizes `resolvesOnItsOwn`. The walk is exponential in the number of
live hook/wait barriers, and the registry is not bounded — a fan-out of
`Promise.race([hook, sleep])` branches accumulates one barrier per branch
per kind (49 measured for 24 branches). At 40 barriers a single scan took
92s before, and is instant after.
…process

A replay-context event creation previously described its snapshot with a
single watermark, which only proves no event landed above it. It cannot
detect a *missing* event below it, so a replay working from a log with a
hole still committed events derived from that hole — and because
correlation IDs are positional ordinals of one seeded sequence, a
one-event difference renames every downstream entity and corrupts the log.

Creations now also send the snapshot's event count and its cursor, and a
rejection restarts the replay inside the same invocation instead of
re-posting the rejected payload (whose IDs the corrected log invalidates)
or paying a queue round trip. A world may attach the missing events to
its 412, in which case the first restart needs no event-log request.

Also guards the suspension `attr_set` write, and re-sorts a merged event
log by event ID when an append arrives out of order.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Also makes the v4 event tests derive their mock origin from the override
like the rest of the file already does, so a non-empty override does not
fail unit tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The matching world-vercel guard shipped and is live in production, so the e2e
lanes exercise both halves against the default endpoint.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Resolves the overlap with #3110, which introduced the same event-log merge
consolidation this branch had added as `mergeEvents`: `appendUniqueEvents`
now carries the optional id set from main plus the out-of-order re-sort and
warning, and `mergeEvents` is gone. Main's `withPreconditionRetry` edit drops
out with the function itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Correlation ids are the Nth draw of one per-run ULID sequence, which makes
every id an ordinal: two concurrent replays that disagree about a single
event assign different ids to every entity after it, so one replay appends
events the other can neither match nor consume and the run fails with
CORRUPTED_EVENT_LOG out of a one-event difference.

With WORKFLOW_CALLSITE_CORRELATION_IDS=1 an id is derived from the call site
that creates the entity — a step's name plus an argument fingerprint, a
hook's pinned token — plus a per-scope invocation counter, so the same entity
gets the same id in both replays and a late write collides idempotently
instead of renaming everything downstream. Ids stay syntactically valid
ULIDs; hook tokens for unpinned hooks are derived from the correlation id
rather than drawn from the run's PRNG stream.

The flag defaults off, and with it off the generator is the positional
sequence itself, so nothing about the default path changes.

Also sets the flag on the nextjs-turbopack workbench for the race repro.
…ation-ids

# Conflicts:
#	packages/core/src/delivery-barrier-coverage.test.ts
#	packages/core/src/step-delivery-hop-count.test.ts
#	packages/core/src/step-delivery-ordering.test.ts
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: acc5739

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

This PR includes changesets to release 21 packages
Name Type
workflow Minor
@workflow/core Minor
@workflow/world-vercel Minor
@workflow/world Minor
@workflow/errors Minor
@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/world-local Patch
@workflow/world-postgres Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/nuxt Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite 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

@VaguelySerious VaguelySerious added the event-log-race-repro Run the event log race reproduction job label Jul 29, 2026
@vercel

vercel Bot commented Jul 29, 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 29, 2026 5:16am
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jul 29, 2026 5:16am
example-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-astro-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-express-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-fastify-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-hono-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-nestjs-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-nitro-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-nuxt-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-sveltekit-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workbench-vite-workflow Ready Ready Preview, Comment Jul 29, 2026 5:16am
workflow-swc-playground Ready Ready Preview, Comment Jul 29, 2026 5:16am
workflow-tarballs Ready Ready Preview, Comment Jul 29, 2026 5:16am
workflow-web Ready Ready Preview, Comment Jul 29, 2026 5:16am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
workflow-docs Skipped Skipped Jul 29, 2026 5:16am

@vercel
vercel Bot temporarily deployed to Preview – workflow-docs July 29, 2026 04:10 Inactive
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit acc5739 · Wed, 29 Jul 2026 05:34:07 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 1164 (+68%) 🔻 1286 🔴 (+25%) 🔻 1307 🔴 (+23%) 🔻 1598 🔴 (-3.7%) 30
TTFS stream 1204 (+25%) 🔻 1270 🔴 (+24%) 🔻 1304 🔴 (+26%) 🔻 1360 🔴 (+17%) 🔻 30
TTFS hook + stream 420 (-64%) 💚 1548 🔴 (+19%) 🔻 1646 🔴 (+21%) 🔻 2191 🔴 (+42%) 🔻 30
STSO 1020 steps (1-20) 166 (-8.8%) 257 🔴 (-2.3%) 356 🔴 (+9.5%) 500 🔴 (+32%) 🔻 19
STSO 1020 steps (101-120) 186 (-2.6%) 248 🔴 (-5.3%) 298 🔴 (-10.0%) 305 🔴 (-71%) 💚 19
STSO 1020 steps (1001-1020) 475 (+1.1%) 542 🔴 (-3.2%) 621 🔴 (-11%) 644 🔴 (-16%) 💚 19
WO 1020 steps 388528 (-4.0%) 388528 (-4.0%) 388528 (-4.0%) 388528 (-4.0%) 1
SL stream latency 83 (+5.1%) 168 🔴 (+32%) 🔻 219 🔴 (+40%) 🔻 2653 🔴 (+1100%) 🔻 30
SO stream overhead (text) 103 (-5.5%) 153 (-27%) 💚 226 (-29%) 💚 353 (-44%) 💚 30
SO stream overhead (structured) 95 (-5.0%) 158 (-8.7%) 181 (-7.7%) 223 (-47%) 💚 30
📜 Previous results (1)

732c5b6

Wed, 29 Jul 2026 04:32:34 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 216 (-69%) 💚 1146 🔴 (+11%) 1272 🔴 (+20%) 🔻 1434 🔴 (-14%) 30
TTFS stream 196 (-80%) 💚 482 🔴 (-53%) 💚 677 🔴 (-35%) 💚 1462 🔴 (+26%) 🔻 30
TTFS hook + stream 364 (-69%) 💚 816 🔴 (-37%) 💚 1443 🔴 (+6.0%) 1924 🔴 (+25%) 🔻 30
STSO 1020 steps (1-20) 231 (+27%) 🔻 582 🔴 (+121%) 🔻 1002 🔴 (+208%) 🔻 1024 🔴 (+170%) 🔻 19
STSO 1020 steps (101-120) 201 (+5.2%) 271 🔴 (+3.4%) 439 🔴 (+33%) 🔻 625 🔴 (-41%) 💚 19
STSO 1020 steps (1001-1020) 502 (+6.8%) 572 🔴 (+2.1%) 599 🔴 (-14%) 820 🔴 (+6.8%) 19
WO 1020 steps 424092 (+4.8%) 424092 (+4.8%) 424092 (+4.8%) 424092 (+4.8%) 1
SL stream latency 135 (+71%) 🔻 438 🔴 (+245%) 🔻 529 🔴 (+239%) 🔻 601 🔴 (+172%) 🔻 30
SO stream overhead (text) 155 (+42%) 🔻 1518 🔴 (+626%) 🔻 2005 🔴 (+532%) 🔻 2988 🔴 (+373%) 🔻 30
SO stream overhead (structured) 156 (+56%) 🔻 797 🔴 (+361%) 🔻 2105 🔴 (+974%) 🔻 4189 🔴 (+895%) 🔻 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.

@github-actions

github-actions Bot commented Jul 29, 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 29, 2026

Copy link
Copy Markdown
Contributor

Event Log Race Repro

84 of 1400 latest repro runs hit event-log regressions.

Run History

Metric 2026-07-29 05:07 UTC #1
logs / deploy
2026-07-29 06:10 UTC #1
logs / deploy
Result 98/1400 regressions 84/1400 regressions
Total 1400 1400
completed 1302 1316
CORRUPTED_EVENT_LOG 98 82
USER_ERROR 0 0
RUNTIME_ERROR 0 0
stuck 0 2
other 0 0
infra 0 0
Config 1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8 1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timing 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 600 528 72 0 0 0 0 0
hook-storm 600 588 10 0 0 2 0 0
hook-sleep 200 200 0 0 0 0 0 0

Latest Non-Completed Runs

Scenario Attempt Outcome Status Error code Run
step-storm 29 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4R6240GMGTN6BWYBX65EF
step-storm 40 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4R6820GHX98V37E4JYR1Y
step-storm 42 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4RRJV0GW7R0VM3YCBW2D4
step-storm 45 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4TV560GGM85W006MGS18R
step-storm 51 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4V1VK0GJ0ZC4KSDH2R60Q
step-storm 52 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4V1X60GKYJQMEFBTNZHE1
step-storm 62 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4V3R80GXCJ3A0CXWSBYXX
step-storm 85 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4VCTK0GS3Q509N5W9ME9F
step-storm 89 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4XD1X0GKZD8A3F9CNSYYD
step-storm 92 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4XJ7F0GPMKHQ65RH38EGC
step-storm 101 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4XRCT0GNWTJ0V1KDPEJYD
step-storm 111 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4XX0P0GJ4GME35QWTTM3E
step-storm 120 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4Y0930GW01Z38QY7T80CP
step-storm 104 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4XT5P0GRQGMMP2PH2GBHD
step-storm 128 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP4Y6CW0GJESZZQWM9HJEMT
step-storm 136 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP503N80GMYXZ4WCEQN08KD
step-storm 150 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP50GJE0GN2B7TVK3HV29WR
step-storm 175 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP518980GZ62589XXRXZTPV
step-storm 181 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP52YM70GJ883YFRWZZE3J7
step-storm 189 CORRUPTED_EVENT_LOG failed CORRUPTED_EVENT_LOG wrun_41KYP5326M0GNKFYGB6MBQ6WV5

Showing 20 of 84 non-completed runs.

TEMPORARY measurement branch. The runtime env var alone only creates per-run
queue topics; the maxConcurrency: 1 half of the feature is baked into the flow
function trigger at build time, so build.env is required for replays to actually
serialize.
@VaguelySerious VaguelySerious added event-log-race-repro Run the event log race reproduction job and removed event-log-race-repro Run the event log race reproduction job labels Jul 29, 2026
@vercel
vercel Bot temporarily deployed to Preview – workflow-docs July 29, 2026 05:13 Inactive
@VaguelySerious

Copy link
Copy Markdown
Member Author

(AI) First repro run (30421550791) is invalid — discard it.

It reported 98/1400 (step-storm 93, hook-storm 5), statistically identical to the call-site-IDs-only baseline of 95/1400, because WORKFLOW_SEQUENTIAL_REPLAYS was only in vercel.json's runtime env block. The flag has two halves: the runtime var creates per-run queue topics, but maxConcurrency: 1 is baked into the flow function trigger at build time. With only the runtime half set, the topics exist and are not serialized — extra topic cardinality, no serialization.

build.env added in acc5739; re-running as 30424467075.

@VaguelySerious

Copy link
Copy Markdown
Member Author

(AI) Re-run with build.env set (30424467075):

scenario call-site IDs only (#3179) + sequential replays two-proportion test
step-storm 87 / 600 72 / 600 z=1.28, p=0.20
hook-storm 8 / 600 10 / 600 z=−0.47, p=0.64
hook-sleep 0 / 200 0 / 200
overall 95 / 1400 82 / 1400 z=1.01, p=0.31
stuck 0 2 (hook-storm)

Sequential replays do not close the residual. No arm reaches significance, and this is the only measurement in the series that produced stuck runs — consistent with the wake-delay trade-off of per-run maxConcurrency: 1 from #2193.

That refutes the hypothesis this branch was opened to test. The corrected mechanism needs only one replay, not two concurrent ones:

  1. a replay reaches Promise.race([settle, sleep(watchdogMs)]) with no step_completed in its log yet, takes the watchdog branch, and writes recoverStep;
  2. the step's step_completed lands — step routes are unaffected by this flag, which fences only flow invocations;
  3. the next replay now sees the step complete, takes the settled branch, and recoverStep is unconsumable → ReplayDivergenceError.

Serializing flow invocations cannot help, because the two disagreeing replays were never required to overlap. This is a currency problem (a replay decided on a prefix that later grew), not a concurrency one, which is the same conclusion the count-based precondition guard ran into. The remaining candidate end states are unchanged: currency-based write admission, or epoch-tagged writes so events from a superseded replay attempt are ignorable rather than fatal.

Caveat on verification: I could not confirm serialization at the request-log level because the Vercel API token expired mid-check (invalidToken). The indirect evidence is that this is the same build.env key in the same workbench that produced a ~53% hook-storm reduction in #3175, and that the 2 stuck runs are the expected serialization side effect. Completed-run durations are unchanged (step-storm median 84.3s vs 84.9s), which is neither confirmation nor refutation.

This branch stays measurement-only; do not merge.

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.

3 participants