Skip to content

feat(core): add serialization support for workflow function references#1677

Merged
TooTallNate merged 2 commits into
mainfrom
fix/workflow-function-serialization
Apr 10, 2026
Merged

feat(core): add serialization support for workflow function references#1677
TooTallNate merged 2 commits into
mainfrom
fix/workflow-function-serialization

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate commented Apr 9, 2026

Summary

Add a WorkflowFunction reducer/reviver pair to the serialization system so that workflow function references (functions with a .workflowId property, as produced by the SWC compiler) can cross the step serialization boundary.

This is a prerequisite for allowing start() to be called directly from workflow functions with "use step" — the workflow function reference passed as the first argument needs to be serializable.

How it works

Reducer: Detects functions with a .workflowId string property, serializes as { workflowId }. Only matches functions (not plain objects) to prevent infinite recursion since the reduced form is a plain object.

Revivers: All contexts (step, workflow, external) deserialize as a function with .workflowId that throws "Workflow functions cannot be called directly. Use start() to invoke them." on direct invocation. This is sufficient because start() only reads .workflowId from the reference.

Observability: Renders as <workflow:workflowId> in the o11y UI.

Note on workflow context hydration

It is recognized that the workflow context reviver should ideally return the proper registered function reference (since the SWC compiler registers workflow functions in the VM). However, since this PR is primarily for the start() as a step use-case — where the deserialized reference is only passed to start() which reads .workflowId — returning a throwing wrapper is sufficient. Full workflow function registry hydration can be revisited in the future when there is a concrete use case requiring the actual function reference in workflow context.

Example

// In user code (workflow context):
const childRun = await start(myChildWorkflow, [42]);
//                           ^^^^^^^^^^^^^^^^
// This is a function with .workflowId attached by SWC.
// The WorkflowFunction reducer serializes it as { workflowId: "..." }
// so it can cross the step boundary as an argument to start().

Copilot AI review requested due to automatic review settings April 9, 2026 22:53
@TooTallNate TooTallNate requested a review from a team as a code owner April 9, 2026 22:53
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 9, 2026

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

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Apr 9, 2026 11:54pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 9, 2026 11:54pm
example-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-astro-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-express-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-fastify-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-hono-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-nitro-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workbench-vite-workflow Ready Ready Preview, Comment Apr 9, 2026 11:54pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 9, 2026 11:54pm
workflow-swc-playground Ready Ready Preview, Comment Apr 9, 2026 11:54pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 0.035s (-5.9% 🟢) 1.005s (~) 0.970s 10 1.00x
🐘 Postgres Nitro 0.056s (-11.4% 🟢) 1.010s (~) 0.954s 10 1.60x
🐘 Postgres Express 0.061s (-8.6% 🟢) 1.010s (~) 0.949s 10 1.74x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 0.234s (-3.4%) 2.116s (~) 1.883s 10 1.00x
▲ Vercel Next.js (Turbopack) 0.286s (-35.5% 🟢) 2.053s (-7.6% 🟢) 1.766s 10 1.23x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 1.099s (~) 2.006s (~) 0.906s 10 1.00x
🐘 Postgres Nitro 1.139s (-1.0%) 2.010s (~) 0.870s 10 1.04x
🐘 Postgres Express 1.147s (~) 2.009s (~) 0.861s 10 1.04x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 1.807s (-12.7% 🟢) 4.016s (+8.7% 🔺) 2.208s 10 1.00x
▲ Vercel Express 1.949s (+4.2%) 4.112s (+7.0% 🔺) 2.163s 10 1.08x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 10.673s (~) 11.023s (~) 0.349s 3 1.00x
🐘 Postgres Express 10.858s (~) 11.022s (~) 0.163s 3 1.02x
🐘 Postgres Nitro 10.884s (~) 11.353s (+3.0%) 0.468s 3 1.02x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 16.963s (+1.3%) 18.921s (+1.0%) 1.958s 2 1.00x
▲ Vercel Next.js (Turbopack) 17.475s (-1.6%) 19.672s (+3.8%) 2.197s 2 1.03x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 25 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 14.241s (~) 15.028s (~) 0.787s 4 1.00x
🐘 Postgres Nitro 14.474s (~) 15.020s (~) 0.546s 4 1.02x
🐘 Postgres Express 14.476s (-0.6%) 15.021s (~) 0.545s 4 1.02x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 31.526s (-7.1% 🟢) 33.030s (-8.2% 🟢) 1.504s 2 1.00x
▲ Vercel Express 31.686s (+5.1% 🔺) 33.518s (+3.9%) 1.833s 2 1.01x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Next.js (Turbopack) | Express

