Skip to content

fix(core): retry replay timeouts without exiting - #3385

Merged
NathanColosimo merged 4 commits into
mainfrom
codex/retry-replay-timeout-without-exit
Aug 7, 2026
Merged

fix(core): retry replay timeouts without exiting#3385
NathanColosimo merged 4 commits into
mainfrom
codex/retry-replay-timeout-without-exit

Conversation

@NathanColosimo

@NathanColosimo NathanColosimo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the replay-budget process.exit(1) path with a dedicated ReplayTimeoutRetryError
  • let queue-handler rejection request redelivery in every World, while a durable terminal run_failed write acknowledges the delivery
  • remove the obsolete processExitTriggersQueueRedelivery World capability
  • align newly created Postgres jobs and migrated pg-boss jobs with the existing Core delivery ceiling

Root cause

Core intentionally exited the Node.js process when a replay exceeded its per-invocation budget. On Fluid Compute, multiple requests can share that process, so retrying one workflow delivery terminated unrelated co-resident requests as well. The request crash and replay warning from the incident match this path: request crash, replay warning.

New contract

  1. Replay-timeout attempts 1 through WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES reject the current queue handler with ReplayTimeoutRetryError.
  2. The World queue treats that rejection like any other delivery failure and redelivers the same message with an incremented attempt.
  3. The next attempt writes run_failed with REPLAY_TIMEOUT and returns, which acknowledges the terminal delivery.
  4. If the terminal event write fails, the rejection propagates so the queue retries instead of silently leaving the run nonterminal.
  5. Core never intentionally terminates the host process.

New Postgres jobs now permit delivery 49, where Core records MAX_DELIVERIES_EXCEEDED. Existing Graphile jobs retain the retry limit stored when they were queued; migrated pg-boss jobs are created with the new limit.

Verification

  • pnpm --filter @workflow/core test — 91 files, 1,996 passed and 3 expected failures
  • pnpm --filter @workflow/world-local test — 14 files, 518 passed
  • pnpm --filter @workflow/world-vercel test — 20 files, 362 passed
  • pnpm --filter @workflow/world-postgres test — 5 files, 169 passed
  • builds and typechecks pass for Core, World, world-local, world-vercel, and world-postgres
  • focused red/green coverage verifies Core rejection versus terminal acknowledgement and rejection propagation through local, Vercel, and Postgres queues
  • Simplify review completed with three parallel reviewers
  • Quality Code review completed
  • final Autoreview panel: Codex and Claude both reported zero findings; aggregate verdict patch is correct at 0.96 confidence

Release

This PR targets the v5 beta line on main. The same host-process crash exists in v4 stable, so this correctness fix should be backported through the repository automatic stable backport flow after merge.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 90a3a05

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

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

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

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

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Aug 7, 2026 8:12pm
example-nextjs-workflow-webpack Ready Ready Preview Aug 7, 2026 8:12pm
example-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-astro-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-express-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-fastify-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-hono-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-nestjs-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-nitro-workflow Building Building Preview Aug 7, 2026 8:12pm
workbench-nuxt-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-python-workflow Error Error Aug 7, 2026 8:12pm
workbench-sveltekit-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-tanstack-start-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workbench-vite-workflow Ready Ready Preview Aug 7, 2026 8:12pm
workflow-docs Ready Ready Preview, v0 Aug 7, 2026 8:12pm
workflow-swc-playground Ready Ready Preview Aug 7, 2026 8:12pm
workflow-tarballs Ready Ready Preview Aug 7, 2026 8:12pm
workflow-web Ready Ready Preview Aug 7, 2026 8:12pm

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

E2E Test Summary

Summary
Passed Failed Skipped Total
✅ ▲ Vercel Production 2932 0 500 3432
✅ 💻 Local Development 3290 0 454 3744
✅ 📦 Local Production 3290 0 454 3744
✅ 🐘 Local Postgres 3290 0 454 3744
✅ 🪟 Windows 312 0 0 312
✅ 📋 Other 2068 0 428 2496
✅ vercel-multi-region 27 0 0 27
Total 15209 0 2290 17499
Details by Category

