Compaction threshold is scaled against the full context window, so it can sit above what the provider admits #5123
Replies: 1 comment
|
Verified against the current source (0.1.2-alpha.1, cd5ef81 — 0a53fb5 is a version-only release bump, same code), and your numbers check out. Confirmations plus one structural detail that strengthens the fix: Threshold math confirmed. Structural gap (adds to your patch rationale): the model catalog already carries the output cap. One nuance on "compaction never runs": there is a post-failure backstop. Both adapters classify provider overflow wording into |
Uh oh!
There was an error while loading. Please reload this page.
An OpenAI-compatible provider rejects prompt + max_tokens > contextWindow. The output a request reserves is therefore room history can never occupy, but compaction-basic scales thresholdRatio against the whole window. On a route with a reserved output cap the threshold lands above the prompt the provider will accept: every turn is refused for context overflow while pressure never qualifies, so compaction never runs.
Concrete numbers from a vLLM route: window 158 368, output cap 16 384. Default thresholdRatio 0.8 puts the threshold at 126 694 tokens, but the provider only admits 141 984 tokens of prompt — the threshold is 0.89 of what is actually usable, and the run wedges before it is reached.
The fix is to subtract the reserved output before the ratios scale. A patch against master is here: — a reservedOutputTokens policy field defaulting to the adapter's per-request output cap, and to zero when none is configured, so existing configurations keep their current behavior.
I understand external PRs are not accepted right now; raising it here in case it is useful.
All reactions