workflow with 50 sequential steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 13.811s (-2.0%) 14.020s (-4.9%) 0.209s 7 1.00x
🐘 Postgres Nitro 13.921s (~) 14.305s (+2.0%) 0.384s 7 1.01x
💻 Local Nitro 14.873s (~) 15.028s (~) 0.156s 6 1.08x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 50.353s (-4.2%) 52.735s (-3.7%) 2.382s 2 1.00x
▲ Vercel Next.js (Turbopack) 54.849s (~) 57.326s (+0.5%) 2.478s 2 1.09x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.262s (~) 2.010s (~) 0.747s 15 1.00x
🐘 Postgres Express 1.277s (~) 2.009s (~) 0.732s 15 1.01x
💻 Local Nitro 1.457s (-2.5%) 2.005s (~) 0.548s 15 1.15x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.308s (-2.7%) 4.131s (~) 1.823s 8 1.00x
▲ Vercel Next.js (Turbopack) 2.639s (+11.1% 🔺) 4.558s (+17.8% 🔺) 1.919s 7 1.14x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 2.330s (-1.2%) 3.009s (~) 0.680s 10 1.00x
🐘 Postgres Express 2.335s (~) 3.011s (~) 0.676s 10 1.00x
💻 Local Nitro 2.665s (-2.3%) 3.008s (-6.3% 🟢) 0.343s 10 1.14x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.624s (-0.9%) 4.357s (+6.3% 🔺) 1.733s 8 1.00x
▲ Vercel Next.js (Turbopack) 2.655s (-12.2% 🟢) 4.643s (+5.4% 🔺) 1.988s 7 1.01x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Promise.all with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 3.459s (-1.3%) 4.010s (~) 0.552s 8 1.00x
🐘 Postgres Express 3.471s (-0.9%) 4.010s (~) 0.538s 8 1.00x
💻 Local Nitro 7.084s (-8.5% 🟢) 8.018s (-5.9% 🟢) 0.934s 4 2.05x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 3.181s (+7.9% 🔺) 5.001s (+6.1% 🔺) 1.820s 6 1.00x
▲ Vercel Next.js (Turbopack) 3.623s (+19.3% 🔺) 5.334s (+15.8% 🔺) 1.710s 6 1.14x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Promise.race with 10 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 1.250s (-0.6%) 2.008s (~) 0.757s 15 1.00x
🐘 Postgres Express 1.262s (-2.6%) 2.007s (~) 0.746s 15 1.01x
💻 Local Nitro 1.482s (-1.5%) 2.006s (~) 0.524s 15 1.19x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.273s (+18.1% 🔺) 4.166s (+12.2% 🔺) 1.893s 8 1.00x
▲ Vercel Next.js (Turbopack) 2.799s (+29.2% 🔺) 4.577s (+27.8% 🔺) 1.778s 7 1.23x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 2.306s (-3.1%) 3.008s (~) 0.702s 10 1.00x
🐘 Postgres Nitro 2.335s (~) 3.010s (~) 0.674s 10 1.01x
💻 Local Nitro 2.789s (-20.2% 🟢) 3.108s (-22.5% 🟢) 0.319s 10 1.21x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 2.975s (+20.0% 🔺) 4.663s (+20.5% 🔺) 1.688s 7 1.00x
▲ Vercel Express 3.231s (+23.3% 🔺) 5.069s (+14.9% 🔺) 1.838s 6 1.09x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Next.js (Turbopack) | Express

