Repository navigation
compaction: hold the next pass when the last one bought no room - #1687
Merged
Merged
Conversation
An automatic compaction that left the context over the compaction point fired again on the next step. When the provider's compacted state, or a summary that must keep a long live turn verbatim, could not get under the line, every step paid a compaction and the model reread what it had just lost. A compaction that leaves the context over the line within one step now holds the next one until the context grows by a twentieth of the window, or reaches the 95% wall where recovery may trim. The in-stream server directive uses the same raised threshold while holding, so the server does not compact on every request either. Fixes #1686
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.
Fixes #1686.
Root cause
An automatic compaction that left the context over the compaction point fired again on the next step. That happens when the provider's compacted state, or a summary that must keep a long live turn verbatim, can't get under the line. Every step then paid a compaction, and the model reread what it had just lost. The existing stall guard (#706) only catches repeated cuts at the same history boundary. A compaction that "succeeds" but leaves the context over the line rewrites history, so the guard reset on every pass.
Fix
compact_backoff.zig. If the pre-send gate is still over the line within one step of a history rewrite, the next compaction is held until the context grows by a twentieth of the window.Tests
compact_backoff: hold after a no-room compaction, release on growth, the 95% wall and real relief end a hold, and a compaction that bought several steps is not treated as a stall.