Repository navigation
fix(compression): keep lite from truncating the latest tool results - #15037
Merged
diegosouzapw merged 2 commits intoSep 29, 2026
Merged
Conversation
The default "Standard Savings" compression combo runs session-dedup then lite, and lite cut every role:"tool" message to 2000 chars, including the results of the tool calls the model just made. The model never saw past the cut, so it re-read the file; the re-read was cut again or deduped against the cut copy, and OpenAI-format agents (Cursor IDE, Kilo/OpenCode) looped on the same read. Skip tool messages after the last assistant message, matching the current-turn exemption session-dedup already has. Older turns are still truncated.
diegosouzapw
merged commit Sep 29, 2026
2c60f35
into
diegosouzapw:release/v3.8.51
9 of 16 checks passed
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.
Problem
The default compression combo ("Standard Savings":
session-dedup→lite) runs for every key with compression enabled.lite.compressToolResultscut everyrole:"tool"string to 2000 chars (…[truncated]), including the results of the tool calls the model had just made.The model never saw past the cut, so it read the file again. The re-read was cut again, or deduped by
session-dedupinto a[dedup:ref]pointing at the cut copy, and OpenAI-format agents (Cursor IDE, Kilo/OpenCode) looped on the same read. A Cursor IDE session on our deployment re-read the same two files 15+ times; every result was 2007–2015 chars ending in…[truncated], including the newest.Anthropic-format
tool_resultblocks are not affected, sincecompressToolResultsonly handles stringrole:"tool"messages.Fix
Skip tool messages after the last assistant message, which are the results of the latest tool calls. This is the same current-turn rule
session-dedupalready applies. Older turns are still truncated. A body with no assistant message keeps the previous behaviour.Tests
tests/unit/compression/lite-current-turn.test.ts:session-dedup+litepipeline.Reproduced and verified against a real model through a local router with an OpenAI-format agent that uses a Kilo-style
readtool, and with Cursor IDE's own system prompt and tool set replayed. Before the fix, 3/3 runs looped 12 reads without an answer, and 0/3 answered with the Cursor IDE shape. After the fix, 3/3 answered correctly in 1–2 reads.The compression suites show the same failures as the base tip (
previewRouteFuzzyfuzzyDedup CCR marker,#7849heap test). Neither is touched by this change.