[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[test] Event log corruption fixes + event-index-completeness backend - #3172

Draft
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx
Draft

[test] Event log corruption fixes + event-index-completeness backend#3172
VaguelySerious wants to merge 12 commits into
mainfrom
peter/tmp-corrupt-test-idx

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Measurement-only branch. Identical SDK code to #3167, with WORKFLOW_SERVER_URL_OVERRIDE pointed at a backend preview that indexes every event a create request persists.

Why: the backend's event index recorded only the event returned in the create response, so a lazy step start (step_created + step_started in one transaction) and a resilient run start each went under-counted. Because the guard rejects iff recordedAtOrBelow(W) > stateEventCount, an under-count silently disarms it — production shows 1,762,379 evaluations with 0stale verdicts.

Purpose of this PR is the event-log-race-repro comparison against #3167's run (540/600 step-storm, 133/600 hook-storm corrupted). Not for merge.

pranaygpand others added 12 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>
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11388db

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

This PR includes changesets to release 21 packages
NameType
workflowMinor
@workflow/coreMinor
@workflow/world-vercelMinor
@workflow/worldMinor
@workflow/errorsMinor
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/cliPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/webPatch
@workflow/world-localPatch
@workflow/world-postgresPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/nuxtPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch

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

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

vercelBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

▲ Vercel Production (1 failed)

fastify (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72 | 🔍 observability

📦 Local Production (1 failed)

nextjs-webpack-stable (1 failed):

  • webhookWorkflow | wrun_41KYNET49A0GPD9YK3B4S3GG0X

📋 Other (1 failed)

e2e-vercel-prod-tanstack-start (1 failed):

  • fibonacciWorkflow - recursive workflow composition via start() | wrun_41KYNF87GB0GW74T2RP8P8FS72

E2E Test Summary

Summary
PassedFailedSkippedTotal
❌ ▲ Vercel Production145412391694
✅ 💻 Local Development146702271694
❌ 📦 Local Production162012271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
❌ 📋 Other101912121232
✅ vercel-multi-region270027
Total7362311328497
Details by Category

❌ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
❌ fastify125128
✅ hono126028
✅ nextjs-turbopack15103
✅ nextjs-webpack15103
✅ nitro126028
✅ nuxt126028
✅ sveltekit14509
✅ vite126028

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
❌ nextjs-webpack-stable15310
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable128026
✅ express-stable128026
✅ fastify-stable128026
✅ hono-stable128026
✅ nextjs-turbopack-canary135019
✅ nextjs-turbopack-stable15400
✅ nextjs-webpack-canary135019
✅ nextjs-webpack-stable15400
✅ nitro-stable128026
✅ nuxt-stable128026
✅ sveltekit-stable14707
✅ vite-stable128026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack15400

❌ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable128026
✅ e2e-local-dev-tanstack-start-128026
✅ e2e-local-postgres-nest-stable128026
✅ e2e-local-postgres-tanstack-start-128026
✅ e2e-local-prod-nest-stable128026
✅ e2e-local-prod-tanstack-start-128026
✅ e2e-vercel-prod-nest126028
❌ e2e-vercel-prod-tanstack-start125128

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 11388db · Tue, 28 Jul 2026 23:10:08 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1229 (+382%) 🔻1294 🔴 (+23%) 🔻1332 🔴 (+20%) 🔻1408 🔴 (-2.2%)30
TTFSstream1213 (+351%) 🔻1275 🔴 (+21%) 🔻1299 🔴 (+11%)1372 🔴 (-32%) 💚30
TTFShook + stream853 (+92%) 🔻1573 🔴 (+25%) 🔻1626 🔴 (+27%) 🔻2255 🔴 (+59%) 🔻30
STSO1020 steps (1-20)172 (+6.8%)252 🔴 (-15%)308 🔴 (±0%)361 🔴 (-17%) 💚19
STSO1020 steps (101-120)185 (+3.9%)263 🔴 (-5.4%)385 🔴 (-35%) 💚551 🔴 (-35%) 💚19
STSO1020 steps (1001-1020)468 (-4.1%)528 🔴 (-9.4%)559 🔴 (-37%) 💚586 🔴 (-34%) 💚19
WO1020 steps385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)385153 (-4.2%)1
SLstream latency86 (-6.5%)145 🔴 (-13%)210 🔴 (-21%) 💚513 🔴 (-44%) 💚30
SOstream overhead (text)108 (-10%)157 (-38%) 💚225 (-30%) 💚616 (-55%) 💚30
SOstream overhead (structured)98 (-30%) 💚154 (-58%) 💚192 (-57%) 💚228 (-99%) 💚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

Copy link
Copy Markdown
Contributor

Event Log Race Repro

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

Run History

Metric2026-07-28 23:24 UTC #1
logs / deploy
Result733/1400 regressions
Total1400
completed667
CORRUPTED_EVENT_LOG731
USER_ERROR0
RUNTIME_ERROR0
stuck2
other0
infra0
Config1400 runs / step-storm 600, hook-storm 600, hook-sleep 200 / c40 / 6x8
Timingwatchdog 2500ms / step 2200±250ms / stagger 400ms / poke 750ms / timeout 240000ms

Latest Scenario Breakdown

ScenarioTotalcompletedCORRUPTED_EVENT_LOGUSER_ERRORRUNTIME_ERRORstuckotherinfra
step-storm6004655400000
hook-storm60042117700200
hook-sleep200200000000

Latest Non-Completed Runs

ScenarioAttemptOutcomeStatusError codeRun
step-storm27CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSJ0GG21Q30SAJQ4GHF
step-storm2CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWC00GYYZD561XT0GHW8
step-storm20CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJC0GQZ82DAAPV1CBVM
step-storm14CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWGA0GTGQMSF9MB2WWTV
step-storm28CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRC0GSGFMV4H3DVS84M
step-storm17CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWJ70GWSAKSD9XV2Y81A
step-storm34CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWSG0GJ3X53SX2VDM2QR
step-storm35CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTC0GXD4SR6T1HY8DEE
step-storm36CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWT70GX2XEKS1ZA7BDE3
step-storm21CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWN00GWTD7KX3TMY8C5S
step-storm29CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWYS0GPG4F7SYMVQ2RMS
step-storm26CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRA0GYX08X0NST4JP8H
step-storm39CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTG0GHBRTPV7N8VDGJ4
step-storm31CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWRR0GKF7KV06HBTNJQ4
step-storm9CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWDT0GN79ZW99HB0KT7Z
step-storm15CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWHZ0GK20RCJY8B0YQH0
step-storm8CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWCQ0GTH9DNY7GJRXM0Z
step-storm38CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWTK0GPRWHVN1K4E2EH3
step-storm22CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWMW0GZ53V7D1NNCA3ZN
step-storm25CORRUPTED_EVENT_LOGfailedCORRUPTED_EVENT_LOGwrun_41KYNERWR20GJJJ724C8SB02Z5

Showing 20 of 733 non-completed runs.

Sign up for freeto 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.

3 participants

@VaguelySerious@pranaygp@TooTallNate