Repository navigation
perf(session): keep the tail of a spilled tool result, not just its head - #478
Merged
Merged
Conversation
An old tool result moved to disk kept its first 400 chars and a pointer. For a failed build that is the first warnings; the error and exit code at the end were gone, so the model had to read the file back or rerun the build to recall why it failed. The same 400 chars now split into a 160-char head and a 240-char tail (starting on a whole line when it can), around the pointer line. The stand-in stays under the shake cap and costs the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an old tool result is spilled to disk (
spill_old_tool_results), the transcript stand-in keeps 160 chars of the head and 240 of the tail around the pointer line, instead of the first 400 chars only:The tail starts on a whole line when it contains a line break.
Why
In the dev token workload the failed build's spilled stand-in showed the sandbox notice and the first warning — nothing about why it failed. Build and test output ends with what matters (the error,
test result:, the exit code);cap_tool_text_toalready keeps head + tail for fresh results for the same reason.Cost
Same 400-char budget (
SPILL_HEAD_CHARS→SPILL_KEEP_CHARS, plusSPILL_TAIL_CHARS = 240), still under the shake cap, so token use and the shrink-batch accounting are unchanged.Tests
spilled_build_output_keeps_its_last_whole_lines: head kept, tail starts on a line and ends with the error and exit code, omitted count right, under the shake cap; a body with no line break keeps a raw 240-char tail.spill_old_tool_results_keeps_head_and_pointerunchanged and passing (same omitted count).🤖 Generated with Claude Code