Skip to content

fix(eve): repair session token limit continuation - #1262

Open
ruiconti wants to merge 4 commits into
mainfrom
rui/fix-session-limit-continuation
Open

fix(eve): repair session token limit continuation#1262
ruiconti wants to merge 4 commits into
mainfrom
rui/fix-session-limit-continuation

Conversation

@ruiconti

@ruiconti ruiconti commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Three user-visible bugs in the session token-limit flow:

  1. A session hits its token limit and eve raises the "approve to continue" prompt. If the user sends a regular message instead of answering, that message replaces the pending prompt — the turn runs again, hits the limit again, and prompts again. This is the repeating-responses loop.
  2. If the user declines the prompt, the turn cancels — but settling the cancelled turn resurrected the prompt that was just answered. The stale prompt demanded an answer that had already been consumed, so every follow-up message queued behind it and the session swallowed messages.
  3. The user approves the prompt and the session continues — but the fresh budget never reaches subagent accounting. A subagent delegated after the approval inherits a zero or stale quota, so it immediately raises its own continuation prompt, and approving that prompt does nothing: a zero-token window has nothing to grant.

What

  • Keep one session_limit_continuation request pending while concurrent messages queue behind it. Pending requests are classified required or dismissable; a required request holds the batch until answered.
  • On cancelled-turn settle, drop pending harness-authored session-limit prompts instead of resurrecting them. The pre-model gate deterministically re-raises the prompt while the violation holds, so a declined root stays fail-closed on follow-up messages.
  • Track approved windows as absolute runtime token ceilings. Each approval re-anchors the ceiling to lifetime usage plus the configured limit.
  • Calculate delegated grants from the remaining runtime ceiling. A child with zero inherited quota fails fast instead of raising a prompt that cannot grant tokens; the root then parks on its own prompt.

E2E

session-token-limit-approve.eval.ts: concurrent HTTP delivery with a held-open turn, two queued messages, one prompt, and a distinct request id for the next exhausted window.

Stack

Two PRs layer on this branch: client answer handling (TUI options + approval classification) and #1273 (descendant Stop cancellation and the InputRequest.kind contract).

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
eve-docs Ready Ready Preview, Comment, Open in v0 Jul 29, 2026 3:14am
eve-docs-1644 Ready Ready Preview, Comment, Open in v0 Jul 29, 2026 3:14am
eve-docs-4759 Ready Ready Preview, Comment, Open in v0 Jul 29, 2026 3:14am

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Bundle + Package Summary: apps/fixtures/weather-agent

Key takeaways

  • No notable deltas vs main (6dc662c).

Delta vs main (6dc662c)

Area Metric Baseline Current Delta
Package Packed tarball 7.60 MB 7.61 MB +1.4 kB ⚠️
Package Unpacked publish size 28.74 MB 28.74 MB +3.7 kB ⚠️
Package Installed footprint 69.87 MB 69.87 MB +3.7 kB ⚠️
Package Published files 2855 2857 +2
Package Installed files 6328 6330 +2
Runtime Unique function payloads 2 2 0
Runtime Total function bytes 16.72 MB 16.73 MB +1.8 kB ⚠️
Runtime Public routes 11 11 0
Changed function payloads vs main (6dc662c) (2)
Function Status Baseline Current Delta Route changes
functions/__server.func changed 8.36 MB 8.36 MB +895 B ⚠️ none
functions/.well-known/workflow/v1/flow.func changed 8.36 MB 8.36 MB +895 B ⚠️ none

eve init install

