fix: use available prompt window for document context - #6183
Open
SidheshwarSarangal wants to merge 1 commit into
Open
fix: use available prompt window for document context#6183SidheshwarSarangal wants to merge 1 commit into
SidheshwarSarangal wants to merge 1 commit into
Conversation
Author
|
Hi maintainers, just following up on this PR when you have a chance. It addresses the document-context budgeting concern from #6142 and includes a focused regression test. Please let me know if any changes are needed. Thanks. |
Author
|
Hi @timothycarambat, gentle ping when you have a chance. This PR addresses the document-context budgeting concern from #6142 and includes a regression test. I’d appreciate any feedback or requested changes. |
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
messageArrayCompressorwith a budget based on the remaining prompt-window capacity.Problem
When prompt compression was triggered, document context was limited to 75% of the system allowance. Since the system allowance was 15% of the model context window, document context could use only 11.25% of the available window—even when substantial capacity remained unused.
This caused large attached or pinned documents to be truncated much more aggressively than necessary.
Implementation
The message-array compressor now calculates the system and document-context allowance from:
The existing user-prompt and history priorities remain unchanged.
This change intentionally does not modify the tokenizer fallback behavior, which is the other concern discussed in the related issue.
Validation
Connects #6142