Skip to content

perf: avoid returning unused thread history during session resume - #382

Open
robinfai wants to merge 2 commits into
agentclientprotocol:mainfrom
robinfai:agent/exclude-unused-resume-history
Open

perf: avoid returning unused thread history during session resume#382
robinfai wants to merge 2 commits into
agentclientprotocol:mainfrom
robinfai:agent/exclude-unused-resume-history

Conversation

@robinfai

@robinfai robinfai commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • pass excludeTurns: true when ACP session/resume and session/load establish the app-server subscription
  • keep thread/read({ includeTurns: true }) unchanged for session/load, preserving full ACP history replay
  • add a narrow local type for the experimental resume field and regression coverage for both lifecycle paths

Why

thread/resume includes the reconstructed turn history by default. Neither ACP path consumes that response history: session/resume must not replay it, while session/load deliberately reads the authoritative full history with a subsequent thread/read.

In one observed run on a real legacy thread backed by a 486 MiB rollout (77 turns, 2,306 items), Codex 0.147.0 produced:

Resume request Response size Response time Client JSON parse
default 65,991,086 bytes 1,332.77 ms 32.61 ms
excludeTurns: true 1,461 bytes 1,079.24 ms 0.02 ms

This removes one unused large JSON response from both lifecycle paths. For session/load, the required full history still comes from thread/read, so the history and tool-call replay behavior introduced in #208 remains unchanged.

The adapter already opts into app-server experimental APIs and depends on @openai/codex ^0.147.0. The checked-in generated bindings currently omit experimental fields, so this uses the same local-type pattern already used for experimental thread settings instead of regenerating the whole experimental schema.

Validation

  • npm run typecheck
  • npm test — 357 passed, 28 skipped, including a transport-level assertion for the experimental JSON-RPC parameter
  • npm run build
  • npm run codex-test -- -p "Reply with exactly: resume-history-validation" -o summary — completed with end_turn (49 Codex events, 8 ACP events)
  • direct Codex 0.147.0 app-server comparison on an isolated copy of the real rollout

@robinfai
robinfai marked this pull request as ready for review August 9, 2026 16:46
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