Metric Baseline Current Delta
Installed footprint 108.27 MB 108.27 MB +3.7 kB ⚠️
Installed packages 123 123 0
dependencies 4 4 0
devDependencies 2 2 0
Dependency package bytes 43.06 MB 43.06 MB +3.7 kB ⚠️
devDependency package bytes 5.04 MB 5.04 MB 0 B ➖
Build Metadata
  • Preset: vercel
  • Nitro: nitro@3.0.260610-beta
  • Output directory: apps/fixtures/weather-agent/.vercel/output
  • Build metadata timestamp: 2026-07-29T03:15:59.378Z
  • Route aliases: 11 public, 1 internal (12 total aliases)
  • Vercel routes in config: 14
  • Severity legend: 🔴 dominant/large, 🟠 notable, 🟡 watch, ⚪ small
Package Drill-Down

Package Details

  • Package: eve@0.27.12
  • Package directory: packages/eve
  • Tarball: 7.61 MB (eve-0.27.12.tgz)
  • Unpacked payload: 28.74 MB across 2857 published files
  • Installed footprint: 69.87 MB across 6330 installed files
  • Installed root package: 27.39 MB
  • Installed dependencies: 42.48 MB
  • Runtime dependencies: 2
  • Peer dependencies: 5 (4 optional)

Installed footprint is measured from an isolated temporary npm install of the packed tarball.

Heavy installed dependencies

  • eve: 27.39 MB (39.2%)
  • @rolldown/binding-linux-x64-gnu: 18.96 MB (27.1%)
  • ai: 6.52 MB (9.3%)
  • zod: 5.07 MB (7.3%)
  • nitro: 2.41 MB (3.4%)