Promise.race with 50 concurrent steps

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 3.454s (~) 4.008s (~) 0.554s 8 1.00x
🐘 Postgres Express 3.477s (~) 4.009s (~) 0.532s 8 1.01x
💻 Local Nitro 7.837s (-7.8% 🟢) 8.268s (-8.4% 🟢) 0.431s 4 2.27x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.862s (-2.4%) 4.776s (+13.3% 🔺) 1.913s 7 1.00x
▲ Vercel Next.js (Turbopack) 4.221s (+21.8% 🔺) 6.242s (+29.6% 🔺) 2.021s 5 1.47x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 10 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 0.697s (-5.4% 🟢) 1.004s (~) 0.307s 60 1.00x
🐘 Postgres Nitro 0.787s (-5.9% 🟢) 1.005s (-1.7%) 0.219s 60 1.13x
🐘 Postgres Express 0.793s (-8.3% 🟢) 1.006s (~) 0.213s 60 1.14x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 9.026s (+1.0%) 11.073s (+3.9%) 2.047s 6 1.00x
▲ Vercel Express 9.258s (+0.7%) 11.630s (+5.9% 🔺) 2.373s 6 1.03x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Next.js (Turbopack) | Express

workflow with 25 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.871s (-13.2% 🟢) 2.052s (-31.1% 🟢) 0.181s 44 1.00x
🐘 Postgres Nitro 1.940s (~) 2.283s (+8.7% 🔺) 0.342s 40 1.04x
💻 Local Nitro 2.272s (-11.5% 🟢) 3.007s (-5.4% 🟢) 0.735s 30 1.21x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 29.451s (+5.3% 🔺) 31.651s (+5.7% 🔺) 2.200s 4 1.00x
▲ Vercel Next.js (Turbopack) 31.188s (+8.9% 🔺) 33.320s (+9.8% 🔺) 2.132s 3 1.06x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 50 sequential data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 3.825s (-4.2%) 4.043s (-5.9% 🟢) 0.219s 30 1.00x
🐘 Postgres Express 3.858s (-10.6% 🟢) 4.110s (-18.0% 🟢) 0.252s 30 1.01x
💻 Local Nitro 7.329s (-5.0%) 8.015s (-2.4%) 0.686s 15 1.92x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 75.268s (-4.0%) 77.094s (-3.9%) 1.826s 2 1.00x
▲ Vercel Next.js (Turbopack) 77.509s (+0.8%) 79.286s (+0.7%) 1.777s 2 1.03x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.279s (-5.8% 🟢) 1.006s (~) 0.728s 60 1.00x
🐘 Postgres Nitro 0.282s (~) 1.006s (~) 0.724s 60 1.01x
💻 Local Nitro 0.586s (-11.7% 🟢) 1.004s (~) 0.418s 60 2.10x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Next.js (Turbopack) 1.604s (+10.7% 🔺) 3.360s (+11.7% 🔺) 1.757s 18 1.00x
▲ Vercel Express 1.630s (+7.1% 🔺) 3.360s (+8.5% 🔺) 1.729s 18 1.02x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Next.js (Turbopack) | Express

workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 0.490s (~) 1.006s (~) 0.516s 90 1.00x
🐘 Postgres Express 0.495s (-5.8% 🟢) 1.007s (~) 0.512s 90 1.01x
💻 Local Nitro 2.457s (-10.6% 🟢) 3.008s (-5.5% 🟢) 0.550s 30 5.01x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.697s (-1.5%) 4.606s (+5.9% 🔺) 1.909s 20 1.00x
▲ Vercel Next.js (Turbopack) 3.111s (-7.5% 🟢) 5.125s (+6.2% 🔺) 2.014s 18 1.15x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 0.776s (-1.3%) 1.007s (~) 0.231s 120 1.00x
🐘 Postgres Express 0.794s (-5.6% 🟢) 1.016s (~) 0.222s 119 1.02x
💻 Local Nitro 10.560s (-5.2% 🟢) 11.023s (-7.0% 🟢) 0.463s 11 13.61x
💻 Local Express ⚠️ missing - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - -

▲ Production (Vercel)

World Framework Workflow Time Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 8.362s (+22.2% 🔺) 10.710s (+23.2% 🔺) 2.348s 12 1.00x
▲ Vercel Next.js (Turbopack) 309.221s (+4172.4% 🔺) 311.025s (+3509.5% 🔺) 1.804s 1 36.98x
▲ Vercel Nitro ⚠️ missing - - - -

🔍 Observability: Express | Next.js (Turbopack)

Stream Benchmarks (includes TTFB metrics)
workflow with stream

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
💻 Local 🥇 Nitro 0.138s (-6.3% 🟢) 1.004s (~) 0.009s (+3.3%) 1.015s (~) 0.877s 10 1.00x
🐘 Postgres Nitro 0.198s (-0.9%) 0.995s (~) 0.002s (+6.2% 🔺) 1.009s (~) 0.812s 10 1.43x
🐘 Postgres Express 0.208s (-3.0%) 0.995s (~) 0.001s (-23.5% 🟢) 1.010s (~) 0.801s 10 1.51x
💻 Local Express ⚠️ missing - - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - - -

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 1.665s (+12.6% 🔺) 3.034s (~) 0.477s (+57.4% 🔺) 4.039s (+7.3% 🔺) 2.374s 10 1.00x
▲ Vercel Next.js (Turbopack) 1.713s (+4.9%) 2.960s (~) 0.522s (+21.4% 🔺) 3.943s (+4.1%) 2.230s 10 1.03x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express | Next.js (Turbopack)

stream pipeline with 5 transform steps (1MB)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 0.604s (-6.7% 🟢) 1.005s (~) 0.004s (-13.0% 🟢) 1.022s (~) 0.418s 59 1.00x
🐘 Postgres Nitro 0.612s (+1.1%) 1.023s (+2.1%) 0.004s (~) 1.039s (+1.8%) 0.427s 58 1.01x
💻 Local Nitro 0.667s (+0.8%) 1.011s (~) 0.009s (-16.1% 🟢) 1.114s (+8.6% 🔺) 0.447s 54 1.10x
💻 Local Express ⚠️ missing - - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - - -

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 4.323s (+2.3%) 6.220s (+6.3% 🔺) 0.312s (+42.0% 🔺) 7.042s (+8.5% 🔺) 2.719s 9 1.00x
▲ Vercel Next.js (Turbopack) 4.374s (+6.4% 🔺) 6.022s (+7.9% 🔺) 0.552s (-23.9% 🟢) 7.017s (+5.0% 🔺) 2.643s 9 1.01x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express | Next.js (Turbopack)

10 parallel streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Nitro 0.914s (-3.2%) 1.104s (-3.7%) 0.000s (-67.9% 🟢) 1.118s (-3.8%) 0.204s 54 1.00x
🐘 Postgres Express 0.940s (-5.2% 🟢) 1.103s (-17.4% 🟢) 0.000s (+22.2% 🔺) 1.119s (-18.3% 🟢) 0.179s 54 1.03x
💻 Local Nitro 1.160s (-12.5% 🟢) 2.018s (~) 0.000s (-64.7% 🟢) 2.020s (~) 0.860s 30 1.27x
💻 Local Express ⚠️ missing - - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - - -

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 2.869s (+8.5% 🔺) 4.117s (+10.9% 🔺) 0.000s (+60.7% 🔺) 4.607s (+11.2% 🔺) 1.738s 14 1.00x
▲ Vercel Next.js (Turbopack) 3.180s (-2.2%) 4.680s (+6.7% 🔺) 0.000s (-63.9% 🟢) 5.177s (+8.5% 🔺) 1.996s 12 1.11x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express | Next.js (Turbopack)

fan-out fan-in 10 streams (1MB each)

