feat(eve): step state - persist delta returns for workflow replay - #3507
AndrewBarba wants to merge 1 commit into
Conversation
Signed-off-by: Andrew Barba <barba@hey.com>
Bundle + Package Summary:
|
| Area | Metric | Baseline | Current | Delta |
|---|---|---|---|---|
| Package | Packed tarball | 8.77 MB | 8.77 MB | +4.0 kB |
| Package | Unpacked publish size | 32.74 MB | 32.75 MB | +7.0 kB |
| Package | Installed footprint | 78.82 MB | 78.83 MB | +7.0 kB |
| Package | Published files | 4018 | 4022 | +4 |
| Package | Installed files | 7978 | 7982 | +4 |
| Package | Installed package instances | 33 | 33 | 0 |
| Package | Distinct installed package names | 32 | 32 | 0 |
| Package | Installed dependency edges | 51 | 51 | 0 |
| Package | Installed optional peer edges | 8 | 8 | 0 |
| Runtime | Unique function payloads | 2 | 2 | 0 |
| Runtime | Total function bytes | 20.39 MB | 20.44 MB | +54.5 kB |
| Runtime | Public routes | 18 | 18 | 0 |
Changed function payloads vs main (505601b) (2)
| Function | Status | Baseline | Current | Delta | Route changes |
|---|---|---|---|---|---|
functions/__server.func |
changed | 10.19 MB | 10.22 MB | +27.2 kB |
none |
functions/.well-known/workflow/v1/flow.func |
changed | 10.19 MB | 10.22 MB | +27.2 kB |
none |
eve init install
| Metric | Baseline | Current | Delta |
|---|---|---|---|
| Installed footprint | 117.05 MB | 117.05 MB | +7.0 kB |
| Installed packages | 113 | 113 | 0 |
| dependencies | 4 | 4 | 0 |
| devDependencies | 2 | 2 | 0 |
| Dependency package bytes | 49.41 MB | 49.42 MB | +7.0 kB |
| devDependency package bytes | 5.04 MB | 5.04 MB | 0 B ➖ |
Build Metadata
- Preset:
vercel - Nitro:
nitro@3.0.260903-beta - Output directory:
apps/fixtures/weather-agent/.vercel/output - Build metadata timestamp: 2026-09-18T11:51:35.626Z
- Route aliases: 18 public, 1 internal (19 total aliases)
- Vercel routes in config: 21
- Severity legend: 🔴 dominant/large, 🟠 notable, 🟡 watch, ⚪ small
Package Drill-Down
Package Details
- Package:
eve@0.60.0 - Package directory:
packages/eve - Tarball: 8.77 MB (
eve-0.60.0.tgz) - Unpacked payload: 32.75 MB across 4022 published files
- Installed footprint: 78.83 MB across 7982 installed files
- Installed root package: 31.28 MB
- Installed dependencies: 47.55 MB
- Installed package instances: 33
- Distinct installed package names: 32
- Installed dependency edges: 51
- Installed optional peer edges: 8
- Runtime dependencies: 2
- Peer dependencies: 6 (5 optional)
Installed footprint is measured from an isolated temporary npm install of the packed tarball.
Graph metrics read only package.json files in package directories directly beneath a node_modules boundary, including nested boundaries. Each directory is one package instance; distinct names come from those manifests. Dependency edges count each unique name in dependencies or optionalDependencies per instance; optional peer edges count peerDependencies marked optional.
Heavy installed dependencies
eve: 31.28 MB (39.7%)@rolldown/binding-linux-x64-gnu: 19.10 MB (24.2%)ai: 7.58 MB (9.6%)zod: 6.76 MB (8.6%)undici: 3.51 MB (4.5%)
Publish payload breakdown
Published file size
🔴 dist/src/compiled/shadcn-registry/index.js [#############...........] 9.70 MB 29.6%
🟠 dist/src/compiled/@photon-ai/chat-adapter-ime... [###.....................] 2.29 MB 7.0%
🟠 dist/src/compiled/@ai-sdk/code-mode/index.js [#.......................] 1.03 MB 3.1%
🟡 dist/src/compiled/@vercel/blob/index.js [#.......................] 902.9 kB 2.8%
🟡 dist/src/compiled/_chunks/workflow/signal-exi... [#.......................] 514.5 kB 1.6%
🔴 Other published files [########################] 18.31 MB 55.9%
Installed footprint breakdown
Installed package size
🔴 eve [########################] 31.28 MB 39.7%
🔴 @rolldown/binding-linux-x64-gnu [###############.........] 19.10 MB 24.2%
🔴 ai [######..................] 7.58 MB 9.6%
🔴 zod [#####...................] 6.76 MB 8.6%
🟠 undici [###.....................] 3.51 MB 4.5%
🟠 nitro [#.......................] 1.89 MB 2.4%
🔴 Other installed packages [#######.................] 8.71 MB 11.0%
Runtime dependencies (2)
| Package | Range | Notes |
|---|---|---|
nitro |
3.0.260903-beta |
|
undici |
8.9.0 |
Peer dependencies (6)
| Package | Range | Notes |
|---|---|---|
@opentelemetry/api |
^1.0.0 |
optional peer |
ai |
catalog: |
|
braintrust |
^3.0.0 |
optional peer |
dd-trace |
^6.13.0 |
optional peer |
just-bash |
^3.1.0 |
optional peer |
microsandbox |
^0.5.0 |
optional peer |
eve init install drill-down
eve init install details
- Command:
eve init my-agent - Package manager:
npm - Installed footprint: 117.05 MB across 9876 installed files
- Installed packages: 113 total (107 transitive-only)
- dependencies: 4 direct packages totaling 49.42 MB
- devDependencies: 2 direct packages totaling 5.04 MB
- Other transitive package files: 62.59 MB
Installed footprint is measured from an isolated temporary eve init my-agent using the current packed eve tarball.
Heavy installed dependencies
eve: 31.28 MB (26.7%)@typescript/typescript-linux-x64: 27.95 MB (23.9%)@rolldown/binding-linux-x64-gnu: 19.10 MB (16.3%)zod: 10.37 MB (8.9%)ai: 7.58 MB (6.5%)
Installed footprint breakdown
Installed package size
🔴 eve [########################] 31.28 MB 26.7%
🔴 @typescript/typescript-linux-x64 [#####################...] 27.95 MB 23.9%
🔴 @rolldown/binding-linux-x64-gnu [###############.........] 19.10 MB 16.3%
🔴 zod [########................] 10.37 MB 8.9%
🔴 ai [######..................] 7.58 MB 6.5%
🟠 undici [###.....................] 3.51 MB 3.0%
🔴 Other installed packages [#############...........] 17.26 MB 14.7%
dependencies (4)
| Package | Range | Installed size | Share |
|---|---|---|---|
@vercel/connect |
2.2.0 |
188.7 kB | 0.2% |
ai |
^7.0.105 |
7.58 MB | 6.5% |
eve |
file:eve-0.60.0.tgz |
31.28 MB | 26.7% |
zod |
4.5.4 |
10.37 MB | 8.9% |
devDependencies (2)
| Package | Range | Installed size | Share |
|---|---|---|---|
@types/node |
24.x |
2.54 MB | 2.2% |
typescript |
7.0.2 |
2.50 MB | 2.1% |
Function Drill-Down
Payload Size Graph
Unique function payload size and share of total
🔴 functions/.well-known/workflow/v1/flow.func [########################] 10.22 MB 50.0%
🔴 functions/__server.func [########################] 10.22 MB 50.0%
Top Function Payloads
🟠 functions/.well-known/workflow/v1/flow.func • 1 public route • 10.22 MB
| Metric | Value |
|---|---|
| Public routes | /.well-known/workflow/v1/flow |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 10.22 MB |
| Function files | 10.22 MB across 109 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file index.mjs is 2.11 MB (20.7%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 index.mjs [##########..............] 2.11 MB 20.7%
🟡 _libs/undici.mjs [#####...................] 980.8 kB 9.6%
🟡 _chunks/sandbox.mjs [####....................] 809.9 kB 7.9%
🟡 _chunks/chatgpt-model.mjs [###.....................] 697.6 kB 6.8%
🟡 _chunks/signal-exit-B9U6kH7R.mjs [###.....................] 616.2 kB 6.0%
🔴 Other bundled files [########################] 5.00 MB 48.9%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x",
"maxDuration": "max",
"experimentalTriggers": [
{
"type": "queue/v2beta",
"topic": "__eve776561746865722d6167656e74_wkf_workflow_*",
"consumer": "default",
"retryAfterSeconds": 5,
"initialDelaySeconds": 0
}
],
"environment": {
"WORKFLOW_PRECONDITION_GUARD": "1"
}
}🟠 functions/__server.func • 17 public routes, 1 internal alias • 10.22 MB
| Metric | Value |
|---|---|
| Public routes | //.well-known/workflow/v1/webhook/[token]/eve/v1/activity/[token]/eve/v1/callback/[token]/eve/v1/connections/[name]/callback/[attemptId]/[token]/eve/v1/connections/[name]/callback/[token]/eve/v1/health/eve/v1/info/eve/v1/session/eve/v1/session/[parentSessionId]/subagents/[callId]/[childSessionId]/stream/eve/v1/session/[sessionId]/eve/v1/session/[sessionId]/cancel/eve/v1/session/[sessionId]/clear/eve/v1/session/[sessionId]/compact/eve/v1/session/[sessionId]/reset/eve/v1/session/[sessionId]/stream/eve/v1/task-input/[token] |
| Internal aliases | /__server |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 10.22 MB |
| Function files | 10.22 MB across 109 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file index.mjs is 2.11 MB (20.7%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 index.mjs [##########..............] 2.11 MB 20.7%
🟡 _libs/undici.mjs [#####...................] 980.8 kB 9.6%
🟡 _chunks/sandbox.mjs [####....................] 809.9 kB 7.9%
🟡 _chunks/chatgpt-model.mjs [###.....................] 697.6 kB 6.8%
🟡 _chunks/signal-exit-B9U6kH7R.mjs [###.....................] 616.2 kB 6.0%
🔴 Other bundled files [########################] 5.00 MB 48.9%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x"
}Build Timing: e2e/fixtures/agent-tools-sandbox
This is an informational timing measurement inside eve build, from preflight through publication. Output-size measurement and profile writing are excluded.
Build mode: deployable Vercel build with sandbox template prewarm included.
- Build pipeline: 4.04 s -> 4.03 s (-15.2 ms) vs
main (505601b). - Timing is informational: shared GitHub runners are too variable for a hard timing budget.
Detailed phase timings vs `main (505601b)`
| Phase | Baseline | Current | Delta |
|---|---|---|---|
extension.check |
0.3 ms | 0.4 ms | +0.1 ms |
project.resolve |
0.2 ms | 0.2 ms | 0.0 ms |
workspace.create |
0.4 ms | 0.4 ms | 0.0 ms |
host.prepare |
363.4 ms | 406.4 ms | +43.0 ms |
vercel.service-prefix.resolve |
1.2 ms | 1.1 ms | -0.1 ms |
nitro.create |
316.4 ms | 320.9 ms | +4.5 ms |
sandbox.prewarm |
337.0 ms | 333.2 ms | -3.8 ms |
nitro.cache.prepare |
0.2 ms | 0.2 ms | 0.0 ms |
nitro.prepare |
0.6 ms | 0.5 ms | -0.1 ms |
nitro.public-assets |
0.6 ms | 0.5 ms | -0.1 ms |
nitro.prerender |
0.3 ms | 0.3 ms | 0.0 ms |
nitro.bundle |
2.89 s | 2.85 s | -36.6 ms |
nitro.cache.write |
0.2 ms | 0.3 ms | +0.1 ms |
vercel.workflow-function.materialize |
65.2 ms | 107.7 ms | +42.5 ms |
agent-summary.emit |
0.6 ms | 0.6 ms | 0.0 ms |
nitro.close |
0.1 ms | 0.1 ms | 0.0 ms |
output.publish |
67.1 ms | 2.9 ms | -64.2 ms |
workspace.remove |
1.4 ms | 1.2 ms | -0.2 ms |
| } | ||
|
|
||
| /** Copy-on-write keeps the pre-step checkpoint available for cancellation and background work. */ | ||
| export function applyValueDelta(before: unknown, delta: ValueDelta): unknown { |
There was a problem hiding this comment.
What do you think of fuzzy testing this module APIs eg with fast-check? Ran this and found a bug in diff when reversing props
ruiconti
left a comment
There was a problem hiding this comment.
Two performance observations from rerunning the serializer benchmark at this revision. These concern the scope of the storage savings and the evidence for net benefit; neither establishes another state-corruption defect.
| (!isRecord(current) && !Array.isArray(current)) || | ||
| Object.getOwnPropertySymbols(current).length > 0 | ||
| ) { | ||
| atomic.add("[]"); |
There was a problem hiding this comment.
One unchanged rich value disables delta savings for the entire projected state. atomic.add("[]") marks the root, so a Date anywhere in serialized context causes the context, session history, and metadata to be replaced together. This is broader than replacing only the rich subtree.
I reran the existing 32-step, 2 KiB append benchmark with compression disabled, adding only createdAt: new Date(0) to the initial serialized context and retaining it in subsequent results:
| Case | Input bytes | Full-output bytes | Delta-output bytes | Combined reduction |
|---|---|---|---|---|
| Original plain state | 1,050,116 | 1,116,449 | 81,618 | 47.76% |
| With one unchanged Date | 1,051,907 | 1,118,209 | 1,119,905 | -0.08% |
All 32 deltas in the Date case were root replacements. The fallback preserves correctness, but this should be an explicit benchmark and documented optimization boundary. If narrowing the fallback, preserve aliases across the rich value and the rest of the graph.
| globalThis, | ||
| false, | ||
| false, | ||
| false, |
There was a problem hiding this comment.
The uncompressed result demonstrates reduced duplication, but it does not yet establish the production storage/computation tradeoff. I reran this same 32-step fixture with compression enabled for both step arguments and return values:
| Compression | Input bytes | Full-output bytes | Delta-output bytes | Combined reduction |
|---|---|---|---|---|
| Disabled | 1,050,116 | 1,116,449 | 81,618 | 47.76% |
| Enabled | 14,127 | 13,893 | 9,620 | 15.25% |
The fixture repeats "x" heavily, so neither percentage should be treated as an estimate for real conversations. Capture and diff also traverse accumulated state, adding computation that the byte benchmark does not measure.
Please add compressed measurements using representative conversation payloads, plus execution-time and peak-memory measurements for the full-result and delta paths. The decision criterion is storage saved versus added computation and maintenance cost, while preserving serialization behavior.
Summary
Accumulating conversations repeat their full history and context in every turn-step input and output. Return state deltas and apply them in the owning workflow during normal replay, preserving cancellation and background-task checkpoints. Full inputs remain persisted; the 32-step serializer benchmark reduces combined state bytes by 47.8%. The state argument is separated from streams, signals, and delivery so adopting replay-derived inputs becomes
turnStep.replayInputs = [0]after upgrading Workflow.Deltas capture state before authored mutations and represent nested edits, appends, removals, and truncation. Aliased/cyclic subtrees travel together; rich values retain full replacement through Workflow's serializer. Initialization, handoffs, and other coordination steps keep their existing checkpoints. No new state store or runtime history retrieval is introduced. Total storage and diff work can still grow quadratically while full inputs remain.
Validation
pnpm buildpnpm test:unit; final session tests:pnpm --filter eve exec vitest run --config vitest.unit.config.ts src/execution/session(288 passed)pnpm test:integration(885 passed); final serializer tests:pnpm --filter eve exec vitest run --config vitest.integration.config.ts src/execution/session/turn-step-delta.integration.test.ts(3 passed)pnpm typecheck; final package check:pnpm --filter eve exec tsc -p tsconfig.json --noEmitpnpm fmt,pnpm lint,pnpm guard:invariants,pnpm docs:checkFixed 2 KiB history additions, actual Workflow serialization with compression disabled (state payload bytes, excluding streams/events):
Checklist
CONTRIBUTING.mdevepackagegit commit --signoff)