Repository navigation
Replies: 3 comments
|
Refined root cause, from a second session plus a run of the current resolution path against a real settings file — this is narrower than "provider default applied wholesale". The installed catalog simply has no entry for this id, while three sibling ids are described:
OpenRouter declares Local workaround (documented field, no code change)llm-pi-ai:
providers:
openrouter:
models:
- id: deepseek/deepseek-v4.1-flash
name: Deepseek Flash v4.1
contextWindow: 1048576Verified through Three things that a harness-side fix could cover
(Separately, 1,024,000 vs 1,048,576 for the two catalog-described siblings is pi-ai catalog drift; harmless at ~2%.) The two sessions cited: |
|
Your refinement checks out against the installed build. Two things I can add — a structural reason the miss cannot be diagnosed, and a consequence that reaches the wire. Verification
and has no Why the miss is structurally undiagnosable
const contextWindow = entry.contextWindow ?? base?.contextWindow ?? request.defaultContextWindowThe A diagnostic needs no new plumbing though: at A fourth consequence, and the most severe: it reaches the wireThe resolved number is not only a scheduling input. It is handed to pi-ai as const available = model.contextWindow - estimateContextTokens(context).tokens - 4096;
return Math.min(maxTokens, Math.max(1, available));Once the conversation outgrows the believed window, Footnotes on your third point
And the collapse is a band, not a cliff: at 250,000 anchored tokens |
|
Same defect on two self-hosted gateways: 94 silent overflow verdicts, and 86 of them inside compaction We confirm the mechanism in this thread. We also add a second trigger path and a count at scale. Environment. DSH Two routes, two wrong declared values.
Both routes resolve the value through Count at scale. We counted one termination event per failure. The silent overflow verdict fired 94 times:
86 of the 94 events happened inside a compaction summary call. The discarded response was successful. The provider returned The failure text carries no number. The user sees A declaration fix removes the failure on one route. On 2026-10-08 14:00 we added a per-model Reproduce the count. # 1) Decode the multi-frame zstd session logs (read only).
# 2) Count the compaction events.
grep -h '"type":"compaction/start"' *.jsonl | wc -l # 174
grep -h '"type":"compaction/end"' *.jsonl | wc -l # 174
grep -h '"type":"compaction/summary"' *.jsonl | wc -l # 65Counting rule. Count one event when Request. Please compare the declared value with the endpoint value, and warn the user when they disagree. 同一缺陷出现在两个自建网关上:94 次静默误判,其中 86 次在压缩路径内 我们确认本帖的机制,并补上第二条触发路径与规模化计数。 环境:DSH 两条通道、两个错误的声明值:
两条通道都走 规模化计数:按「一次失败只算一次」的口径,静默溢出判定共 94 次:端点A 56 次、端点B 38 次。
94 次里 86 次发生在压缩摘要调用内。 同一区间有 174 次 被丢掉的是成功响应:提供方返回了 失败文案不含任何数字:用户只看到 改声明值即可消除该通道的失败:2026-10-08 14:00 我们给端点A 逐模型加了 复算命令:同英文段的三条 计数口径: 请求:请让声明值与端点值一致,或在两者不一致时给出提示。 |
Uh oh!
There was an error while loading. Please reload this page.
Summary
llm-pi-airesolves an unconfigured route's context window fromDEFAULT_CONTEXT_WINDOW(262,144) even when the provider publishes a larger capacity for the same model id. In this session two routes on the same profile disagreed:contextWindowmodlens-openrouter/deepseek-v4-flashopenrouter/deepseek/deepseek-v4.1-flashThe profile declares the model with only
idandname, so the default applies silently. Compaction then fires ~4× early, and the harness infers context overflow at 262,144 while the provider accepts 1,048,576.Environment
0.1.6-alpha.2, commitddefc45fbc7f8e46dd73185e68295696d1297887~/.dsh/settings.yaml:No
defaultContextWindow, no per-modelcontextWindow, no built-in catalog entry for this id.Current behavior
The harness-resolved capacity is recorded in the session's
request/contextevents:jq -c 'select(.type=="request/context") | .data' session-2496881f-sanitized.jsonlThe provider's own catalogue for that exact id, from
https://openrouter.ai/api/v1/models:Two consequences in this session:
resolveCompactSpecderivesthresholdTokens = 0.8 × 262144 = 209,715andretainTokens = 0.16 × 262144 = 41,943, so pressure compaction starts at a quarter of the usable context.isContextOverflow(message, contextWindow)is called with 262,144, so the harness declaresCONTEXT_WINDOW_EXCEEDEDfor a ~287k-token prompt that the provider served without complaint.Expected behavior
The default should not silently stand in for a capacity the provider publishes:
contextWindowfrom provider metadata when the route is reachable (thediscoverModelsseam already readscontext_length), orcontextWindow/defaultContextWindowfor a model id with no built-in entry, failing loud at load, orA 4× under-declaration is not a conservative fallback: it changes compaction scheduling, and it makes the harness reject requests the provider would accept.
Relation to existing reports
Evidence bundle
https://gist.github.com/gorban/4725c87390cb391047a2f14b56b98d28—EVIDENCE.mdsection 2, plus the full session log.All reactions