Repository navigation
Fit over-budget views without weakening required content protection - #49
Merged
Merged
Conversation
Brian Krabach (bkrabach)
marked this pull request as ready for review
October 9, 2026 23:10
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.
Dense recent history can leave a request over budget even after the last compaction level, because historical machine reminders still receive percentage-based recency protection. A synthetic retained request fails at 17,123 estimated tokens against a 10,000-token budget on the previous source.
After the normal ladder, add one budget-fit pass that relaxes only the recent-message fraction. The existing protection logic continues to preserve current required injections, first/latest human prompts, loaded-tool metadata, and protected tool-result groups. Requests already within budget do not take this pass. Required content that cannot fit still fails, with failed-retention state rolled back and canonical history unchanged.
Validation in owned DTU
dtu-unified-public-readiness-20261008, using synthetic state and no credentials:This addresses a reproduced defect discovered while investigating a spark-1 local context failure. The production event reported 854,567 estimated tokens after compaction against an 853,104 effective budget; its saved diagnostics do not provide an exact retained-content breakdown. This PR is not a claim of end-to-end recovery of that conversation. Live state has not been edited or retried; integrated runtime qualification is complete as described below; actual-session recovery remains separate.
Integrated qualification in the same owned DTU: