Skip to content

fix(compression): stop asking the summary model to quote the latest task verbatim - #124966

Merged
kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:fix/p1i-0927-t2b-historical-task-no-verbatim
Sep 27, 2026
Merged

kshitijk4poor merged 4 commits into
NousResearch:mainfrom
kshitijk4poor:fix/p1i-0927-t2b-historical-task-no-verbatim

Conversation

@kshitijk4poor

Copy link
Copy Markdown

Compression summaries stop copying long user messages word for word into the "Historical Task" section. Fixes #124078.

What happened

The historical_task section 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.py and tests/agent/test_context_compressor.py pass (150 at review time; the heading test file passes 2 after rebasing on current main).
  • Reviewed in two rounds (code review, reuse, quality, efficiency, tests/probes/mutation); round 2 all approved.

kshitijk4poor and others added 4 commits September 27, 2026 13:56
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.
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint area/compression Context compression and continuation sessions labels Sep 27, 2026
@kshitijk4poor
kshitijk4poor merged commit ad4e449 into NousResearch:main Sep 27, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compression Context compression and continuation sessions comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Compaction template's verbatim quote makes Codex withhold the summary stream for 90-210 s

3 participants