SIGN IN SIGN UP

Stop output buffer resend in terminal_interaction stdin path (#270)

* Fix O(N²) memory growth in exec_command_output_delta fallback

When the ACP client does not advertise terminal_output capability,
exec_command_output_delta accumulated each chunk into active_command.output
and then re-sent the entire growing buffer as a ToolCallUpdate content
block on every chunk. The mpsc notification channel is unbounded, so for
N chunks the in-flight queue holds 1 + 2 + ... + N copies of the buffer
and the process RSS grows quadratically until the kernel kills it.
rg/find/fd are classified as Search/ListFiles by the parser and always
hit this fallback regardless of client capability.

Match claude-agent-acp's behavior: in the non-terminal fallback,
accumulate silently in the delta handler and emit one ToolCallUpdate
with the full formatted content block at exec_command_end. Skip the
content emission for commands that produced no output to avoid
surfacing empty fenced code blocks. Total wire traffic is now O(N)
end-to-end, and codex-acp RSS stays flat across large rg/find runs.

Closes #225.

* Stop output buffer resend in terminal_interaction stdin path

terminal_interaction's non-terminal fallback appended each stdin event
into active_command.output and re-sent the entire growing buffer as a
ToolCallUpdate content block. This is the same accumulate-and-resend
shape that #225 fixed in exec_command_output_delta, just keyed on
stdin events instead of stdout chunks.

Mirror the prior fix: in the non-terminal fallback, accumulate stdin
into the buffer silently and let exec_command_end emit the full
content block exactly once at completion. The terminal-output fast
path is untouched.

Stacked on top of the exec_command_output_delta fix.
A
Alexandre Cordeiro committed
8aef91bc08de288531fc694248b5a370d5a3ade5
Parent: 0c2d828
Committed by GitHub <noreply@github.com> on 5/22/2026, 1:39:52 PM