💻 Local Development

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
🐘 Postgres 🥇 Express 1.710s (-4.3%) 2.139s (~) 0.000s (NaN%) 2.152s (~) 0.442s 28 1.00x
🐘 Postgres Nitro 1.780s (~) 2.129s (+1.5%) 0.000s (-100.0% 🟢) 2.199s (+4.1%) 0.418s 29 1.04x
💻 Local Nitro 3.348s (-15.1% 🟢) 4.029s (-11.1% 🟢) 0.000s (-68.2% 🟢) 4.032s (-11.1% 🟢) 0.684s 16 1.96x
💻 Local Express ⚠️ missing - - - - -
💻 Local Next.js (Turbopack) ⚠️ missing - - - - -
🐘 Postgres Next.js (Turbopack) ⚠️ missing - - - - -

▲ Production (Vercel)

World Framework Workflow Time TTFB Slurp Wall Time Overhead Samples vs Fastest
▲ Vercel 🥇 Express 4.127s (+21.6% 🔺) 5.611s (+15.6% 🔺) 0.000s (-100.0% 🟢) 6.079s (+14.4% 🔺) 1.952s 10 1.00x
▲ Vercel Next.js (Turbopack) 4.514s (+3.8%) 5.868s (+5.2% 🔺) 0.000s (-63.3% 🟢) 6.337s (+6.0% 🔺) 1.823s 10 1.09x
▲ Vercel Nitro ⚠️ missing - - - - -

🔍 Observability: Express | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World 🥇 Fastest Framework Wins
💻 Local Nitro 21/21
🐘 Postgres Nitro 14/21
▲ Vercel Express 16/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework 🥇 Fastest World Wins
Express 🐘 Postgres 19/21
Next.js (Turbopack) ▲ Vercel 21/21
Nitro 🐘 Postgres 15/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run


Some benchmark jobs failed:

  • Local: cancelled
  • Postgres: success
  • Vercel: failure

Check the workflow run for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 923 0 67 990
✅ 💻 Local Development 898 0 182 1080
✅ 📦 Local Production 898 0 182 1080
✅ 🐘 Local Postgres 898 0 182 1080
✅ 🪟 Windows 82 0 8 90
❌ 🌍 Community Worlds 133 74 24 231
✅ 📋 Other 228 0 42 270
Total 4060 74 687 4821

❌ Failed Tests

🌍 Community Worlds (74 failed)

