Repository navigation
Commit 5754597
fix(preemptive-compaction): use MIN_PROMPT_BUDGET_TOKENS as floor, not ceiling
The minPromptBudget calculation used Math.min, making 8000 the upper bound
for the ratio-based prompt budget. For small-context models (e.g. phi3:mini
at 4096 tokens), the ratio-based value was only 2048, leaving barely any
room for the actual prompt after reserve tokens were subtracted.
Change Math.min to Math.max so MIN_PROMPT_BUDGET_TOKENS acts as a true floor,
ensuring models under 16k context receive at least half the window for prompt
content. Large models are unaffected since the ratio-based value already
exceeds 8000.
Closes #96658
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent 4ecb45b commit 5754597
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
| |||
0 commit comments