Repository navigation
fix(compression): stop asking the summary model to quote the latest task verbatim - #124966
Merged
kshitijk4poor merged 4 commits intoSep 27, 2026
Conversation
(cherry picked from commit 006e1d2)
The prior check only guarded one of the three quote-forcing directives the fix removed; a partial revert of '<exact latest user request>' or 'write the reverse signal verbatim' would reintroduce long-quote stalls unnoticed. Also call the classmethod directly and hoist the patch import to module level.
The historical_task instructions already explain that the compressor inserts a bounded, redacted snapshot after generation; repeating it in the reverse signal paragraph only adds prompt tokens.
This was referenced Sep 27, 2026
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.
Compression summaries stop copying long user messages word for word into the "Historical Task" section. Fixes #124078.
What happened
The
historical_tasksection template told the summary model to capture the user's latest unfinished input "verbatim — the exact words they used", and its examples asked for'<exact latest user request>'. On long pasted requests the summary model burned output budget reproducing them. The compressor already puts a bounded, redacted snapshot of the real latest user turn back in afterwards (_ground_historical_task_snapshot), so the verbatim copy was redundant.Change
agent/context_compressor.py: the template now asks the model to identify the task precisely but summarize it in its own words. It notes that the compressor inserts the real snapshot. The examples and the reverse-signal wording no longer demand exact quotes.tests/agent/test_context_compressor_task_heading.py: one test. It checks that each removed verbatim directive stays gone and that the snapshot still carries the full source text after the prompt change. It fails with the base template.Credit
The template fix is Charan Rathore's (@charan-rathore), cherry-picked from #124116 with authorship kept. I added the follow-up commits (the test tightening and dropping a duplicated sentence), and the contributor email map entry is commit 1.
Verification
tests/agent/test_context_compressor_task_heading.pyandtests/agent/test_context_compressor.pypass (150 at review time; the heading test file passes 2 after rebasing on current main).