Repository navigation
perf(sandbox): collapse runs of lines that differ only in numbers - #461
Merged
Merged
Conversation
Command output already folded runs of identical lines. A test run prints thousands of `test case_N ... ok` lines that differ only in N, and every later request carried them. A run of eight or more such lines now keeps its first and last line with a count between. Lines that break the shape (FAILED) are kept; lines of bare numbers are data and never collapse. bench_tokens.py (two turns, o200k): session input 188,396 -> 135,092 (-28%), uncached 31,994 -> 18,668 (-42%). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 25, 2026
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.
Why
clean_terminal_outputalready folds identical repeated lines, but a test run prints thousands of lines liketest case_N ... okthat differ only in N. Inscripts/bench_tokens.pythat one result (request 6) is ~12k tokens and every later request carries it again.What
After the identical-line pass, a run of 8 or more lines whose shape matches once digit runs become
#keeps its first and last line, with[N similar lines; only the numbers differ]between them.test case_77 ... FAILED) ends the run and is kept.Measured (release, Windows, o200k, two-turn script)
Checks
cargo test --libfor sandbox (63), agent (769), tools (538): all pass🤖 Generated with Claude Code