Skip to content

[core] Fix setAttributes() resolution bypassing delivery barriers - #4861

Merged
VaguelySerious merged 2 commits into
mainfrom
triage-4770-setattributes-barrier
Oct 13, 2026
Merged

VaguelySerious merged 2 commits into
mainfrom
triage-4770-setattributes-barrier

Conversation

@pranaygp

@pranaygp pranaygp commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4770.

Problem

When setAttributes() resolves, its attr_set acknowledgement settled straight off promiseQueue without registering a delivery barrier. Every other delivery that resumes a branch (step results, waits, hook payloads and, since #4215, hook registration outcomes) registers one and waits for earlier deliveries. A branch awaiting setAttributes() could therefore resume ahead of a sibling's step result that comes earlier in the log, and draw that sibling's next correlation ID. Depending on what the sibling draws next, the run either fails with REPLAY_DIVERGENCE, or both branches call the same step and silently receive each other's results.

Fix

  • Add an attribute DeliveryKind. It defers behind every earlier kind, and every kind defers behind an earlier attribute. Like a step, it skips unclaimed buffered hook payloads, because resolving it never depends on a hook read.
  • attribute-dispatcher.ts registers the barrier and captures awaitEarlierDeliveries when it consumes the event, then resolves from a continuation that is detached from the queue tail, following the same pattern as sleep.ts.
  • setAttributes() resolution still does not move the workflow clock. registerDeliveryBarrier now accepts deliveredAt: null to opt out explicitly.
  • The QuickJS runtime needs no change. It delivers events strictly in log order and drains jobs after each one.

Tests

  • set-attributes-delivery-order.test.ts drives the two shapes from the issue against an in-memory event log and replays the committed log in fresh VMs with cold and warm caches. It covers both WORKFLOW_LOG_ORDER_DRAWS modes and several hop counts. On main all 16 cases fail (CI confirmed this on the first commit). With the fix they all pass.
  • Full core suite passes locally: 3073 passed, 6 expected failures.
  • I ran the reporter's standalone reproduction (published workflow@5.2.1 / @workflow/vitest@5.0.4, 32 runs per workflow). Stock 5.2.1 fails attrSwap in 25–32 of 32 runs and attrVsHook in 4–24 of 32 runs. With this build of @workflow/core swapped in, all four tests pass in both draw modes.

Note on in-flight runs

Unlike #4848, this does not pin the old ordering for runs started before the upgrade. The old ordering was not a deterministic function of the log for the reported shapes. Even so, a history that recorded setAttributes() winning a Promise.race against an earlier-in-log delivery could replay differently once these runs continue on the new SDK. #4848 handles that case with a per-run marker. Maintainers should decide whether that gating is worth the extra surface.

🤖 Generated with Claude Code

…ing (#4770)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

Co-Authored-By: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c005102

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

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

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

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

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

📊 Workflow Benchmarks

commit c005102 · Tue, 13 Oct 2026 21:13:41 GMT · run logs

Backend: vercel · app: nextjs-turbopack

Metric Scenario Best (ms) P75 (ms) P90 (ms) P99 (ms) Samples
TTFS step 1621 (+41%) 🔻 1927 🔴 (+9.4%) 1955 🔴 (+8.3%) 1982 🔴 (+8.1%) 30
TTFS stream 1819 (+24%) 🔻 1903 🔴 (+14%) 1933 🔴 (+9.4%) 2079 🔴 (+16%) 🔻 30
TTFS hook + stream 1800 (+3.9%) 2247 🔴 (+15%) 🔻 2289 🔴 (+14%) 5330 🔴 (+146%) 🔻 30
Fan-out TTFS Promise.all(100 steps) 524 (-5.9%) 2274 (+205%) 🔻 2367 (+182%) 🔻 2671 (+44%) 🔻 10
Fan-out TTLS Promise.all(100 steps) 2660 (+46%) 🔻 5875 (+28%) 🔻 6355 (+31%) 🔻 6828 (+0.9%) 10
STSO 1020 steps (inline) 87 (±0%) 102 (-11%) 119 (-12%) 148 (-18%) 💚 1019
WO 1020 steps 103592 (-8.6%) 103592 (-8.6%) 103592 (-8.6%) 103592 (-8.6%) 1
📈 STSO distribution vs main (inline / queue-hop histograms)

1020 steps (inline)

Cumulative STSO time: main 113014ms → this run 103375ms (Δ -9639ms, -9%)

 50-100 ms  █████████░░░░░░░░░░░░┃    main 275  this 649  +374
100-150 ms  ███████████┃████████████  main 703  this 360  -343
150-200 ms  ┃                         main  35  this   8   -27
200-250 ms  ┃                         main   4  this   2    -2
250-300 ms  ┃                         main   2  this   0    -2
ℹ️ Metric definitions & methodology

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

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

Metrics — TTFS: time to first step body (in-deployment start() → first step body) · Fan-out TTFS: fan-out time to first step (in-deployment start() → first of the parallel step bodies to complete) · Fan-out TTLS: fan-out time to last step (in-deployment start() → last of the parallel step bodies to complete, i.e. when the Promise.all resolves) · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (whole-run time outside step bodies, in-deployment anchored)

Scenarios — step: one trivial no-op step, no stream; no hooks, so the run stays in turbo mode (in-process fast path) · stream: one streaming step; no hooks, so the run stays in turbo mode (in-process fast path) · hook + stream: registers a hook before one step, which exits turbo mode (dispatch path) · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges, and WO is the whole-run overhead outside step bodies · Promise.all(100 steps): 100 trivial no-op steps started together in a single Promise.all; Fan-out TTFS is the first of them to complete and Fan-out TTLS the last, both from the in-deployment clientStart, so their gap is the spread the runtime adds across the fan-out

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

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

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

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

✅ All tests passed

⚠️ Flaky E2E Tests (passed on retry)

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

  • abortHookOrderingWorkflow [hook-first-abort-first]: hook.then → addEventListener → abort() → resumeHook (nextjs-webpack · local-dev / local / node / canary)
  • abortHookOrderingWorkflow [hook-first-hook-first]: hook.then → addEventListener → resumeHook → abort() (nextjs-webpack · local-dev / local / node / canary)
  • abortHookOrderingWorkflow [listener-first-abort-first]: addEventListener → hook.then → abort() → resumeHook (nextjs-webpack · local-dev / local / node / canary)
  • abortHookOrderingWorkflow [listener-first-hook-first]: addEventListener → hook.then → resumeHook → abort() (nextjs-webpack · local-dev / local / node / canary)
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps (nextjs-webpack · local-dev / local / node / stable)
  • resumes in flight during the takeover are never lost: each lands in exactly one log (nuxt · local-prod / local / quickjs / stable)

🛠 Infra Events (absorbed by the harness)

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

  • run-pickup-stall · runs app-generated source against a registered step (tanstack-start) · at 21:11:05Z · abandoned wrun_01M4VHN4EHWNNDJ9W4B96SA3ZT
  • cold-start-warmup · suite warmup (tanstack-start) · at 21:11:09Z · abandoned wrun_01M4VHN4ENA2DQW57G0MHM7MFK
  • run-pickup-stall · hookCleanupTestWorkflow - hook token reuse after workflow completion (nextjs-webpack) · at 21:17:36Z · abandoned wrun_01M4VJ121A30DWFH56AN09XF1K

E2E Test Summary

Summary
Passed Failed Skipped Total
✅ ▲ Vercel Production 3982 0 878 4860
✅ 💻 Local Development 4669 0 551 5220
✅ 📦 Local Production 4669 0 551 5220
✅ 🐘 Local Postgres 4669 0 551 5220
✅ 🪟 Windows 348 0 12 360
✅ 🌐 Cross-language Conformance 68 0 87 155
✅ dynamic-runs 0 0 0 0
✅ vercel-http-transport 897 0 183 1080
✅ vercel-multi-region 27 0 0 27
✅ vercel-ws-transport 607 0 113 720
Total 19936 0 2926 22862
Details by Category

✅ ▲ Vercel Production

App Passed Failed Skipped
✅ astro-node 145 0 35
✅ astro-quickjs 145 0 35
✅ example-node 145 0 35
✅ example-quickjs 145 0 35
✅ express-node 145 0 35
✅ express-quickjs 145 0 35
✅ fastify-node 145 0 35
✅ fastify-quickjs 145 0 35
✅ hono-node 145 0 35
✅ hono-quickjs 145 0 35
✅ nest-node 145 0 35
✅ nest-quickjs 145 0 35
✅ nextjs-turbopack-node 172 0 8
✅ nextjs-turbopack-quickjs 172 0 8
✅ nextjs-webpack-node 172 0 8
✅ nextjs-webpack-quickjs 172 0 8
✅ nitro-node 145 0 35
✅ nitro-quickjs 145 0 35
✅ nuxt-node 145 0 35
✅ nuxt-quickjs 145 0 35
✅ python-node 66 0 114
✅ sveltekit-node 164 0 16
✅ sveltekit-quickjs 164 0 16
✅ tanstack-start-node 145 0 35
✅ tanstack-start-quickjs 145 0 35
✅ vite-node 145 0 35
✅ vite-quickjs 145 0 35

✅ 💻 Local Development

App Passed Failed Skipped
✅ astro-stable-node 151 0 29
✅ astro-stable-quickjs 151 0 29
✅ express-stable-node 151 0 29
✅ express-stable-quickjs 151 0 29
✅ fastify-stable-node 151 0 29
✅ fastify-stable-quickjs 151 0 29
✅ hono-stable-node 151 0 29
✅ hono-stable-quickjs 151 0 29
✅ nest-stable-node 151 0 29
✅ nest-stable-quickjs 151 0 29
✅ nextjs-turbopack-canary-node 179 0 1
✅ nextjs-turbopack-canary-quickjs 179 0 1
✅ nextjs-turbopack-quickjs-snapshot 179 0 1
✅ nextjs-turbopack-stable-node 179 0 1
✅ nextjs-turbopack-stable-quickjs 179 0 1
✅ nextjs-webpack-canary-node 179 0 1
✅ nextjs-webpack-canary-quickjs 179 0 1
✅ nextjs-webpack-stable-node 179 0 1
✅ nextjs-webpack-stable-quickjs 179 0 1
✅ nitro-stable-node 151 0 29
✅ nitro-stable-quickjs 151 0 29
✅ nuxt-stable-node 151 0 29
✅ nuxt-stable-quickjs 151 0 29
✅ sveltekit-stable-node 170 0 10
✅ sveltekit-stable-quickjs 170 0 10
✅ tanstack-start-node 151 0 29
✅ tanstack-start-quickjs 151 0 29
✅ vite-stable-node 151 0 29
✅ vite-stable-quickjs 151 0 29

✅ 📦 Local Production

App Passed Failed Skipped
✅ astro-stable-node 151 0 29
✅ astro-stable-quickjs 151 0 29
✅ express-stable-node 151 0 29
✅ express-stable-quickjs 151 0 29
✅ fastify-stable-node 151 0 29
✅ fastify-stable-quickjs 151 0 29
✅ hono-stable-node 151 0 29
✅ hono-stable-quickjs 151 0 29
✅ nest-stable-node 151 0 29
✅ nest-stable-quickjs 151 0 29
✅ nextjs-turbopack-canary-node 179 0 1
✅ nextjs-turbopack-canary-quickjs 179 0 1
✅ nextjs-turbopack-quickjs-snapshot 179 0 1
✅ nextjs-turbopack-stable-node 179 0 1
✅ nextjs-turbopack-stable-quickjs 179 0 1
✅ nextjs-webpack-canary-node 179 0 1
✅ nextjs-webpack-canary-quickjs 179 0 1
✅ nextjs-webpack-stable-node 179 0 1
✅ nextjs-webpack-stable-quickjs 179 0 1
✅ nitro-stable-node 151 0 29
✅ nitro-stable-quickjs 151 0 29
✅ nuxt-stable-node 151 0 29
✅ nuxt-stable-quickjs 151 0 29
✅ sveltekit-stable-node 170 0 10
✅ sveltekit-stable-quickjs 170 0 10
✅ tanstack-start-node 151 0 29
✅ tanstack-start-quickjs 151 0 29
✅ vite-stable-node 151 0 29
✅ vite-stable-quickjs 151 0 29

✅ 🐘 Local Postgres

App Passed Failed Skipped
✅ astro-stable-node 151 0 29
✅ astro-stable-quickjs 151 0 29
✅ express-stable-node 151 0 29
✅ express-stable-quickjs 151 0 29
✅ fastify-stable-node 151 0 29
✅ fastify-stable-quickjs 151 0 29
✅ hono-stable-node 151 0 29
✅ hono-stable-quickjs 151 0 29
✅ nest-stable-node 151 0 29
✅ nest-stable-quickjs 151 0 29
✅ nextjs-turbopack-canary-node 179 0 1
✅ nextjs-turbopack-canary-quickjs 179 0 1
✅ nextjs-turbopack-quickjs-snapshot 179 0 1
✅ nextjs-turbopack-stable-node 179 0 1
✅ nextjs-turbopack-stable-quickjs 179 0 1
✅ nextjs-webpack-canary-node 179 0 1
✅ nextjs-webpack-canary-quickjs 179 0 1
✅ nextjs-webpack-stable-node 179 0 1
✅ nextjs-webpack-stable-quickjs 179 0 1
✅ nitro-stable-node 151 0 29
✅ nitro-stable-quickjs 151 0 29
✅ nuxt-stable-node 151 0 29
✅ nuxt-stable-quickjs 151 0 29
✅ sveltekit-stable-node 170 0 10
✅ sveltekit-stable-quickjs 170 0 10
✅ tanstack-start-node 151 0 29
✅ tanstack-start-quickjs 151 0 29
✅ vite-stable-node 151 0 29
✅ vite-stable-quickjs 151 0 29

✅ 🪟 Windows

App Passed Failed Skipped
✅ nextjs-turbopack-node 174 0 6
✅ nextjs-turbopack-quickjs 174 0 6

✅ 🌐 Cross-language Conformance

App Passed Failed Skipped
✅ python 68 0 87

✅ dynamic-runs

App Passed Failed Skipped
✅ astro-vercel 0 0 0
✅ example-vercel 0 0 0
✅ express-vercel 0 0 0
✅ fastify-vercel 0 0 0
✅ hono-vercel 0 0 0
✅ nest-vercel 0 0 0
✅ nextjs-turbopack-vercel 0 0 0
✅ nextjs-webpack-vercel 0 0 0
✅ nitro-vercel 0 0 0
✅ nuxt-vercel 0 0 0
✅ sveltekit-vercel 0 0 0
✅ tanstack-start-vercel 0 0 0
✅ vite-vercel 0 0 0

✅ vercel-http-transport

App Passed Failed Skipped
✅ example 145 0 35
✅ express 145 0 35
✅ hono 145 0 35
✅ nextjs-turbopack 172 0 8
✅ nitro 145 0 35
✅ vite 145 0 35

✅ vercel-multi-region

App Passed Failed Skipped
✅ nextjs-turbopack 27 0 0

✅ vercel-ws-transport

App Passed Failed Skipped
✅ example 145 0 35
✅ express 145 0 35
✅ nextjs-turbopack 172 0 8
✅ vite 145 0 35

📋 View full workflow run

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Sim World

Simulated world deterministic testing for races. Traces

🟢 world-sim scenario book — 0 fail of 42 total

fence=per-spec

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

Full trace: world-sim.txt

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Framework Flow route Step reg. Framework output
hono 267.4 KiB (±0) 95.5 KiB (±0) 1.99 MiB (+246 B)
nextjs-turbopack 274.8 KiB (±0) 426 B (±0) 970.8 KiB (+34 B)
About these numbers

Sizes are gzip; parentheses show the change against main.
Flow route and Step reg. gate this job, on raw bytes rather than the gzip shown, at max(2%, 50.0 KiB). Framework output is informational.

c005102 · run

…4770)

Register the attr_set acknowledgement as an 'attribute' delivery barrier at
its log index and resolve setAttributes() only after every earlier delivery
it defers behind has been handed to the workflow. Every other kind defers
behind an earlier attribute too. The clock is left untouched, as before.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

Co-Authored-By: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>

@VaguelySerious VaguelySerious left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AI review: no blocking issues

// The ordering is captured here, at consumption time, for the same
// reason as in step.ts and sleep.ts.
const eventIndex = ctx.eventsConsumer.eventIndex;
const barrier = registerDeliveryBarrier(ctx, eventIndex, 'attribute', {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AI Review: Note

This overlaps with #4848, which also closes #4770 and adds a per-run marker so runs started before the upgrade keep the old ordering. This PR follows the #4215 precedent (hook registration outcomes were moved onto the barriers without gating), which I think is reasonable here: I could not build a history where the old ordering was deterministic and the new one picks a different winner. Re-recording three extra shapes on the base commit and on this branch (unawaited setAttributes() alongside a pending step, setAttributes() in a Promise.all with a sleep and an earlier step, and setAttributes() while a hook payload sits buffered and unclaimed) gave identical outputs and resolution order in both draw modes, with cold and warm cache replays stable. One of the two PRs should be closed before merge.

// Attribute writes have never moved the workflow clock.
deliveredAt: null,
});
const earlierDelivered = awaitEarlierDeliveries(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AI Review: Note

With log-order draws on (the default), every setAttributes() resolution now pays the quiesce turn in awaitEarlierDeliveries, even when nothing earlier is in flight. I measured a 30-iteration sequential setAttributes() loop: replay went from ~37ms to ~40ms, so about 0.1ms per write. Fine for progress-style attribute updates; noting it in case someone writes attributes in a tight loop.

@VaguelySerious
VaguelySerious merged commit afdc68b into main Oct 13, 2026
188 checks passed
@VaguelySerious
VaguelySerious deleted the triage-4770-setattributes-barrier branch October 13, 2026 21:40
@github-actions github-actions Bot mentioned this pull request Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No backport to stable for afdc68b (AI decision).

This is a genuine correctness fix (REPLAY_DIVERGENCE / branches receiving each other's step results), but it targets functionality that does not exist on stable: git ls-tree origin/stable -- packages/core/src/workflow/attribute-dispatcher.ts shows the file is absent, and the only setAttributes references on stable are OpenTelemetry span.setAttributes() calls — the workflow-level setAttributes() primitive and its attribute queue item are main-only. The delivery-barrier machinery in private.ts does exist on stable, but the attribute DeliveryKind it adds would gate nothing there, so there is no defect to fix on the maintenance line.

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

afdc68b8714036a01d8dcd5a023633ea544dc7fa

TooTallNate pushed a commit that referenced this pull request Oct 15, 2026
Catches the docs up with SDK changes that shipped in the last day
without (complete) docs updates.

| Change | Source PR | Docs edit |
| --- | --- | --- |
| QuickJS runs with snapshotting are exempt from the default per-run
event limit on the Local and Vercel Worlds, and `MAX_EVENTS_EXCEEDED` /
`REPLAY_TIMEOUT` now have their own error pages | #4870 | The error-code
table in Errors and retries, the log-growth note in Event sourcing, and
the event-limit row in What's new now mention the QuickJS exemption and
link to the new error pages. #4870 updated the errors index, Runtime
tuning, Worlds, and Vercel World pages but not these |

I reviewed the other PRs from the last day and they need no further
docs: removing the experimental resilient step dispatch (#4818) updated
its own docs and the variable no longer appears outside changelogs, the
`setAttributes()` delivery-order fix (#4861) and terminal-inert replay
(#4819) are bug fixes, reading step creation from `step_started` (#4866)
is reader-side forward compatibility with no user-facing change yet, and
the devalue upgrade (#4856), dependency bumps, and Version Packages PRs
aren't documented behavior. The Workflows pricing and limits page in
`vercel/front` gets the matching event-limit note in vercel/front#91076.

## Docs Preview

| Page | Preview |
| --- | --- |
| Errors and retries | [Error
codes](https://workflow-docs-git-workflow-docs-cleanup-wed-14-oct.vercel.sh/docs/foundations/errors-and-retries)
|
| Event sourcing | [How fast a log
grows](https://workflow-docs-git-workflow-docs-cleanup-wed-14-oct.vercel.sh/docs/how-it-works/event-sourcing#how-fast-a-log-grows)
|
| What's new | [Breaking changes: Application
code](https://workflow-docs-git-workflow-docs-cleanup-wed-14-oct.vercel.sh/docs/whats-new#application-code)
|

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
mmarufov added a commit to mmarufov/workflow that referenced this pull request Oct 17, 2026
Allow operators to select older runs whose saved decisions depend on
the attribute delivery behavior before vercel#4861. Keep that choice for each
replay session and retain ordered delivery for other runs.

Cover old and newer histories with both draw-order settings, checking
the inputs sent to a new step after replay.

Signed-off-by: Muhammadjon Marufov <marufov254@gmail.com>

This branch was successfully deployed

1 active deployment
Preview – workflow-docs — c005102f Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants