You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Responses tool outputs are individually capped at 16,384 chars, but a parallel batch is not checked as an aggregate before the next model request.
Agent.runTurn() currently does request -> stepResponses/runTools -> request with no context check between the tool results being appended and the continuation request. Normal auto-compaction is in mainloop.zig after a completed turn, which is too late for this path.
OpenAI Codex comparison
The upstream openai/codex turn loop checks active context after sampling/tool execution and, when another sampling iteration is needed, runs MidTurn compaction before the continuation request (codex-rs/core/src/session/turn.rs). It also combines server usage with local estimates for newly appended items.
Symptom
A Codex turn requested six
read_filecalls in parallel and the immediate continuation failed with:The model was
gpt-5.6-solvia the Codex provider.Why the previous fixes do not fully cover it
last_context_tokens >= compactAt().Agent.runTurn()currently doesrequest -> stepResponses/runTools -> requestwith no context check between the tool results being appended and the continuation request. Normal auto-compaction is inmainloop.zigafter a completed turn, which is too late for this path.OpenAI Codex comparison
The upstream
openai/codexturn loop checks active context after sampling/tool execution and, when another sampling iteration is needed, runsMidTurncompaction before the continuation request (codex-rs/core/src/session/turn.rs). It also combines server usage with local estimates for newly appended items.Proposed fix
Agent.runTurn(), including between tool-loop iterations.function_call_outputitems crossingcompactAt().