Skip to content

fix(coding-agent): bound and retain final tool result text - #199

Merged
ZouR-Ma merged 3 commits into
mainfrom
fix/tool-output-retention
Sep 28, 2026
Merged

ZouR-Ma merged 3 commits into
mainfrom
fix/tool-output-retention

Conversation

@MelodyVAR

Copy link
Copy Markdown
Collaborator

Large MCP/extension results, validation errors, and denied-call messages could bypass built-in output limits. Add a content-only final result boundary and let coding-agent retain complete text privately before publishing a 2,000-line/50-KiB preview with a readable artifact path. This also covers calls that never reach afterToolCall and later message_end replacements, while preserving execution-hook semantics and tool termination, usage, metadata, and images.

Retention failures describe potentially completed effects rather than encouraging a blind repeat. Tests cover UTF-8, empty text blocks, JSON-quoted paths containing newlines, denied/invalid calls, images, cleanup, and storage failures. Arbitrary typed details and streaming progress are outside this text-retention policy. Related to the closed #175 proposal.

Validation:

  • Focused agent-core and retention/session regressions passed.
  • npm run check
  • pnpm run build:offline
  • ./test.sh with isolated credentials

MelodyVAR and others added 3 commits September 27, 2026 17:53
A tool result with images is sent in block form, and whitespace-only text
blocks were forwarded unchanged. The API rejects them, and the result stays
in history, so every later request in the session fails. Drop them as the
user and assistant paths already do; the image placeholder still applies
when no text remains.
Native bash keeps the last 2,000 lines / 50 KiB, then appends its notice and
exit status, which puts the result just over the final bound. The head-only
pass then cut exactly that tail: the last lines, the full-log path and
"Command exited with code N" of a failed build. Allow 8 lines and 1 KiB of
trailer before bounding; larger results are still bounded as before.
@ZouR-Ma
ZouR-Ma merged commit 92eba18 into main Sep 28, 2026
2 checks passed
@ZouR-Ma
ZouR-Ma deleted the fix/tool-output-retention branch September 28, 2026 12:07
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.

2 participants