Skip to content

[core] Add a retention option to start() - #3787

Merged
VaguelySerious merged 18 commits into
mainfrom
peter/start-retention-option
Sep 8, 2026
Merged

VaguelySerious merged 18 commits into
mainfrom
peter/start-retention-option

Conversation

@VaguelySerious

@VaguelySerious VaguelySerious commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Adds a retention option to start() so callers can express a data-retention preference for after a run completes.

await start(myWorkflow, [args], { retention: 0 });
Set a preference for data retention after run completion.

Worlds control the retention of user data (event payloads and stream chunks),
the event log, and any analytics data. Options are:
- 'default': same as omission, the World will decide. On Vercel, this is based
  on your team's plan.
- 0: if supported, data is deleted immediately after your run completes/fails.
  On Vercel, user data is deleted, but metadata may persist for your plan's
  default retention period.

The value is a duration, and zero is the only one implemented. The unit
durations will be measured in has not been decided yet, and zero is the one
value that means the same thing whichever unit wins - so it can ship ahead of
that decision. Other durations are rejected rather than accepted and quietly
ignored, which is why the type is the literal 0 and not number.

How it works

The option is the typed spelling of a new reserved run attribute, $retention, exported from @workflow/world as RETENTION_ATTRIBUTE. start() seeds it onto the run at creation, alongside the existing $rootRunId / $parentRunId lineage keys, so it costs no extra write and rides both the run_created event and the resilient-start queue input. Worlds read it when a run reaches a terminal state.

Decisions worth reviewing:

  • 'default' writes nothing. The docstring says it is the same as omission, so writing $retention: 'default' would only spend one of the 64 per-run attribute slots to express what an absent key already means. It also keeps retention: 'default' from erroring on a World that predates attributes.
  • The option wins over a hand-written $retention attribute. A caller passing both attributes: { '$retention': ... } (with allowReservedAttributes) and retention: gets the latter. retention is the supported spelling; the raw attribute is the escape hatch. This is the opposite precedence from lineage, where caller attributes win, because lineage is inferred context and retention is an explicit choice.
  • 0 requires spec version 4 or later and throws otherwise, matching how initial attributes behave. Silently dropping a data-deletion preference would be worse than failing.
  • The type is 0 | 'default', not number | 'default'. A caller writing retention: 7 today has no unit to have meant it in, and every World would resolve it to its own default — so the literal type makes it a compile error, and a runtime guard makes it a thrown error for untyped JS callers.
  • No arbitrary-string pass-through. A World with its own retention vocabulary is still reachable through the documented escape hatch: attributes: { '$retention': ... } with allowReservedAttributes.

Server side

The Vercel World implementation reads this attribute at terminal cleanup and deletes S3 ref payloads and stream content instead of tagging them for lifecycle expiration. That is vercel/workflow-server#858. Until it ships, $retention: '0' is recorded on the run and otherwise inert, which is the safe failure mode: data keeps the plan's retention.

Other Worlds ignore the attribute entirely today.

Test plan

New unit tests in packages/core/src/runtime/start-retention.test.ts (9 cases): the 0 -> '0' encoding and the reserved-namespace opt-in on both creation paths, 'default' being byte-identical to omission, coexistence with lineage and caller attributes, precedence over a hand-written attribute, the reserved-key rejection still firing without the escape hatch, the spec-version gate (and 'default' not tripping it), and the runtime guard rejecting a non-zero duration and a string from an untyped caller.

start.test.ts and start-lineage.test.ts pass unchanged.


Update (2026-08-27): wire value is 0, not 'none'

Amending this draft to match the server contract that landed in vercel/workflow-server#858. The body above has been corrected in place; this section records what changed and why. The original design — the $ namespace opt-in, the option beating a hand-written $retention, the reserved-key rejection without the escape hatch, and the spec-version-4 requirement — is unchanged.

The server no longer honors 'none'. $retention is read as a duration written as a decimal integer, and the only value implemented is the string '0'. Anything else — 'none' included — resolves to the plan default and increments a retention.unsupported{reason:malformed} counter. Left as it was, this PR and the server would have disagreed and the feature would have been inert.

The unit is deliberately not decided yet. It will most likely be seconds or milliseconds, chosen for granularity, and explicitly not days. Zero is the one value that means the same thing in every unit, which is exactly why it can ship ahead of that decision: it commits to a shape — a number, so the namespace has somewhere to grow — without committing to a scale. Nothing in the option, the docs or the wire format names a unit, and nothing should until that call is made.

So the public option takes a number, typed as the literal 0:

start({ retention }) $retention attribute
0 '0'
'default' not written (identical to omission)
omitted not written

0 | 'default' rather than number | 'default' is load-bearing: it is what stops someone writing retention: 7, meaning seven of something, and silently getting the World's default. Untyped JS callers hit a runtime guard with the same message.

Dropped from the original design:

  • The arbitrary-string pass-through, and its '90d' test. That example baked in a unit, which is the one thing this field must not do. Worlds with their own retention vocabulary still have the attributes + allowReservedAttributes escape hatch, which this PR already documents as the raw spelling.
  • The empty-value and max-byte-length checks on the option. With the value fixed to a one-byte '0' neither can fail, so they were dead branches rather than guards.

Verified: pnpm typecheck at the repo root (43/43 tasks), pnpm lint (no new diagnostics), @workflow/core unit suite (2283 passed, 3 expected-fail, 1 skipped), @workflow/world unit suite (165 passed).

e2e coverage for the purge itself

The unit tests only prove the SDK sends $retention: '0'. Added e2e > retention > retention: 0 purges the run payloads once the run finishes in packages/core/e2e/e2e.test.ts, which proves the data is afterwards gone: start addTenWorkflow with retention: 0, assert the real payloads, then poll until the run and step payloads read back as <data expired> and the run's expiredAt is in the past. The run itself is asserted to survive — only user data goes, so it stays listable in observability.

Gated on WORKFLOW_VERCEL_ENV, not !isLocalDeployment(): only the Vercel World implements the terminal-cleanup pass, and the latter predicate is also true for the Postgres lane.

Which server this runs against. The four Vercel e2e lanes set VERCEL_WORKFLOW_SERVER_URL from a secret on PRs and leave it empty on main (.github/workflows/tests.yml:482-487). That secret points at e2e.vercel-workflow.com — a Vercel custom environment on the workflow-server production project that tracks workflow-server main HEAD, currently serving 98c48763 (#858). So this test is meaningful on the PR. On main the empty value falls back to https://vercel-workflow.com (packages/world-vercel/src/utils.ts:260-261) — production, which trails the e2e environment by roughly 20 minutes and does not yet contain #858. Worth confirming production has picked it up before merging, or the first main run of this test can fail spuriously. The same applies to changeset-release/* PRs, which deliberately get the empty value.

🤖 Generated with Claude Code

Adds `start({ retention })` for expressing a data-retention preference for
after a run completes. It is the typed spelling of a new reserved
`$retention` run attribute, which Worlds read at terminal cleanup.

- 'default' is not written at all, so it stays exactly equivalent to
  omitting the option and spends none of the per-run attribute budget.
- 'none' and custom World-specific strings are seeded onto the run, with
  the reserved-namespace opt-in set so the server accepts the `$` key.
- The value goes through the same validation as caller attributes, so an
  oversized custom value fails in start() rather than at the World boundary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 19f858d

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

This PR includes changesets to release 21 packages
Name Type
@workflow/core Minor
@workflow/errors Minor
@workflow/world Minor
@workflow/world-local Minor
@workflow/world-postgres Minor
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/web-shared Patch
@workflow/web Patch
workflow Minor
@workflow/world-testing Patch
@workflow/world-vercel 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 25, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 19f858d · Tue, 08 Sep 2026 20:09:51 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 258 (+31%) 🔻 1248 🔴 (+17%) 🔻 1271 🔴 (+17%) 🔻 1372 🔴 (+14%) 30
TTFS stream 229 (+30%) 🔻 1263 🔴 (+25%) 🔻 1286 🔴 (+25%) 🔻 1303 🔴 (+26%) 🔻 30
TTFS hook + stream 1434 (+34%) 🔻 1600 🔴 (+35%) 🔻 1816 🔴 (+42%) 🔻 2046 🔴 (+3.3%) 30
Fan-out TTFS Promise.all(100 steps) 533 (-10%) 900 (-48%) 💚 1003 (-43%) 💚 1886 (+2.7%) 10
Fan-out TTLS Promise.all(100 steps) 1794 (+14%) 2475 (-35%) 💚 2708 (-32%) 💚 4452 (-59%) 💚 10
STSO 1020 steps (inline) 107 (+3.9%) 126 (-11%) 147 (-11%) 206 (-32%) 💚 1019
WO 1020 steps 128524 (-13%) 128524 (-13%) 128524 (-13%) 128524 (-13%) 1
CRTT first chunk (pooled) 53 (-18%) 💚 87 (-35%) 💚 107 (-40%) 💚 440 (+61%) 🔻 28

Streams

Scenario CRTT 1st p75 p90 p99 CDV max iters
paced control (100/s, 60B) 61 (-30%) 132 (-15%) 195 (-12%) 582 (+46%) 97.5 (-38%) 10
size sweep (100/s, 160B-12KB) 79.5 (-18%) 130 (-51%) 161 (-68%) 676 (-28%) 100 (-59%) 10
replay gateway-gpt-5.4-nano-2000t (1x) 107 (+4%) 112 (-37%) 140 (-58%) 232 (-65%) 136 (-58%) 3
replay eve-gpt-5.6-sol-2000t (1x) 76.5 (-54%) 117 (-23%) 151 (-25%) 656 (+59%) 346 (-11%) 2
replay eve-gpt-5.6-sol-2000t (2x) 80 (-42%) 153 (-38%) 232 (-34%) 641 (+27%) 263 (-29%) 3
📈 STSO distribution vs main (inline / queue-hop histograms)

1020 steps (inline)

Cumulative STSO time: main 147324ms → this run 128373ms (Δ -18951ms, -13%)

  100-150 ms  █████████████████████░░┃  main 819  this 935  +116
  150-200 ms  █┃██                      main 159  this  73   -86
  200-250 ms  ┃                         main  23  this   8   -15
  250-300 ms  ┃                         main   7  this   1    -6
  300-350 ms  ┃                         main   4  this   2    -2
  350-400 ms  ┃                         main   2  this   0    -2
  400-450 ms  ┃                         main   1  this   0    -1
  450-500 ms  ┃                         main   2  this   0    -2
  500-550 ms  ┃                         main   1  this   0    -1
3750-3800 ms  ┃                         main   1  this   0    -1
📈 CRTT drill-down vs main (RTT distributions & profiles)
variant  RTT 1ms→5s+             avg         p50         p90         p99     n
control  ······█▇▁▁···  108.6 (-16%)   95 (-22%)  195 (-12%)  582 (+46%)  3000
sweep    ······▇█▁▁···  112.5 (-38%)  100 (-26%)  161 (-68%)  676 (-28%)  3000
gw 1x    ·····▁█▆▁····   98.9 (-33%)   95 (-25%)  140 (-58%)  232 (-65%)  5295
eve 1x   ·····▁█▆▁▁···  106.4 (-20%)   92 (-21%)  151 (-25%)  656 (+59%)  5186
eve 2x   ·····▁▅█▂▁···  131.6 (-31%)  116 (-32%)  232 (-34%)  641 (+27%)  7779

RTT over stream progress (avg per tenth of stream, bars scaled min→max):

control  █▄▄▂▂▂▂▁▂▁  93–155ms
sweep    ▇▄▂▁▁▃▂▁▄█  98–139ms
gw 1x    █▃▃█▆▇▃▁▁▁  93–106ms
eve 1x   ▂▁▂▂▁█▅▅▂▁  88–153ms
eve 2x   ▁▁▂▃▂▂▄█▃▃  100–217ms

RTT by chunk size (avg per log size bin, ~160B → ~12KB serialized, bars scaled min→max):

sweep  ▂█▇▅▄▂▁  110–115ms

Delivery jitter over stream progress (avg positive CDV per tenth of stream, bars scaled min→max):

control  █▂▅▄▂▅▂▁▅▁  27–37ms
sweep    ▁▆▅▄▅▅▄▂█▂  37–53ms
gw 1x    ▇▅▃▃█▇▄▆▁▃  25–31ms
eve 1x   ▃▂▁▁▂▇██▂▃  18–26ms
eve 2x   ▃▁▂▄▄▃█▄▂▇  17–27ms
ℹ️ Metric definitions & methodology

Streams: first-chunk RTT (the stream-open path, before any buffering/backpressure), CRTT percentiles, and worst delivery stall (CDV max). Cells are medians across iterations; per-run values in the artifacts. No 🔴/🟢 marks until targets attach.

The collapsed STSO distribution section above buckets every step gap, split inline (same warm process — pure framework overhead) vs queue-hop (fresh process — dispatch, reinit, replay). █ = main, ┃ = this run, ░ = fill.

The collapsed CRTT drill-down: per-variant RTT histograms (fixed log bins, · = empty) and mean RTT/positive-CDV profile lines over stream progress and chunk size. Histograms, avgs, and profiles merge exactly across runs; p50–p99 are percentile-of-percentiles. Per-index rows live in the artifacts.

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) · Fan-out TTFS: fan-out time to first step (in-deployment start() → first of the parallel step bodies to complete) · Fan-out TTLS: fan-out time to last step (in-deployment start() → last of the parallel step bodies to complete, i.e. when the Promise.all resolves) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored) · CRTT: chunk round-trip time (per-chunk write → read latency, one clock domain: deployment → stream backend → same deployment) · CDV: chunk delay variation / delivery jitter (inter-arrival gap minus inter-write gap per seq-adjacent pair; skew-free; the row is each run's MAX positive value, so one stall moves it)

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 · Promise.all(100 steps): 100 trivial no-op steps started together in a single Promise.all; Fan-out TTFS is the first of them to complete and Fan-out TTLS the last, both from the in-deployment clientStart, so their gap is the spread the runtime adds across the fan-out · paced control (100/s, 60B): the control: 300 tiny (~60B) deltas metronome-paced at 100/s — zero workload structure, so it reads the transport floor and flush cadence, and disambiguates transport-wide vs workload-specific when a replay row moves · size sweep (100/s, 160B-12KB): same pacing as the control with deltas padded in rotation across seven log-spaced sizes (~160B–12KB) — rotation decouples size from stream position, so it isolates whether chunk size causes latency · replay gateway-gpt-5.4-nano-2000t (1x): raw provider SSE cadence captured at the AI gateway boundary (gpt-5.4-nano, the most popular gateway model; per-token deltas p50 208B = the modal production chunk size), replayed exactly as measured — the typical customer's workload; its CDV is the typical customer's real delivery jitter · replay eve-gpt-5.6-sol-2000t (1x): a captured eve turn (gpt-5.6-sol, the most-used demanding eve model; ~2000 output tokens = production p50 turn length) replayed exactly as measured — eve's envelope protocol re-ships the cumulative message so sizes ramp 142B→13KB; the demanding outlier tenant's reality · replay eve-gpt-5.6-sol-2000t (2x): the same eve capture at 2x — the headroom/stress row; real fast-tier models emit the same chunk sizes at proportionally higher rate, so time compression is a faithful speed model · first chunk (pooled): every run's seq-0 RTT pooled across all stream scenarios — the first chunk precedes any workload differentiation, so pooling samples one shared stream-open path with exact percentiles

Replay cadences (semantic sha256) — eve-gpt-5.6-sol-2000t eaf22f5946e7c61f3c65c7006d550df180cfabd4e706254a09f22aec0cfb420d · gateway-gpt-5.4-nano-2000t 6f24ac518b6b83ff1d0e85a5fe78230db192716d66a7fc6b2fe022752001d041

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600

All timestamps are deployment-side; runs are triggered in-deployment, so the CI runner and api.vercel.com sit outside every measured window. TTFS = start() → first step body (includes dispatch + any cold start); Fan-out TTFS/TTLS = first/last step completion of one Promise.all from the same anchor (the gap is the runtime’s fan-out spread); STSO/WO between step bodies; CRTT inside the workflow (excludes the api.vercel.com read path).

Cold starts stay in the numbers (real bursty-workload latency, inflates P75+); Best is the warm floor.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

✅ All tests passed

⚠️ Flaky E2E Tests (passed on retry)

These tests failed at least once and passed on a retry. A recurring entry here is a real race worth investigating.

  • no startIndex (reads all chunks) (express)
  • promiseAllWorkflow (tanstack-start)
  • wellKnownAgentWorkflow (.well-known/agent) (nextjs-turbopack)

🛠 Infra Events (absorbed by the harness)

Platform anomalies the e2e harness detected and worked around (e.g. a run the queue never picked up, replaced by a fresh run). Clustered timestamps indicate a backend blip; a steady drip indicates a platform issue worth escalating.

  • cold-start-warmup · suite warmup (tanstack-start) · at 19:58:25Z · abandoned wrun_01M219JHPHEE3DX7N142G0YMNZ
  • run-pickup-stall · hookCleanupTestWorkflow - hook token reuse after workflow completion (nextjs-webpack) · at 20:02:21Z · abandoned wrun_01M219T3WECF5C0Q3W19P38G3R
  • run-pickup-stall · concurrent hook token conflict - two workflows cannot use the same hook token simultaneously (nextjs-webpack) · at 20:02:22Z · abandoned wrun_01M219T4Y70FPPM2M2AC26PZHJ

E2E Test Summary

Summary
Passed Failed Skipped Total
✅ ▲ Vercel Production 3662 0 685 4347
✅ 💻 Local Development 3922 0 586 4508
✅ 📦 Local Production 3922 0 586 4508
✅ 🐘 Local Postgres 3922 0 586 4508
✅ 🪟 Windows 320 0 2 322
✅ 🌐 Cross-language Conformance 68 0 74 142
✅ vercel-http-transport 823 0 143 966
✅ vercel-multi-region 27 0 0 27
✅ vercel-ws-transport 557 0 87 644
Total 17223 0 2749 19972
Details by Category

✅ ▲ Vercel Production

App Passed Failed Skipped
✅ astro-node 133 0 28
✅ astro-quickjs 133 0 28
✅ example-node 133 0 28
✅ example-quickjs 133 0 28
✅ express-node 133 0 28
✅ express-quickjs 133 0 28
✅ fastify-node 133 0 28
✅ fastify-quickjs 133 0 28
✅ hono-node 133 0 28
✅ hono-quickjs 133 0 28
✅ nest-node 133 0 28
✅ nest-quickjs 133 0 28
✅ nextjs-turbopack-node 158 0 3
✅ nextjs-turbopack-quickjs 158 0 3
✅ nextjs-webpack-node 158 0 3
✅ nextjs-webpack-quickjs 158 0 3
✅ nitro-node 133 0 28
✅ nitro-quickjs 133 0 28
✅ nuxt-node 133 0 28
✅ nuxt-quickjs 133 0 28
✅ python-node 66 0 95
✅ sveltekit-node 152 0 9
✅ sveltekit-quickjs 152 0 9
✅ tanstack-start-node 133 0 28
✅ tanstack-start-quickjs 133 0 28
✅ vite-node 133 0 28
✅ vite-quickjs 133 0 28

✅ 💻 Local Development

App Passed Failed Skipped
✅ astro-stable-node 134 0 27
✅ astro-stable-quickjs 134 0 27
✅ express-stable-node 134 0 27
✅ express-stable-quickjs 134 0 27
✅ fastify-stable-node 134 0 27
✅ fastify-stable-quickjs 134 0 27
✅ hono-stable-node 134 0 27
✅ hono-stable-quickjs 134 0 27
✅ nest-stable-node 134 0 27
✅ nest-stable-quickjs 134 0 27
✅ nextjs-turbopack-canary-node 141 0 20
✅ nextjs-turbopack-canary-quickjs 141 0 20
✅ nextjs-turbopack-stable-node 160 0 1
✅ nextjs-turbopack-stable-quickjs 160 0 1
✅ nextjs-webpack-canary-node 141 0 20
✅ nextjs-webpack-canary-quickjs 141 0 20
✅ nextjs-webpack-stable-node 160 0 1
✅ nextjs-webpack-stable-quickjs 160 0 1
✅ nitro-stable-node 134 0 27
✅ nitro-stable-quickjs 134 0 27
✅ nuxt-stable-node 134 0 27
✅ nuxt-stable-quickjs 134 0 27
✅ sveltekit-stable-node 153 0 8
✅ sveltekit-stable-quickjs 153 0 8
✅ tanstack-start-node 134 0 27
✅ tanstack-start-quickjs 134 0 27
✅ vite-stable-node 134 0 27
✅ vite-stable-quickjs 134 0 27

✅ 📦 Local Production

App Passed Failed Skipped
✅ astro-stable-node 134 0 27
✅ astro-stable-quickjs 134 0 27
✅ express-stable-node 134 0 27
✅ express-stable-quickjs 134 0 27
✅ fastify-stable-node 134 0 27
✅ fastify-stable-quickjs 134 0 27
✅ hono-stable-node 134 0 27
✅ hono-stable-quickjs 134 0 27
✅ nest-stable-node 134 0 27
✅ nest-stable-quickjs 134 0 27
✅ nextjs-turbopack-canary-node 141 0 20
✅ nextjs-turbopack-canary-quickjs 141 0 20
✅ nextjs-turbopack-stable-node 160 0 1
✅ nextjs-turbopack-stable-quickjs 160 0 1
✅ nextjs-webpack-canary-node 141 0 20
✅ nextjs-webpack-canary-quickjs 141 0 20
✅ nextjs-webpack-stable-node 160 0 1
✅ nextjs-webpack-stable-quickjs 160 0 1
✅ nitro-stable-node 134 0 27
✅ nitro-stable-quickjs 134 0 27
✅ nuxt-stable-node 134 0 27
✅ nuxt-stable-quickjs 134 0 27
✅ sveltekit-stable-node 153 0 8
✅ sveltekit-stable-quickjs 153 0 8
✅ tanstack-start-node 134 0 27
✅ tanstack-start-quickjs 134 0 27
✅ vite-stable-node 134 0 27
✅ vite-stable-quickjs 134 0 27

✅ 🐘 Local Postgres

App Passed Failed Skipped
✅ astro-stable-node 134 0 27
✅ astro-stable-quickjs 134 0 27
✅ express-stable-node 134 0 27
✅ express-stable-quickjs 134 0 27
✅ fastify-stable-node 134 0 27
✅ fastify-stable-quickjs 134 0 27
✅ hono-stable-node 134 0 27
✅ hono-stable-quickjs 134 0 27
✅ nest-stable-node 134 0 27
✅ nest-stable-quickjs 134 0 27
✅ nextjs-turbopack-canary-node 141 0 20
✅ nextjs-turbopack-canary-quickjs 141 0 20
✅ nextjs-turbopack-stable-node 160 0 1
✅ nextjs-turbopack-stable-quickjs 160 0 1
✅ nextjs-webpack-canary-node 141 0 20
✅ nextjs-webpack-canary-quickjs 141 0 20
✅ nextjs-webpack-stable-node 160 0 1
✅ nextjs-webpack-stable-quickjs 160 0 1
✅ nitro-stable-node 134 0 27
✅ nitro-stable-quickjs 134 0 27
✅ nuxt-stable-node 134 0 27
✅ nuxt-stable-quickjs 134 0 27
✅ sveltekit-stable-node 153 0 8
✅ sveltekit-stable-quickjs 153 0 8
✅ tanstack-start-node 134 0 27
✅ tanstack-start-quickjs 134 0 27
✅ vite-stable-node 134 0 27
✅ vite-stable-quickjs 134 0 27

✅ 🪟 Windows

App Passed Failed Skipped
✅ nextjs-turbopack-node 160 0 1
✅ nextjs-turbopack-quickjs 160 0 1

✅ 🌐 Cross-language Conformance

App Passed Failed Skipped
✅ python 68 0 74

✅ vercel-http-transport

App Passed Failed Skipped
✅ example 133 0 28
✅ express 133 0 28
✅ hono 133 0 28
✅ nextjs-turbopack 158 0 3
✅ nitro 133 0 28
✅ vite 133 0 28

✅ vercel-multi-region

App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0

✅ vercel-ws-transport

App Passed Failed Skipped
✅ example 133 0 28
✅ express 133 0 28
✅ nextjs-turbopack 158 0 3
✅ vite 133 0 28

📋 View full workflow run

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Sim World

Simulated world deterministic testing for races. Traces

🟠 world-sim scenario book — 1 fail of 41 total

fence=per-spec

scenario outcome events virt replay violations
✅ smoke-no-steps completed 3 0ms ok 0
✅ smoke-one-step completed 6 0ms ok 0
✅ hook-at-step-started completed 12 0ms ok 0
✅ hook-at-step-completed completed 12 0ms ok 0
✅ hook-at-hook-created completed 12 0ms ok 0
✅ deadline-hook-wins completed 7 1.0h ok 0
✅ deadline-expires completed 7 1.0h ok 0
✅ long-sleep completed 11 30.0d ok 0
✅ hook-never-arrives stalled 3 0ms skipped 0
✅ step-retries-twice completed 10 2.0s ok 0
✅ parallel-steps completed 9 0ms ok 0
✅ hook-on-execution-state completed 12 0ms ok 0
✅ peek-hook-before-branch completed 12 0ms ok 0
✅ peek-hook-after-branch completed 12 0ms ok 0
✅ peek-hook-at-registration completed 12 0ms ok 0
✅ race-hook-before-probe completed 12 0ms ok 0
✅ race-hook-after-probe completed 12 0ms ok 0
✅ race-duplicate-delivery completed 13 0ms ok 0
✅ attr-hook-before-step completed 11 0ms ok 0
✅ attr-hook-after-step completed 11 0ms ok 0
✅ attr-from-step-body completed 13 0ms ok 0
✅ fork-hook-after-timeout completed 14 1.0m ok 0
✅ fork-hook-before-timeout completed 14 1.0m ok 0
✅ count-hook-after-timeout completed 17 1.0m ok 0
✅ count-hook-before-timeout completed 20 1.0m ok 0
✅ stale-read-step-count-fork completed 20 1.0m ok 0
✅ stale-read-equal-step-counts completed 14 1.0m ok 0
✅ step-vs-step-fork completed 12 0ms ok 0
✅ step-vs-step-fork-fenced completed 12 0ms ok 0
✅ fence-catches-benign-direction completed 12 5ms ok 0
✅ in-flight-before-decision completed 17 1.0m ok 0
❌ in-flight-before-decision-counted completed 17 1.0m ok 0
✅ in-flight-after-decision completed 19 2.0m ok 0
✅ stale-read-step-count-fork-fenced completed 20 1.0m ok 0
✅ fork-hook-wins completed 13 1.0m ok 0
✅ fork-timeout-wins completed 13 1.0m ok 0
✅ unclaimed-payload-under-fork completed 17 1.0m ok 0
✅ claimed-payload-under-fork completed 17 1.0m ok 0
✅ writers-independent-step-bodies completed 12 0ms ok 0
✅ writers-scripted-tempo completed 12 0ms ok 0
✅ cancel-mid-step cancelled 7 0ms skipped 0

Full trace: world-sim.txt

@pranaygp

pranaygp commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

DX nits: would prefer {retention: <same string/number/date format as sleeps>})
otherwise this is a good idea. implementing it as a reserved attribute (but with this additional user facing option for the type defintion and docstring) seems really good. everything gets wired for free as the attribute is visible in o11y during the run.