✅ ▲ Vercel Production

App Passed Failed Skipped
✅ astro-node 127 0 29
✅ astro-quickjs 127 0 29
✅ example-node 127 0 29
✅ example-quickjs 127 0 29
✅ express-node 127 0 29
✅ express-quickjs 127 0 29
✅ fastify-node 127 0 29
✅ fastify-quickjs 127 0 29
✅ hono-node 127 0 29
✅ hono-quickjs 127 0 29
✅ nextjs-turbopack-node 152 0 4
✅ nextjs-turbopack-quickjs 152 0 4
✅ nextjs-webpack-node 152 0 4
✅ nextjs-webpack-quickjs 152 0 4
✅ nitro-node 127 0 29
✅ nitro-quickjs 127 0 29
✅ nuxt-node 127 0 29
✅ nuxt-quickjs 127 0 29
✅ sveltekit-node 146 0 10
✅ sveltekit-quickjs 146 0 10
✅ vite-node 127 0 29
✅ vite-quickjs 127 0 29

✅ 💻 Local Development

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

✅ 📦 Local Production

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

✅ 🐘 Local Postgres

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

✅ 🪟 Windows

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

✅ 📋 Other

App Passed Failed Skipped
✅ e2e-local-dev-nest-stable-node 130 0 26
✅ e2e-local-dev-nest-stable-quickjs 130 0 26
✅ e2e-local-dev-tanstack-start-node 130 0 26
✅ e2e-local-dev-tanstack-start-quickjs 130 0 26
✅ e2e-local-postgres-nest-stable-node 130 0 26
✅ e2e-local-postgres-nest-stable-quickjs 130 0 26
✅ e2e-local-postgres-tanstack-start-node 130 0 26
✅ e2e-local-postgres-tanstack-start-quickjs 130 0 26
✅ e2e-local-prod-nest-stable-node 130 0 26
✅ e2e-local-prod-nest-stable-quickjs 130 0 26
✅ e2e-local-prod-tanstack-start-node 130 0 26
✅ e2e-local-prod-tanstack-start-quickjs 130 0 26
✅ e2e-vercel-prod-nest-node 127 0 29
✅ e2e-vercel-prod-nest-quickjs 127 0 29
✅ e2e-vercel-prod-tanstack-start-node 127 0 29
✅ e2e-vercel-prod-tanstack-start-quickjs 127 0 29

✅ vercel-multi-region

App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0

📋 View full workflow run

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 90a3a05 · Fri, 07 Aug 2026 20:25:29 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 1280 (+38%) 🔻 1357 🔴 (+24%) 🔻 1444 🔴 (+23%) 🔻 1494 🔴 (-6.0%) 30
TTFS stream 250 (-75%) 💚 1453 🔴 (+36%) 🔻 1472 🔴 (+36%) 🔻 1557 🔴 (+33%) 🔻 30
TTFS hook + stream 1418 (+13%) 1668 🔴 (+20%) 🔻 1687 🔴 (+14%) 1751 🔴 (-12%) 30
STSO 1020 steps (inline) 102 (+17%) 🔻 132 (+1.5%) 148 (-5.7%) 224 (-3.9%) 1019
WO 1020 steps 133134 (+2.4%) 133134 (+2.4%) 133134 (+2.4%) 133134 (+2.4%) 1
SL stream latency 91 (+9.6%) 117 🔴 (-7.9%) 132 🔴 (-5.0%) 251 🔴 (+72%) 🔻 30
SO stream overhead (text) 108 (+1.9%) 176 (-13%) 194 (-35%) 💚 264 (-93%) 💚 30
SO stream overhead (structured) 119 (-1.7%) 165 (-45%) 💚 200 (-52%) 💚 467 (-77%) 💚 30
📈 STSO distribution vs main (inline / queue-hop histograms)

1020 steps (inline)

Cumulative STSO time: main 128954ms → this run 131559ms (Δ +2605ms, +2%)

 50-100 ms  ┃                         main  14  this   0   -14
100-150 ms  ███████████████████████┃  main 880  this 929   +49
150-200 ms  █┃                        main  95  this  73   -22
200-250 ms  ┃                         main  20  this  11    -9
250-300 ms  ┃                         main   3  this   3    +0
300-350 ms  ┃                         main   5  this   3    -2
350-400 ms  ┃                         main   2  this   0    -2
📜 Previous results (2)

ae3c98d

Fri, 07 Aug 2026 19:32:23 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 1285 (+21%) 🔻 1404 🔴 (+18%) 🔻 1484 🔴 (+18%) 🔻 1777 🔴 (±0%) 30
TTFS stream 245 (-78%) 💚 1393 🔴 (+14%) 1440 🔴 (+13%) 1492 🔴 (+10%) 30
TTFS hook + stream 1529 (+12%) 1700 🔴 (+15%) 1720 🔴 (+12%) 1757 🔴 (+6.2%) 30
STSO 1020 steps (inline) 64 (-48%) 💚 126 (-25%) 💚 146 (-25%) 💚 268 (-23%) 💚 1019
WO 1020 steps 127167 (-24%) 💚 127167 (-24%) 💚 127167 (-24%) 💚 127167 (-24%) 💚 1
SL stream latency 85 (-27%) 💚 107 🔴 (-36%) 💚 120 🔴 (-42%) 💚 165 🔴 (-74%) 💚 30
SO stream overhead (text) 110 (-25%) 💚 152 (-30%) 💚 185 (-33%) 💚 4118 🔴 (+1070%) 🔻 30
SO stream overhead (structured) 104 (-34%) 💚 150 (-39%) 💚 189 (-54%) 💚 275 (-95%) 💚 30

86d2324

Fri, 07 Aug 2026 03:48:52 GMT · run logs

vercel / nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 229 (-68%) 💚 1351 🔴 (+25%) 🔻 1388 🔴 (+25%) 🔻 1425 🔴 (+27%) 🔻 30
TTFS stream 225 (-4.7%) 1380 🔴 (+30%) 🔻 1407 🔴 (+28%) 🔻 1677 🔴 (+50%) 🔻 30
TTFS hook + stream 353 (-20%) 💚 1532 🔴 (+7.9%) 1560 🔴 (+4.2%) 1669 🔴 (-3.3%) 30
STSO 1020 steps (inline) 88 (-20%) 💚 145 (-31%) 💚 167 (-41%) 💚 281 (-46%) 💚 1019
WO 1020 steps 147293 (-28%) 💚 147293 (-28%) 💚 147293 (-28%) 💚 147293 (-28%) 💚 1
SL stream latency 92 (-12%) 144 🔴 (-60%) 💚 178 🔴 (-59%) 💚 667 🔴 (-5.8%) 30
SO stream overhead (text) 125 (-17%) 💚 218 (-30%) 💚 300 (-22%) 💚 756 (+4.6%) 30
SO stream overhead (structured) 118 (-28%) 💚 226 (-17%) 💚 428 (+31%) 🔻 684 (-3.9%) 30
ℹ️ Metric definitions & methodology

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

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

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

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

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · SO 250/500/1000

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

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

@VaguelySerious VaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Nit: think the changesets can be merged into one

@NathanColosimo

Copy link
Copy Markdown
Contributor Author

LGTM. Nit: think the changesets can be merged into one

fixed

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Backport to stable failed for 74dbf81 due to a workflow error (backport job run).

This is usually an infrastructure problem (e.g. the configured AI model could not be found, an AI Gateway error, or an opencode crash) rather than a merge conflict. Check the job logs linked above for details.

Once the underlying issue is fixed, re-run the Backport to stable workflow manually via workflow_dispatch and paste this commit SHA into the ref input:

74dbf81d327b8574cca429b56757c7322a26b4ef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants