fix: compression summaries always role:assistant (Bug 39)#80
Closed
ranxianglei wants to merge 2 commits into
Closed
fix: compression summaries always role:assistant (Bug 39)#80ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
Previously, compression summaries were merged into the following user message when one existed (Bug 36 merge path), giving them role:'user'. This caused models to misattribute their own prior compression recaps as user instructions. Bug 37 already solved the original reason for the merge path (AssistantMessage field fabrication). This commit removes the merge path entirely — all summaries are now standalone role:'assistant'. Changes: - prune.ts: Remove dual-path logic, always use standalone assistant - prune.ts: Remove dead findNextSurvivingMessage function - tests: Update 6 tests across prune.test.ts + e2e-message-transform.test.ts issue #13
The breakdown and tool-output reminder only showed 5 candidates, causing the model to compress too narrowly (1 message per batch). Increasing to 15 gives the model more compression candidates at once. Changed: - utils.ts: largestRanges 10→15, largestToolRanges 5→15 - inject.ts: toolOutputReminder topRanges 5→15 issue #13
This was referenced Jul 8, 2026
Closed
Owner
Author
|
Superseded by v1.11.0 (PR #95). This PR's approach (force all summaries to v1.11.0 takes a different approach: summaries are injected as synthetic tool-call + tool-result pairs ( Recommend closing this PR. |
Owner
Author
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
Fixes the issue where compression summaries were sometimes injected as
role: "user", causing models to misattribute their own prior compression recaps as user instructions.Root Cause
filterCompressedRanges()inlib/messages/prune.tshad two injection paths:role: "user", the summary was merged INTO that user message — giving itrole: "user".role: "assistant"synthetic message was created.Bug 36 originally rejected the standalone path because
AssistantMessagerequired fields. Bug 37 solved this. The merge path was no longer necessary but remained as a source of role confusion.Changes
lib/messages/prune.ts: Remove merge path, always use standalone assistantlib/messages/prune.ts: Remove deadfindNextSurvivingMessagefunctiontests/prune.test.ts: 3 tests updated for standalone assertionstests/e2e-message-transform.test.ts: 3 tests updated for standalone assertionsVerification
issue #13