Publish payload breakdown
Published file size
🔴 dist/src/compiled/shadcn-registry/index.js       [########################] 13.15 MB 45.8%
🟠 dist/src/compiled/experimental-ai-sdk-code-mo... [###.....................] 1.51 MB 5.2%
🟡 dist/src/compiled/@vercel/sandbox/index.js       [#.......................] 632.5 kB 2.2%
🟡 dist/src/compiled/_chunks/workflow/undici-DWL... [#.......................] 502.4 kB 1.7%
🟡 dist/src/compiled/@chat-adapter/slack/index.js   [#.......................] 440.5 kB 1.5%
🔴 Other published files                            [#######################.] 12.51 MB 43.5%
Installed footprint breakdown
Installed package size
🔴 eve                             [########################] 27.39 MB 39.2%
🔴 @rolldown/binding-linux-x64-gnu [#################.......] 18.96 MB 27.1%
🔴 ai                              [######..................] 6.52 MB 9.3%
🔴 zod                             [####....................] 5.07 MB 7.3%
🟠 nitro                           [##......................] 2.41 MB 3.4%
🟠 undici                          [##......................] 1.86 MB 2.7%
🔴 Other installed packages        [#######.................] 7.67 MB 11.0%
Runtime dependencies (2)
Package Range Notes
nitro 3.0.260610-beta
undici 8.9.0
Peer dependencies (5)
Package Range Notes
@opentelemetry/api ^1.0.0 optional peer
ai catalog:
braintrust ^3.0.0 optional peer
just-bash ^3.0.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: 108.27 MB across 8198 installed files
  • Installed packages: 123 total (117 transitive-only)
  • dependencies: 4 direct packages totaling 43.06 MB
  • devDependencies: 2 direct packages totaling 5.04 MB
  • Other transitive package files: 60.17 MB

Installed footprint is measured from an isolated temporary eve init my-agent using the current packed eve tarball.

Heavy installed dependencies

  • @typescript/typescript-linux-x64: 27.95 MB (25.8%)
  • eve: 27.39 MB (25.3%)
  • @rolldown/binding-linux-x64-gnu: 18.96 MB (17.5%)
  • zod: 9.02 MB (8.3%)
  • ai: 6.52 MB (6.0%)
Installed footprint breakdown
Installed package size
🔴 @typescript/typescript-linux-x64 [########################] 27.95 MB 25.8%
🔴 eve                              [########################] 27.39 MB 25.3%
🔴 @rolldown/binding-linux-x64-gnu  [################........] 18.96 MB 17.5%
🔴 zod                              [########................] 9.02 MB 8.3%
🔴 ai                               [######..................] 6.52 MB 6.0%
🟠 @types/node                      [##......................] 2.54 MB 2.3%
🔴 Other installed packages         [##############..........] 15.90 MB 14.7%
dependencies (4)
Package Range Installed size Share
@vercel/connect 0.4.2 135.8 kB 0.1%
ai ^7.0.38 6.52 MB 6.0%
eve file:eve-0.27.12.tgz 27.39 MB 25.3%
zod 4.4.3 9.02 MB 8.3%
devDependencies (2)
Package Range Installed size Share
@types/node 24.x 2.54 MB 2.3%
typescript 7.0.2 2.50 MB 2.3%
Function Drill-Down

Payload Size Graph

Unique function payload size and share of total
🔴 functions/.well-known/workflow/v1/flow.func     [########################] 8.36 MB 50.0%
🔴 functions/__server.func                         [########################] 8.36 MB 50.0%

Top Function Payloads

🟠 functions/.well-known/workflow/v1/flow.func • 1 public route • 8.36 MB
Metric Value
Public routes /.well-known/workflow/v1/flow
Runtime nodejs24.x
Handler index.mjs
Payload 8.36 MB
Function files 8.36 MB across 44 files
Traced dependencies 0 B
Signal 🟠 Bundled file index.mjs is 2.27 MB (27.1%)

🟠 🔎 Dependency Analysis

📦 Bundled files:

Bundled file size
🟠 index.mjs                       [#######################.] 2.27 MB 27.1%
🟠 _chunks/runtime-artifacts.mjs   [################........] 1.59 MB 19.0%
🟡 _libs/undici.mjs                [##########..............] 980.5 kB 11.7%
🟡 _chunks/sandbox.mjs             [########................] 768.8 kB 9.2%
🟡 _libs/@ai-sdk/gateway+[...].mjs [####....................] 432.8 kB 5.2%
🟠 Other bundled files             [########################] 2.33 MB 27.8%

🧾 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 • 10 public routes, 1 internal alias • 8.36 MB
Metric Value
Public routes /
/eve/v1/callback/[token]
/eve/v1/connections/[name]/callback/[token]
/eve/v1/health
/eve/v1/info
/eve/v1/session
/eve/v1/session/[sessionId]
/eve/v1/session/[sessionId]/cancel
/eve/v1/session/[sessionId]/stream
/eve/v1/session/reset
Internal aliases /__server
Runtime nodejs24.x
Handler index.mjs
Payload 8.36 MB
Function files 8.36 MB across 44 files
Traced dependencies 0 B
Signal 🟠 Bundled file index.mjs is 2.27 MB (27.1%)

🟠 🔎 Dependency Analysis

📦 Bundled files:

Bundled file size
🟠 index.mjs                       [#######################.] 2.27 MB 27.1%
🟠 _chunks/runtime-artifacts.mjs   [################........] 1.59 MB 19.0%
🟡 _libs/undici.mjs                [##########..............] 980.5 kB 11.7%
🟡 _chunks/sandbox.mjs             [########................] 768.8 kB 9.2%
🟡 _libs/@ai-sdk/gateway+[...].mjs [####....................] 432.8 kB 5.2%
🟠 Other bundled files             [########################] 2.32 MB 27.8%

🧾 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: 1.98 s -> 1.95 s (-35.5 ms) vs main (6dc662c).
  • Timing is informational: shared GitHub runners are too variable for a hard timing budget.
Detailed phase timings vs `main (6dc662c)`
Phase Baseline Current Delta
extension.check 9.8 ms 1.1 ms -8.7 ms
project.resolve 3.4 ms 0.6 ms -2.8 ms
workspace.create 1.2 ms 0.7 ms -0.5 ms
host.prepare 175.6 ms 135.9 ms -39.7 ms
vercel.service-prefix.resolve 2.4 ms 2.4 ms 0.0 ms
nitro.create 191.4 ms 213.1 ms +21.7 ms
sandbox.prewarm 269.5 ms 243.4 ms -26.1 ms
nitro.cache.prepare 0.3 ms 0.3 ms 0.0 ms
nitro.prepare 0.9 ms 0.9 ms 0.0 ms
nitro.public-assets 0.9 ms 0.8 ms -0.1 ms
nitro.prerender 0.4 ms 0.5 ms +0.1 ms
nitro.bundle 1.29 s 1.32 s +22.7 ms
nitro.cache.write 0.4 ms 0.3 ms -0.1 ms
vercel.workflow-function.materialize 25.0 ms 23.4 ms -1.6 ms
agent-summary.emit 0.6 ms 0.5 ms -0.1 ms
nitro.close 0.1 ms 0.1 ms 0.0 ms
output.publish 3.6 ms 3.5 ms -0.1 ms
workspace.remove 2.4 ms 2.1 ms -0.3 ms

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

A declined session-limit continuation in a delegated child settles as an unmarked done and makes the driver resume its delegating parent with a spurious empty SUCCESS subagent result, racing the terminal cancel cascade and letting the parent continue instead of being torn down.

Fix on Vercel

@ruiconti
ruiconti force-pushed the rui/fix-session-limit-continuation branch from 1eebb9e to 64884f7 Compare July 28, 2026 21:06
@vercel
vercel Bot temporarily deployed to Preview – eve-docs-4759 July 28, 2026 21:23 Inactive
@ruiconti
ruiconti force-pushed the rui/fix-session-limit-continuation branch from e2b6a33 to 0cb21db Compare July 28, 2026 21:52
@vercel
vercel Bot temporarily deployed to Preview – eve-docs-4759 July 28, 2026 22:54 Inactive
@ruiconti
ruiconti force-pushed the rui/fix-session-limit-continuation branch 2 times, most recently from 14d3bfa to 28a2e7d Compare July 28, 2026 23:21
@ruiconti
ruiconti force-pushed the rui/fix-session-limit-continuation branch from 28a2e7d to 6d88417 Compare July 29, 2026 02:51
ruiconti added 4 commits July 28, 2026 23:05
Signed-off-by: Rui Conti <ruiconti@gmail.com>
…able

resolvePendingInput encoded the answer-or-defer rule as an inline
predicate disjunction (approval || session-limit continuation). Name the
classification instead: classifyInputRequest returns "required" (explicit
answer only; other input defers behind the pending batch so the request
ids being answered never churn) or "dismissable" (a follow-up message
resolves the request as an ignored tool-result and the model continues).
Every model-anchored request is dismissable by construction, so the
default is total; the two required kinds document their reasons inline.

Signed-off-by: Rui Conti <ruiconti@gmail.com>
…tles

A cancelled turn settles with the step's input snapshot, which resurrects
the continuation prompt the decline just answered — the answer was
consumed inside the discarded turn state. The stale prompt classified as
required, so every follow-up message deferred behind an answer that could
never come: messages were swallowed and the promised re-raise never
happened. The cancelled-turn settle now drops pending harness-authored
session-limit prompts (the pre-model gate deterministically re-raises
them while the violation holds); model-anchored batches such as tool
approvals are kept because their tool calls still require resolution.

Splitting input-request-class.ts out of input-requests.ts hosts the
required/dismissable classification and the shared approval predicate in
a module protocol clients can import directly (the dev TUI no longer
reaches into the resolution module), and keeps input-requests.ts under
the 700-line structural cap that the new helper would otherwise breach.

Signed-off-by: Rui Conti <ruiconti@gmail.com>
A delegated child with zero inherited quota now fails fast instead of
raising a continuation prompt that could never grant tokens, so the
decline scenario moves to the root's own prompt: the child's error
returns to the root, the root parks on its own continuation prompt, and
declining it cancels the turn while keeping the session resumable.

Signed-off-by: Rui Conti <ruiconti@gmail.com>
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.

2 participants