Skip to content

perf(agent): stop accumulating generator-tool preliminaryResults - #110

Open
LukasParke wants to merge 2 commits into
mainfrom
lukeparke/dev-817-drop-preliminary-results
Open

perf(agent): stop accumulating generator-tool preliminaryResults#110
LukasParke wants to merge 2 commits into
mainfrom
lukeparke/dev-817-drop-preliminary-results

Conversation

@LukasParke

@LukasParke LukasParke commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes DEV-817.

Stop copying every generator-tool yield into a per-call array that lives until the call settles. Yields are still broadcast live via onPreliminaryResult; the terminal tool.result event no longer carries the full history.

This is the remaining isolate-memory landmine from the @openrouter/agent 0.9.0 review. PR #109 already covers opt-in replay compaction. This PR covers executor / ModelResult accumulation.

What

  • executeGeneratorTool no longer pushes validated yields into preliminaryResults.
  • ModelResult no longer accumulates preliminaryResultsForCall or attaches it to the terminal result event.
  • toolResultsToMap / summarizeToolExecutions stop forwarding the unused array.
  • Public types keep the optional field for compatibility; the runtime no longer populates it.

Why

Fusion-style generator tools stream for minutes inside a 128MB Worker isolate. Broadcasting live is enough; retaining every yield until settle is O(total streamed bytes) and is the same failure mode the openrouter-web bun patch exists to stop.

The getUsage() / getToolCalls() trim-unaware replay half of DEV-817 is already handled by PR #109 (initialResponse cache + getInitialResponse()).

Test plan

  • pnpm lint / pnpm typecheck in packages/agent
  • pnpm test in packages/agent: 96 files, 1153 tests

Open in Devin Review

Yields are still broadcast live. The executor and ModelResult no longer
copy every yield into a per-call array or onto the terminal tool.result
event.

Fixes DEV-817.
devin-ai-integration[bot]

This comment was marked as resolved.

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.

1 participant