fix(loop): run applyCompression over the unpruned view - #197
Open
ranxianglei wants to merge 1 commit into
Open
Conversation
…xt-pi#195) The streaming loop ctx passed processedMessages (pruned view with acp_summary_* stripped) to applyCompression, so active blocks whose raws were pruned had no resolvable anchor — bN promotion failed with the self-contradictory 'already compressed' error. Add a dedicated compressMessages field (unpruned originalMessages) used only by applyCompression; wire rebuilds keep using the pruned view.
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.
Feature branch (split out of #194 per review: features and releases stay separate).
Problem
The streaming compress path fed
applyCompressiona view that had neitherthe raw messages nor the rendered summaries:
server.tsrunCompressLoop ctx:messages: prepared.processedMessages.length > 0 ? prepared.processedMessages : prepared.originalMessagesprocessedMessages = stripKernelSummaries(turn.messages)filters everyacp_summary_*idloop/core.tsexecuteProxyTool →stream.tsapplyCompression({ messages: ctx.messages })With kernel ≥0.0.37 (billion-context-pi#195 fix), block anchors resolve via the
rendered summary or surviving raws — a view containing neither can resolve
nothing, so compression of any pruned region fails in streaming mode.
Fix
Split the two purposes of
LoopCtx.messages:compressMessages?: CoreMessage[]onRewriteCtx(src/stream.ts) andLoopCtx(src/loop/core.ts)applyRangesusesctx.compressMessages ?? ctx.messages(src/stream.ts)server.tsrunCompressLoop setscompressMessages: prepared.originalMessages(full unpruned log — anchors always resolvable)Non-streaming paths already used
originalMessages— no change for them.Validation
Ships in the next release together with the acp-kernel bump (≥0.0.40 for
billion-context-pi#195/#199 fixes).