Skip to content

Avoid repeated CLI output string concatenation#12

Open
rohangpta wants to merge 1 commit into
SprocketLab:mainfrom
rohangpta:fix/cli-utils-stream-buffering
Open

Avoid repeated CLI output string concatenation#12
rohangpta wants to merge 1 commit into
SprocketLab:mainfrom
rohangpta:fix/cli-utils-stream-buffering

Conversation

@rohangpta

@rohangpta rohangpta commented May 27, 2026

Copy link
Copy Markdown
Contributor

Why

stream_cli_command keeps complete stdout/stderr for the fallback RuntimeResult while also buffering partial lines for parser callbacks. Long-running CLI agents can produce large streams, and repeated += copies the accumulated string on each chunk, adding avoidable CPU and memory churn.

This is scoped to the shared CLI-agent helper after runtime events have already been emitted; it does not change runtime stream processing.

What Changed

  • Accumulate stdout/stderr chunks in lists and join only when draining parser buffers or building the fallback RuntimeResult.
  • Share stdout/stderr line-buffer flushing through a small helper.
  • Add a focused unit test for split stdout/stderr chunks and fallback output preservation.

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