Stop stripping tool results from turns compaction chose to keep - #361
Merged
Conversation
Anchors and recent turns are pulled forward or held back specifically because they matter; stubbing their tool_result content right after undermines the reason they survived pruning. Deletes stripResultContent and the stub-building machinery it required rather than gating it off, since the discarded middle already loses its content wholesale via the summary and never needed a second stripping pass.
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.
Summary
createPruningCompactorappliedstripResultContentto bothanchorTurnsandrecentTurns— the exact turns compaction decided to keep — not just the discarded middle. A file edit pulled forward as an anchor, or one sitting two turns back in the live recent window, had its tool_result content replaced with a[... chars omitted from context; source unchanged.]stub. Anchors exist specifically to survive pruning because they're load-bearing; hollowing them out right after selecting them defeats the point.Judgment call
Stripping kept turns was never a coherent design:
recentTurnsis documented in the same function as turns that "keep live base64 so a just-pasted screenshot still reaches the model," which only makes sense if the rest of the turn's content also survives. The discarded middle (summarizedTurns) already loses its content wholesale, folded into the[Compacted prior context]summary — there was no scenario where a second, per-turn stripping pass over the kept turns was doing useful work. So this deletesstripResultContentand its stub-building machinery (buildCallIndex,buildResultStub,stripTurnResults,ToolCallInfo) rather than gating it behind a flag. Genuine tool errors were never touched by this path (stripTurnResultsalready skippedisError === trueblocks) and remain untouched now that the whole path is gone.Net change: -85/+16 lines — pure removal plus a version bump on the compactor record.
Test plan
bun run typecheckbun run buildbun run test— 3984 pass, 1 pre-existing unrelated failure (lsp-availability.test.ts, environment-dependent, fails identically onorigin/main)