fix: allow repeated automatic compaction - #354
Open
injectiver wants to merge 2 commits into
Open
Conversation
Xiashangning
added a commit
to Xiashangning/cursor-byok
that referenced
this pull request
Aug 27, 2026
Brings in two fixes from leookun#354: - fix: allow repeated automatic compaction - fix: estimate compaction from projected history Semantic conflicts resolved in server/tests/tool_loop.rs: updated the new repeated-compaction test to the current ModelConfigInput fields (effort_options, context_options) and PromptCompiler::new signature.
Xiashangning
added a commit
to Xiashangning/cursor-byok
that referenced
this pull request
Aug 27, 2026
Brings in two fixes from leookun#354: - fix: allow repeated automatic compaction - fix: estimate compaction from projected history Semantic conflicts resolved in server/tests/tool_loop.rs: updated the new repeated-compaction test to the current ModelConfigInput fields (effort_options, context_options) and PromptCompiler::new signature.
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
Motivation
A long Agent run can compact successfully and then receive another multi-megabyte tool result. The previous one-shot guard prevented a second compaction, so the next provider request could fail with
context_too_large. Reusing the same automatic-summary event ID also caused the store to reject a second summary with different content.Testing
cargo test -p cursor-server --lib automatic_compaction_can_run_again_after_the_revision_advancescargo test -p cursor-server --lib oversized_tool_results_are_bounded_only_in_provider_projectioncargo test -p cursor-server --test tool_loop one_run_can_auto_compact_again_after_more_tool_outputThe integration regression test produces two consecutive 4 MiB Read results in one Agent run and verifies the sequence normal call → compaction → normal call → compaction → final call. Each provider projection is limited to 64 KiB, while both complete results remain stored in SQLite.