fix(context): bound full-compaction retention by token capacity - #454
Draft
zhengdaqi wants to merge 3 commits into
Draft
Conversation
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
V24R12 Case 09 showed that full summarization could succeed while the proposed post-compact request remained blocking. The planner selected a 35% tail by message count and then retained up to eight protected frames independently, so a few large tool-result frames could exceed the intended exact-retention share.
This stacked draft changes full compaction to share one token budget across the exact tail and protected prefix. Older protected frames that do not fit are summarized rather than silently dropped, tool call/result pairs remain atomic, and the newest complete frame is retained for the existing post-compact fail-closed evaluator.
Do not merge this PR, or the preceding convergence stack, until the fresh Case 09 product Gate passes with completion proof and a substantive validated report.
Changes
keepTailRatioagainst estimated canonical-message tokens instead of message count.QA & Evidence
.omo/evidence/20260727-v24r13-capacity-aware-compaction/QA.md..omo/evidence/20260727-v24r13-capacity-aware-compaction/preserved-session-comparison.md.npm testrebuilt the project and passed 313/313 tests with zero failures, skips, or cancellations.git diff --checkpassed; dependency lockfiles were unchanged.Risks & Residuals
Stack
codex/convergence-v24r12-boundary-signal-accounting(fix(agent): account for repair signals delivered at boundaries #453)