') + ')', '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('^' + ".*" + ', '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" + ', '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('^' + ".*" + ', '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); } })(); })(); [world-vercel] Send the run id on correlation-id event reads by VaguelySerious · Pull Request #3334 · vercel/workflow · GitHub
Skip to content

[world-vercel] Send the run id on correlation-id event reads - #3334

Merged
VaguelySerious merged 1 commit into
mainfrom
peter/correlation-id-run-scope-wire
Aug 5, 2026
Merged

[world-vercel] Send the run id on correlation-id event reads#3334
VaguelySerious merged 1 commit into
mainfrom
peter/correlation-id-run-scope-wire

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Follow-up to #3280.

#3280 made runId required on ListEventsByCorrelationIdParams, but world-vercel could only apply the scope after the response arrived: it selected by correlation id on the wire and filtered the returned page by run id. A correlation id names a step, hook or wait within its run, so under slot identity step_…001 is the first step of every slot-numbered run, and an unscoped read spans runs. Post-filtering a page the backend chose without knowing the run is not a scope.

This sends runId on the request, so the backend can answer for that run alone. The client-side filter stays as the fallback for a backend that predates the parameter and still answers across runs (skew protection keeps older deployments talking to the current API, and vice versa).

The backend side is tracked separately and ships first.

Tests

  • events-v4.test.ts: getEventsByCorrelationIdV4 puts both correlationId and runId on the query string.
  • events.test.ts: getWorkflowRunEvents with a correlation id sends runId, and when a backend answers with two runs sharing one correlation id, only the requested run's event survives while hasMore/cursor stay the backend's.

Both tests were checked against mutations: dropping the runId query param fails the first, dropping the post-filter fails the second.

#3280 made runId required on ListEventsByCorrelationIdParams, but
world-vercel could only apply the scope after the fact: it selected by
correlation id on the wire and filtered the returned page by run. That
depends on the backend having happened to return the run's rows in the
page it answered with.
Put runId on the request. The backend reads the run's own partition and
answers for that run, so the page comes back scoped. The client-side
filter stays for backends that predate the parameter and still answer
across runs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerAugust 4, 2026 20:57
@changeset-bot

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8aa1570

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

This PR includes changesets to release 17 packages
NameType
@workflow/world-vercelPatch
@workflow/cliPatch
@workflow/corePatch
@workflow/webPatch
workflowPatch
@workflow/world-testingPatch
@workflow/buildersPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/vitestPatch
@workflow/web-sharedPatch
@workflow/astroPatch
@workflow/nestPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/nuxtPatch

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 Aug 4, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

❌ Failed E2E Tests

📦 Local Production (1 failed)

nitro-stable-node (1 failed):

  • webhookWorkflow | wrun_41KZ79B61F0GX167F4PC6VYMRK

E2E Test Summary

Summary
PassedFailedSkippedTotal
✅ ▲ Vercel Production293205003432
✅ 💻 Local Development286004163276
❌ 📦 Local Production328914543744
✅ 🐘 Local Postgres313404543588
✅ 🪟 Windows31200312
✅ 📋 Other206804282496
✅ vercel-multi-region270027
Total146221225216875
Details by Category

✅ ▲ Vercel Production

AppPassedFailedSkipped
✅ astro-node127029
✅ astro-quickjs127029
✅ example-node127029
✅ example-quickjs127029
✅ express-node127029
✅ express-quickjs127029
✅ fastify-node127029
✅ fastify-quickjs127029
✅ hono-node127029
✅ hono-quickjs127029
✅ nextjs-turbopack-node15204
✅ nextjs-turbopack-quickjs15204
✅ nextjs-webpack-node15204
✅ nextjs-webpack-quickjs15204
✅ nitro-node127029
✅ nitro-quickjs127029
✅ nuxt-node127029
✅ nuxt-quickjs127029
✅ sveltekit-node146010
✅ sveltekit-quickjs146010
✅ vite-node127029
✅ vite-quickjs127029

✅ 💻 Local Development

AppPassedFailedSkipped
✅ astro-stable-node130026
✅ astro-stable-quickjs130026
✅ express-stable-node130026
✅ express-stable-quickjs130026
✅ fastify-stable-node130026
✅ fastify-stable-quickjs130026
✅ hono-stable-node130026
✅ hono-stable-quickjs130026
✅ nextjs-turbopack-canary-node137019
✅ nextjs-turbopack-canary-quickjs137019
✅ nextjs-turbopack-stable-node15600
✅ nextjs-turbopack-stable-quickjs15600
✅ nextjs-webpack-stable-quickjs15600
✅ nitro-stable-node130026
✅ nitro-stable-quickjs130026
✅ nuxt-stable-node130026
✅ nuxt-stable-quickjs130026
✅ sveltekit-stable-node14907
✅ sveltekit-stable-quickjs14907
✅ vite-stable-node130026
✅ vite-stable-quickjs130026

❌ 📦 Local Production

AppPassedFailedSkipped
✅ astro-stable-node130026
✅ astro-stable-quickjs130026
✅ express-stable-node130026
✅ express-stable-quickjs130026
✅ fastify-stable-node130026
✅ fastify-stable-quickjs130026
✅ hono-stable-node130026
✅ hono-stable-quickjs130026
✅ nextjs-turbopack-canary-node137019
✅ nextjs-turbopack-canary-quickjs137019
✅ nextjs-turbopack-stable-node15600
✅ nextjs-turbopack-stable-quickjs15600
✅ nextjs-webpack-canary-node137019
✅ nextjs-webpack-canary-quickjs137019
✅ nextjs-webpack-stable-node15600
✅ nextjs-webpack-stable-quickjs15600
❌ nitro-stable-node129126
✅ nitro-stable-quickjs130026
✅ nuxt-stable-node130026
✅ nuxt-stable-quickjs130026
✅ sveltekit-stable-node14907
✅ sveltekit-stable-quickjs14907
✅ vite-stable-node130026
✅ vite-stable-quickjs130026

✅ 🐘 Local Postgres

AppPassedFailedSkipped
✅ astro-stable-node130026
✅ astro-stable-quickjs130026
✅ express-stable-node130026
✅ express-stable-quickjs130026
✅ fastify-stable-node130026
✅ fastify-stable-quickjs130026
✅ hono-stable-node130026
✅ hono-stable-quickjs130026
✅ nextjs-turbopack-canary-node137019
✅ nextjs-turbopack-canary-quickjs137019
✅ nextjs-turbopack-stable-quickjs15600
✅ nextjs-webpack-canary-node137019
✅ nextjs-webpack-canary-quickjs137019
✅ nextjs-webpack-stable-node15600
✅ nextjs-webpack-stable-quickjs15600
✅ nitro-stable-node130026
✅ nitro-stable-quickjs130026
✅ nuxt-stable-node130026
✅ nuxt-stable-quickjs130026
✅ sveltekit-stable-node14907
✅ sveltekit-stable-quickjs14907
✅ vite-stable-node130026
✅ vite-stable-quickjs130026

✅ 🪟 Windows

AppPassedFailedSkipped
✅ nextjs-turbopack-node15600
✅ nextjs-turbopack-quickjs15600

✅ 📋 Other

AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable-node130026
✅ e2e-local-dev-nest-stable-quickjs130026
✅ e2e-local-dev-tanstack-start-node130026
✅ e2e-local-dev-tanstack-start-quickjs130026
✅ e2e-local-postgres-nest-stable-node130026
✅ e2e-local-postgres-nest-stable-quickjs130026
✅ e2e-local-postgres-tanstack-start-node130026
✅ e2e-local-postgres-tanstack-start-quickjs130026
✅ e2e-local-prod-nest-stable-node130026
✅ e2e-local-prod-nest-stable-quickjs130026
✅ e2e-local-prod-tanstack-start-node130026
✅ e2e-local-prod-tanstack-start-quickjs130026
✅ e2e-vercel-prod-nest-node127029
✅ e2e-vercel-prod-nest-quickjs127029
✅ e2e-vercel-prod-tanstack-start-node127029
✅ e2e-vercel-prod-tanstack-start-quickjs127029

✅ vercel-multi-region

AppPassedFailedSkipped
✅ nextjs-turbopack2700

📋 View full workflow run

@github-actions

github-actionsBot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit 8aa1570 · Tue, 04 Aug 2026 21:17:03 GMT · run logs

Backend: vercel · app: nextjs-turbopack

MetricScenarioBest (ms)P75 (ms)P90 (ms)P99 (ms)Samples
TTFSstep1277 (+497%) 🔻1423 🔴 (+19%) 🔻1444 🔴 (+17%) 🔻1567 🔴 (-4.2%)30
TTFSstream332 (+35%) 🔻1476 🔴 (+38%) 🔻1552 🔴 (+42%) 🔻1594 🔴 (+39%) 🔻30
TTFShook + stream1567 (+312%) 🔻1767 🔴 (+34%) 🔻1890 🔴 (+37%) 🔻2041 🔴 (+39%) 🔻30
STSO1020 steps (inline)90 (-10%)146 (-8.8%)186 (-4.1%)307 (-30%) 💚1018
STSO1020 steps (queue-hop)3876 (+31%) 🔻3876 (+31%) 🔻3876 (+31%) 🔻3876 (+31%) 🔻1
WO1020 steps148956 (-13%)148956 (-13%)148956 (-13%)148956 (-13%)1
SLstream latency115 (+19%) 🔻156 🔴 (+4.7%)185 🔴 (-17%) 💚453 🔴 (-40%) 💚30
SOstream overhead (text)116 (-3.3%)183 (-30%) 💚198 (-66%) 💚264 (-67%) 💚30
SOstream overhead (structured)117 (±0%)185 (-41%) 💚217 (-62%) 💚385 (-55%) 💚30
📈 STSO distribution vs main (inline / queue-hop histograms)

1020 steps (inline)

Cumulative STSO time: main 166837ms → this run 143670ms (Δ -23167ms, -14%)

 50-100 ms ┃ main 0 this 10 +10
100-150 ms ███████████████████░░░░┃ main 624 this 783 +159
150-200 ms ████┃████ main 302 this 155 -147
200-250 ms █┃ main 48 this 50 +2
250-300 ms ┃ main 13 this 9 -4
300-350 ms ┃ main 12 this 3 -9
350-400 ms ┃ main 6 this 4 -2
400-450 ms ┃ main 3 this 0 -3
450-500 ms ┃ main 0 this 1 +1
500-550 ms ┃ main 2 this 1 -1
550-600 ms ┃ main 3 this 0 -3
650-700 ms ┃ main 1 this 0 -1
850-900 ms ┃ main 1 this 0 -1
1200-1250 ms ┃ main 0 this 1 +1
2150-2200 ms ┃ main 1 this 0 -1
3300-3350 ms ┃ main 1 this 0 -1
3450-3500 ms ┃ main 0 this 1 +1
3800-3850 ms ┃ main 1 this 0 -1

1020 steps (queue-hop)

Cumulative STSO time: main 2968ms → this run 3876ms (Δ +908ms, +31%)

2500-3000 ms ┃███████████████████████ main 1 this 0 -1
3500-4000 ms ░░░░░░░░░░░░░░░░░░░░░░░┃ main 0 this 1 +1
ℹ️ Metric definitions & methodology

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

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

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

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

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

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

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

@NathanColosimoNathanColosimo 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.

lgtm

@VaguelySerious
VaguelySerious merged commit 2eddf74 into mainAug 5, 2026
159 of 165 checks passed
@VaguelySerious
VaguelySerious deleted the peter/correlation-id-run-scope-wire branch August 5, 2026 16:54
@github-actionsgithub-actionsBot mentioned this pull request Aug 5, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for 2eddf74 (AI decision).

This commit builds directly on #3280, which is main-only: ListEventsByCorrelationIdParams on stable (packages/world/src/events.ts:483) has no runId field, and stable's getWorkflowRunEvents has neither the run id to send nor the client-side run-scope filter this change amends, so params.runId would not even typecheck there. It is also a wire-protocol change gated on a backend parameter that ships separately, rather than a self-contained fix to behavior that exists on the maintenance line. If the underlying cross-run scoping gap is judged a real defect for stable, #3280 and this follow-up would need to be forced through together via workflow_dispatch.

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

2eddf74cb620dcb292ffe8f300699fff89a97100

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@NathanColosimo