Repository navigation
Compaction threshold is scaled against the full context window, so it can sit above what the provider admits #5123
Replies: 3 comments
|
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 |
|
补一个不同 provider 上的复现,以及一个原帖没提到的下游后果。 环境:dsh 0.1.5-rc.1,deepseek-flash,contextWindow 1048576,adapter 默认 按你帖里的算法:阈值 = 0.8 × 1048576 = 838860,而 DeepSeek 实际接受的消息上限是 我这边和你那边的症状不一样,可能是窗口/输出上限比例不同导致的:
于是后果变成"能压,但每次都从 overflow 进"。我数了本机 8 次完整压缩:
overflow 分支写死 所以除了你说的"阈值算错会导致压根压不了",在窗口比输出上限大得多的 provider 上,这条 bug threshold math 那边 argszero 已经核过了,我就不重复。 (原始文档与复现脚本在本地工作区,需要细节我可以贴。) 影响的能力
|
|
Related but a different quantity, worth keeping separate from the reserved-output fix: in the session I measured, the resolved window itself was wrong, not just the ratio applied to it.
OpenRouter publishes For the ratios in this proposal that gives Also relevant to your patch: the harness did infer Reported separately: #7213 Evidence: https://gist.github.com/gorban/4725c87390cb391047a2f14b56b98d28 |
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