mongodb (7 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNTAQDJDBSHTG1MWKF5KQBC5
  • webhookWorkflow | wrun_01KNTAQP2B6QNFW4V5CC2P3NZ1
  • fetchWorkflow | wrun_01KNTAV423VWE5AF0N1NWNCQ9T
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNTAYYWMXFXFVJ33YZ9V6ASZ
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KNTB557DNYXNH4EV8TP26TD9

redis (7 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNTAQDJDBSHTG1MWKF5KQBC5
  • webhookWorkflow | wrun_01KNTAQP2B6QNFW4V5CC2P3NZ1
  • fetchWorkflow | wrun_01KNTAV423VWE5AF0N1NWNCQ9T
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNTAYYWMXFXFVJ33YZ9V6ASZ
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KNTB557DNYXNH4EV8TP26TD9

turso (60 failed):

  • addTenWorkflow | wrun_01KNTAP9AVRTGK03SM69S63608
  • addTenWorkflow | wrun_01KNTAP9AVRTGK03SM69S63608
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNTAQDKF2QVPYWGFH6W47PC9
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNTAPGX7BKKR4ZRE58D7ZHH7
  • promiseRaceWorkflow | wrun_01KNTAPP407KBZNC5D2E7ZN7HT
  • promiseAnyWorkflow | wrun_01KNTAPQZ70DGD6CC21VAF8J21
  • importedStepOnlyWorkflow | wrun_01KNTAQT6HJ36G1K7T8WJB0J9S
  • hookWorkflow | wrun_01KNTAQ3D3TSW5YZRSJFXFR53D
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNTAQDJDBSHTG1MWKF5KQBC5
  • webhookWorkflow | wrun_01KNTAQP2B6QNFW4V5CC2P3NZ1
  • sleepingWorkflow | wrun_01KNTAQVQM7GW6GXQRDJFA1V3C
  • parallelSleepWorkflow | wrun_01KNTAR7NBH7YK2PSVB16SHS3Y
  • nullByteWorkflow | wrun_01KNTARC0FHC9PZ380HNHXCE3Q
  • workflowAndStepMetadataWorkflow | wrun_01KNTARDY46ZFS3910Z5TS8GM9
  • fetchWorkflow | wrun_01KNTAV423VWE5AF0N1NWNCQ9T
  • promiseRaceStressTestWorkflow | wrun_01KNTAV6CBHN7Y62R93F05FJBT
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNTAYC4A0HMMJ82ZAS5XHYB3
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNTAYYWMXFXFVJ33YZ9V6ASZ
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNTAZJEVBF2HY6T73YPG2SDG
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNTB05TEV77Z954JTQPRXCX6
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNTB0DPKSYDHGAPJXNE6EQJJ
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNTB0KQD8CZNSQKSNCG31HAY
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNTB0NJRSSKBJFGDY5R3EMTG
  • runClassSerializationWorkflow - Run instances serialize across workflow/step boundaries | wrun_01KNTB0ZTHFAGXWNH9HTW4NVEN
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNTB1DNEDKFTTXW4XT0S3QN9
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNTB1JSSZ6Q07R4CGC7B6CS5
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNTB1RMRHJTM9B024NEKC02R
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNTB1YQZHV70B0TM63DE4A6J
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNTB24NMAXHG41V7MZSRCHRZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNTB2AP9VTJ7DHYEG7YSE72Q
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNTB2GX4GDYF8R5ZESZN0EN4
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNTB2TR3HNFKBG0RRDT44C8S
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNTB32JA4CEPPH6MP7NF7BXW
  • cancelRun - cancelling a running workflow | wrun_01KNTB38B962CGE4Q7QRXWDP17
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNTB3GWFDJBCJPNZXTX2QSZC
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNTB3VWCNC123S1VJDNX8JS6
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNTB4FHKX1YRHE30BY5MHTZZ
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNTB4T9B5T9B4RQ3CCPBBYB2
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNTB504C25ET83GJT6S58G19
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNTB52Y4HTXATE6XC7V3EX1D
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KNTB557DNYXNH4EV8TP26TD9
  • getterStepWorkflow - getter functions with "use step" directive | wrun_01KNTB5855A2TQ9CJHJZ3H2DFP

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 83 0 7
✅ example 83 0 7
✅ express 83 0 7
✅ fastify 83 0 7
✅ hono 83 0 7
✅ nextjs-turbopack 88 0 2
✅ nextjs-webpack 88 0 2
✅ nitro 83 0 7
✅ nuxt 83 0 7
✅ sveltekit 83 0 7
✅ vite 83 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 76 0 14
✅ express-stable 76 0 14
✅ fastify-stable 76 0 14
✅ hono-stable 76 0 14
✅ nextjs-turbopack-canary 63 0 27
✅ nextjs-turbopack-stable 82 0 8
✅ nextjs-webpack-canary 63 0 27
✅ nextjs-webpack-stable 82 0 8
✅ nitro-stable 76 0 14
✅ nuxt-stable 76 0 14
✅ sveltekit-stable 76 0 14
✅ vite-stable 76 0 14
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 76 0 14
✅ express-stable 76 0 14
✅ fastify-stable 76 0 14
✅ hono-stable 76 0 14
✅ nextjs-turbopack-canary 63 0 27
✅ nextjs-turbopack-stable 82 0 8
✅ nextjs-webpack-canary 63 0 27
✅ nextjs-webpack-stable 82 0 8
✅ nitro-stable 76 0 14
✅ nuxt-stable 76 0 14
✅ sveltekit-stable 76 0 14
✅ vite-stable 76 0 14
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 76 0 14
✅ express-stable 76 0 14
✅ fastify-stable 76 0 14
✅ hono-stable 76 0 14
✅ nextjs-turbopack-canary 63 0 27
✅ nextjs-turbopack-stable 82 0 8
✅ nextjs-webpack-canary 63 0 27
✅ nextjs-webpack-stable 82 0 8
✅ nitro-stable 76 0 14
✅ nuxt-stable 76 0 14
✅ sveltekit-stable 76 0 14
✅ vite-stable 76 0 14
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 82 0 8
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 6 0 0
❌ mongodb 56 7 8
✅ redis-dev 6 0 0
❌ redis 56 7 8
✅ turso-dev 6 0 0
❌ turso 3 60 8
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 76 0 14
✅ e2e-local-postgres-nest-stable 76 0 14
✅ e2e-local-prod-nest-stable 76 0 14

📋 View full workflow run

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: dfe6ba8

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

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

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class serialization support for workflow function references (functions tagged with .workflowId) so they can cross the step serialization boundary and be rendered nicely in observability tooling.

Changes:

  • Extend core serialization reducers/revivers with a WorkflowFunction special type that reduces workflow function refs to { workflowId }.
  • Add tests covering workflow function ref serialization behavior across step return values and step arguments.
  • Add an observability reviver rendering workflow function refs as <workflow:workflowId> and ship a minor changeset.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/core/src/serialization.ts Adds WorkflowFunction to special-type serialization and revives it to { workflowId } across external/workflow/step contexts.
packages/core/src/serialization.test.ts Adds unit tests for WorkflowFunction reducer/reviver behavior and boundary roundtrips.
packages/core/src/serialization-format.ts Adds o11y rendering of WorkflowFunction values as <workflow:...>.
.changeset/workflow-function-serialization.md Declares a minor release for the new serialization capability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +656 to +658
WorkflowFunction: {
workflowId: string;
};
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

SerializableSpecial was extended with WorkflowFunction, but the public Serializable union in packages/core/src/schemas.ts was not updated accordingly (see the note above this interface). This can cause TypeScript to still reject workflow function references in places typed as Serializable (e.g., step args), even though runtime serialization now supports them. Please update Serializable to explicitly include the workflow function reference shape you intend to support (and/or a dedicated workflow-metadata type), so the type-level contract matches the runtime behavior.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. The Serializable union in schemas.ts is primarily for type-level validation of step arguments. Since workflow function references are typically passed as the first arg to start() (which has its own overloaded type signature accepting WorkflowFunction | WorkflowMetadata), they don't flow through the generic Serializable type path. If we find cases where this causes type errors, we can add it then.

Comment thread packages/core/src/serialization.test.ts Outdated
// A function without workflowId or stepId cannot be serialized
await expect(
dehydrateStepReturnValue(plainFn, 'wrun_test', undefined)
).rejects.toThrow('serialization');
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The assertion .rejects.toThrow('serialization') is unlikely to match the actual error message thrown by dehydrateStepReturnValue(), which is formatted as "Failed to serialize …" (and does not necessarily contain the substring "serialization"). This test may be flaky or fail consistently depending on the underlying error. Prefer matching on the stable prefix/message produced by formatSerializationError (e.g., "Failed to serialize") or use a regex that matches the expected error text.

Suggested change
).rejects.toThrow('serialization');
).rejects.toThrow('Failed to serialize');

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed. Changed to .rejects.toThrow('Failed to serialize') which matches the stable prefix from formatSerializationError.

Comment on lines 375 to +377
StepFunction: serializedStepFunctionToString,
WorkflowFunction: (value: { workflowId: string }) =>
`<workflow:${value.workflowId}>`,
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

observabilityRevivers gained a WorkflowFunction renderer, but serialization-format.test.ts has coverage for the other built-in display revivers (ReadableStream, StepFunction, Instance, Class) and currently none for WorkflowFunction. Please add a focused test that verifies { workflowId: "..." } renders as <workflow:...> so this o11y output remains stable.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added. New test in serialization-format.test.ts verifies observabilityRevivers.WorkflowFunction({ workflowId: '...' }) renders as <workflow:...>.

@TooTallNate TooTallNate merged commit 9513a81 into main Apr 10, 2026
160 of 169 checks passed
@TooTallNate TooTallNate deleted the fix/workflow-function-serialization branch April 10, 2026 06:04
@ghost ghost mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants