Skip to content

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

@VaguelySerious@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
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;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Default WORKFLOW_PRECONDITION_GUARD on by VaguelySerious · Pull Request #2946 · vercel/workflow · GitHub
Skip to content

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

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

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

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

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

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

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

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

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

@VaguelySerious@TooTallNate
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Default WORKFLOW_PRECONDITION_GUARD on by VaguelySerious · Pull Request #2946 · vercel/workflow · GitHub
Skip to content

Default WORKFLOW_PRECONDITION_GUARD on - #2946

Merged
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup
Jul 21, 2026
Merged

Default WORKFLOW_PRECONDITION_GUARD on#2946
VaguelySerious merged 6 commits into
mainfrom
peter/precondition-guard-followup

Conversation

@VaguelySerious

@VaguelySeriousVaguelySerious commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #2266. Two things:

  1. WORKFLOW_PRECONDITION_GUARD is now on by default. The event-creation guard was opt-in; it now runs unless explicitly disabled with WORKFLOW_PRECONDITION_GUARD=0. Backends that don't support the guard ignore the stateUpdatedAt snapshot, so this is backward-compatible and fails open. Validated by the Add stateUpdatedAt precondition guard to event creation #2266 race-repro (2000 runs guard-on: 0 CORRUPTED_EVENT_LOG, 13.8% of runs hit a 412 and recovered).

  2. Addresses the non-blocking feedback from this review

Review items addressed

  • Env-var parsing footgundeferred to a separate PR. Accepting the common truthy/falsy spellings (1/true/yes/on, 0/false/no/off) instead of only 1 will ship on its own, so this PR leaves the flag parsing (and @workflow/builders / @workflow/world-vercel) untouched.
  • run_failed asymmetry — added a comment documenting why the terminal run_failed is intentionally not guarded like run_completed (fail-open: a spurious failure is re-runnable, a spurious completion commits a wrong result; and the loaded event log isn't in scope on that catch path). Guarding it symmetrically would be a larger change — happy to do it as its own follow-up if preferred.
  • World-authoring docs gapCreateEventParams.stateUpdatedAt JSDoc now documents the backend contract (which events advance the per-run marker, strictly-older rejects, equal-passes anti-livelock) so custom-World authors have something to implement against.
  • Concurrent-reload cursor — comment on the benign last-write-wins cursor in withPreconditionRetry.
  • Silent disarm diagnosticsruntimeLogger.debug when a non-decodable event id disarms the guard for a create.
  • retryAfter nit — JSDoc noting it's forward-compat and currently unread by the runtime.

Follow-up to #2266 (review pullrequestreview-4699625704).
- **Guard on by default:** `isPreconditionGuardEnabled()` now returns true
unless `WORKFLOW_PRECONDITION_GUARD` is explicitly falsy. Validated by the
#2266 race-repro (2000 runs guard-on: 0 corruptions).
- **Env-var footgun:** boolean flags accept `1`/`true`/`yes`/`on` (and
`0`/`false`/`no`/`off` for the guard's opt-out) case-insensitively instead of
only `1`, so `=true` no longer silently reads as off. Mirrored across
`isPreconditionGuardEnabled` (core) and `isSequentialReplaysEnabled`
(builders + world-vercel).
- **run_failed asymmetry:** comment documenting why the terminal `run_failed`
is intentionally not guarded (fail-open, re-runnable) unlike `run_completed`.
- **Concurrent-reload cursor:** comment on the benign last-write-wins cursor in
withPreconditionRetry.
- **World-authoring docs:** CreateEventParams.stateUpdatedAt JSDoc now documents
the backend marker/reject/equal-passes contract for custom-world authors.
- **Diagnostics:** debug log when a non-decodable event id disarms the guard.
- **retryAfter:** JSDoc noting it is forward-compat and currently unused.
- Docs: runtime-tuning guard entry updated to "Default: enabled" + opt-out.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested review from a team and ijjk as code ownersJuly 15, 2026 19:36
@changeset-bot

changeset-botBot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17ec74f

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/worldPatch
@workflow/errorsPatch
@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/world-vercelPatch
@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

@vercel

vercelBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 17ec74f · Tue, 21 Jul 2026 16:25:15 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep303 (+21%) 🔻1284 🔴 (-5.7%)1293 🔴 (-7.8%)1418 🔴 (-5.2%)30
TTFSstream1197 (+360%) 🔻1249 🔴 (-7.6%)1273 🔴 (-7.4%)1316 🔴 (-10%)30
TTFShook + stream468 (+33%) 🔻1541 🔴 (±0%)1587 🔴 (+0.6%)1639 🔴 (-6.9%)30
STSO1020 steps (1-20)177 (-3.3%)283 🔴 (-17%) 💚310 🔴 (-20%) 💚504 🔴 (-29%) 💚19
STSO1020 steps (101-120)187 (-5.6%)238 🔴 (-19%) 💚289 🔴 (-21%) 💚381 🔴 (-20%) 💚19
STSO1020 steps (1001-1020)462 (-13%)539 🔴 (-15%)680 🔴 (-4.1%)3375 🔴 (+307%) 🔻19
WO1020 steps373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)373253 (-8.1%)1
SLstream latency89 (-3.3%)146 🔴 (-16%) 💚153 🔴 (-27%) 💚331 🔴 (+34%) 🔻30
📜 Previous results (4)

cf4bdba

Mon, 20 Jul 2026 21:10:52 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1265 (+19%) 🔻1389 🔴 (+15%) 🔻1441 🔴 (+16%) 🔻1554 🔴 (-9.1%)30
TTFSstream360 (+1.1%)1335 🔴 (+24%) 🔻1388 🔴 (+22%) 🔻1552 🔴 (+25%) 🔻30
TTFShook + stream1532 (+211%) 🔻1690 🔴 (+19%) 🔻1776 🔴 (+10%)1911 🔴 (-38%) 💚30
STSO1020 steps (1-20)183 (-13%)312 🔴 (-1.3%)362 🔴 (-12%)445 🔴 (-6.7%)19
STSO1020 steps (101-120)222 (+1.8%)275 🔴 (-10%)343 🔴 (-1.7%)908 🔴 (+149%) 🔻19
STSO1020 steps (1001-1020)463 (-6.1%)551 🔴 (-12%)586 🔴 (-18%) 💚592 🔴 (-26%) 💚19
WO1020 steps428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)428613 (-6.2%)1
SLstream latency105 (+15%) 🔻188 🔴 (+4.4%)223 🔴 (-9.0%)351 🔴 (-33%) 💚30

ae65171

Sat, 18 Jul 2026 00:21:01 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1334 🔴1366 🔴1442 🔴30
TTFSstream1330 🔴1358 🔴1384 🔴30
TTFShook + stream1593 🔴1626 🔴1943 🔴30
STSO1020 steps (1-20)275 🔴303 🔴426 🔴19
STSO1020 steps (101-120)293 🔴353 🔴2119 🔴19
STSO1020 steps (1001-1020)585 🔴620 🔴677 🔴19
WO1020 steps4115124115124115121
SLstream latency192 🔴244 🔴378 🔴30

304f594

Wed, 15 Jul 2026 20:54:37 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1647 🔴1663 🔴1801 🔴30
TTFShook + stream1956 🔴2031 🔴2137 🔴30
STSO1020 steps (1-20)377 🔴515 🔴678 🔴19
STSO1020 steps (101-120)577 🔴625 🔴630 🔴19
STSO1020 steps (1001-1020)1123 🔴1217 🔴4432 🔴19
WOstream16471663180130
WOhook + stream19562031213730
SLstream5513 🔴5554 🔴5825 🔴30
SLhook + stream5333 🔴5581 🔴6739 🔴30

45a9425

Wed, 15 Jul 2026 19:57:19 GMT · run logs

vercel / nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstream1708 🔴1745 🔴1945 🔴30
TTFShook + stream1944 🔴1998 🔴2086 🔴30
STSO1020 steps (1-20)353 🔴439 🔴653 🔴19
STSO1020 steps (101-120)461 🔴620 🔴658 🔴19
STSO1020 steps (1001-1020)1059 🔴1077 🔴1413 🔴19
WOstream17081745194530
WOhook + stream19441998208630
SLstream4754 🔴5673 🔴5755 🔴30
SLhook + stream5232 🔴5478 🔴5871 🔴30

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)

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)

🔴 marks a percentile over its target (within target is left unmarked). Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120

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

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

@github-actions

github-actionsBot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

All tests passed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production145502391694
✅ 💻 Local Development162102271848
✅ 📦 Local Production162102271848
✅ 🐘 Local Postgres162102271848
✅ 🪟 Windows15400154
✅ 📋 Other102002121232
✅ vercel-multi-region270027
Total7519011328651

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro126028
✅ example126028
✅ express126028
✅ fastify126028
✅ 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
✅ nextjs-webpack-stable15400
✅ 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-stable15400
✅ 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-start126028
✅ vercel-multi-region
AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@vercelvercelBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Documentation incorrectly states the precondition guard requires opt-in via WORKFLOW_PRECONDITION_GUARD=1, when it is now enabled by default.

Fix on Vercel

@VaguelySeriousVaguelySerious changed the title Default WORKFLOW_PRECONDITION_GUARD on; address #2266 review feedbackDefault WORKFLOW_PRECONDITION_GUARD onJul 15, 2026
…ard-followup
# Conflicts:
#	docs/content/docs/v5/configuration/runtime-tuning.mdx
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for eb8fdb9 (AI decision).

This commit is a follow-up to #2266's WORKFLOW_PRECONDITION_GUARD feature, which exists only on main: verified via git grep on origin/stable that WORKFLOW_PRECONDITION_GUARD, withPreconditionRetry, PreconditionFailedError, and stateUpdatedAt do not exist anywhere in packages/, and the touched v5 docs page docs/content/docs/v5/configuration/runtime-tuning.mdx is also absent there. Every changed file builds on main-only behavior, so there is nothing to backport.

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

eb8fdb979748f54a94289530ee7ac155feddddcc

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.

2 participants

@VaguelySerious@TooTallNate