Skip to content

Spill oversized tool results into the committed blob store - #585

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-6965-oversized-tool-results-should-spill-to-a-file-the-agent-can
Aug 23, 2026
Merged

Spill oversized tool results into the committed blob store#585
TheGreatAxios merged 1 commit into
mainfrom
cl-6965-oversized-tool-results-should-spill-to-a-file-the-agent-can

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Closes CL-6965.

Results over MAX_RESULT_CHARS (grep, run_shell, search_files, web_fetch, MCP) were truncated with the tail discarded, so recovering it meant re-running the command. Measured consequence in the trace data behind CL-6961: the model re-pays for output it already generated.

What changed

The full pre-cut content is written via ContextStore.writeBlob, so it is staged into the same commit as the turn that produced it, and the notice names the resulting tool-output:///{key} URI to read back with read_file.

That last part matters beyond convenience: CL-6908 recorded the size cap telling the model "full output available" while pointing at content that had already been truncated, and the truncation plugin has carried a comment ever since forbidding a promise it could not keep. Going through the blob store makes the promise real.

Why it is committed, not cleaned up

An earlier revision of this work wrote to a tool-output-spill directory beside the blob store and told the model the file would be "removed when this session ends." Nothing removed it, and nothing staged it either — so the output was neither cleaned up nor part of the record.

Spilled tool output belongs in the immutable git turn history alongside every other input, output, and tool result. There is no cleanup policy, no size cap, and no eviction, and the notice makes no lifetime claim.

Honest fallback

With no blob store (tests, ad-hoc toolsets) the notice says the remainder is not retrievable and re-running gives the same cut, rather than naming a handle that would not resolve.

read_file is unaffected — it is short-circuited by the guard plugin before this cap and got a resumable cursor in CL-6961 instead.

Verification

bun run check green in full.

@linear-code

linear-code Bot commented Aug 23, 2026

Copy link
Copy Markdown

CL-6965

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

All contributors have signed the CLA.
Posted by the CLA Assistant Lite bot.

Results over MAX_RESULT_CHARS were truncated and the tail was simply
lost, so a model that needed the rest had to re-run the command. The
notice could not offer a way to recover it — the plugin's own comment
forbade promising blob retrieval it could not honor.

The full pre-cut content is now written through ContextStore.writeBlob,
which stages it for the same commit as the turn that produced it, and the
notice names the resulting tool-output:/// URI for read_file. Spilled
output is part of the immutable session record rather than a temporary
file: no cleanup, no cap, no eviction.

With no blob store configured the notice says the remainder is not
retrievable rather than claiming a capability that does not exist.
@TheGreatAxios
TheGreatAxios force-pushed the cl-6965-oversized-tool-results-should-spill-to-a-file-the-agent-can branch from bb1d63f to 8c414b5 Compare August 23, 2026 22:06
@TheGreatAxios
TheGreatAxios merged commit c936749 into main Aug 23, 2026
5 checks passed
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