will need to also enforce verification for retenion (for ex. what happens if the run is requesting larger retention than the team's plan supports? we can't reject the lazy start run without introducing server round trip for validation - so the run would have to be either failed, or the requested retention just gets overridden by server to Math.max(plan_retention, requested retenion) at POST run_started` time).

The server reads `$retention` as a duration written as a decimal integer,
not as the name of a mode: it honors the string `'0'`, and resolves
everything else — `'none'` included — to the plan default while counting it
as `retention.unsupported`. As written the two halves disagreed and the
option would have been inert, so the wire value moves to `'0'`.

The unit that duration is measured in has deliberately not been decided
yet. It will most likely be seconds or milliseconds, chosen for
granularity, and explicitly not days. Zero is the one value that means the
same thing in every unit, which is exactly why it can ship ahead of that
decision: it commits to a shape — a number, so the namespace has somewhere
to grow — without committing to a scale.

That is also why the option is typed `0 | 'default'` rather than
`number | 'default'`. Someone writing `retention: 7` today has no unit to
have meant it in, and the server would quietly keep their data; the literal
type makes that a compile error, and a runtime guard makes it a thrown
error for untyped JS callers. The arbitrary-string pass-through goes for
the same reason — its only example, `'90d'`, baked in a unit — and callers
targeting a World with its own retention vocabulary still have the
documented escape hatch of writing `$retention` through `attributes` with
`allowReservedAttributes`.

With arbitrary strings gone, the empty-value and max-byte-length checks are
unreachable (a fixed one-byte value cannot fail either), so they go too
rather than sit as dead branches.
pranaygp and others added 8 commits August 28, 2026 12:29
* origin/retention-postgres-world:
  [world-postgres] Honor $retention: 0 when a run finishes
* origin/retention-local-world:
  [world-local] Implement zero retention
Both World implementations arrived with their own copy of the $retention
resolver, written independently against the same spec. They agreed today —
same regex, same near-miss handling — but two hand-written parsers of a
delete-or-keep predicate is a standing drift risk, and drift here means one
World deleting a run another keeps.

So the resolver moves to @workflow/world beside RETENTION_ATTRIBUTE, which
already lived there, and both Worlds call it. world-local keeps its wrapper
because it adds something real: a dev-server warning on an unrecognized
value, which is where a developer can still notice an SDK sending a dialect
this version predates.

The parser's tests move with it, and gain coverage for the convenience
predicate the Worlds actually call. They belong with the shared code, not
with whichever World happened to be written first.

Also adds the two missing changesets: world-postgres had none, so its
implementation would not have shipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both Worlds also handle streams, and the Postgres purge is transactional —
worth saying, since the whole page is about what guarantee you actually get.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The test pads its input past the inline-ref cutoff so the World writes a real blob to delete, which also crosses the JS client's compression threshold. The Python SDK cannot read zstd, so the run fails during input deserialization.
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Comment thread packages/core/src/runtime/start.ts Outdated
Comment thread packages/core/src/runtime/start.ts Outdated
Comment thread packages/core/src/runtime/start.ts Outdated
Comment thread docs/content/docs/v5/errors/run-expired.mdx Outdated
Comment thread docs/content/docs/v5/errors/run-expired.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Comment thread docs/content/docs/v5/observability/retention.mdx Outdated
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

No backport to stable for 61fb1f9 (AI decision).

This commit adds a brand-new public API surface — the experimental_retention option on start(), the $retention reserved attribute plus new exports from @workflow/world, and terminal-purge implementations in the Local and Postgres Worlds — carrying a minor changeset. It also changes existing behavior in a non-defect way (await run.returnValue now throws RunExpiredError on expired runs instead of resolving, and RunExpiredError gains new constructor fields/status), which is feature work rather than a stability fix. Nothing here fixes a bug present on stable, so it belongs on main only.

To override, re-run the Backport to stable workflow manually via workflow_dispatch and paste this commit SHA into the ref input:

61fb1f93bd914ae6f62e6f7926f9b9ea37a870dd

This branch was successfully deployed

18 active (1 outdated) deployments
Preview – workflow-docs — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-vite-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-nuxt-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-nitro-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-sveltekit-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – example-nextjs-workflow-turbopack — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – example-nextjs-workflow-webpack — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-astro-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – example-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-express-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-tanstack-start-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-fastify-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-hono-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workflow-tarballs — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-nestjs-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workflow-web — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workbench-python-workflow — 19f858dc Deployed Sep 8, 2026 by vercel[bot]
Preview – workflow-swc-playground — 2d1c8487 Deployed Sep 8, 2026 by vercel[bot]
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