Repository navigation
fix: size preflight summary output to window headroom + name empty JSON completions (#987) - #988
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-988Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr988.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Received. This is a [PR] wake-up — I will NOT redo the work. Plan: locate the PR, pull its branch, review the diff against current master, re-run typecheck / full test suite / build on the rebased head, check CI status, then report conclusions here. |
Reviewed PR #988 ( Code review — both changes hold up:
Tests: new Verification (all on rebased head
Non-blocking observations:
Conclusion: mergeable — clean single-purpose diff (8 files, +244/-25), regression tests for the exact reported failure mode, green everywhere. Per repo rules the merge itself stays with you: #988 中文摘要:核查了预检压缩在小型窗口下请求 32k 输出导致上游返回空补全、压缩死锁的修复(按窗口余量收紧 max_tokens + 精确的空补全诊断,含 finish_reason 与上游实际应答模型名)——代码审查、本地三件套与 GitHub CI 全绿,测试覆盖了报告的失败模式,可以合并。 |
932ffc6 to
df840a6
Compare
df840a6 to
3b75695
Compare
…N completions (#987) Preflight summarization always asked for max_tokens=32768 regardless of the model window. Upstreams that enforce input+output <= window answer such calls with an EMPTY completion instead of an error, so on small (often overflow- learned) windows every summary attempt was unusable and preflight dead-ended with 'no range could be compressed' — exactly the loop reported in #987 (model=subagent, learned window 16898, muse-spark answering content:''). - clamp the summary call's max_tokens to window - input estimate (floor 64, 256-token scaffolding margin); untouched when headroom is ample or unknown - diagnoseEmptySummary: a plain-JSON completion with empty content is now named as such, with finish_reason/stop_reason/status and the model id the upstream answered as (the alias-vs-real-model mismatch is the clue), instead of the misleading 'non-SSE body' message - tests: new preflight-window-clamp regression (clamp engages + invariant input+output <= window on every call; ample-headroom control); existing fixtures that identified summary calls by the literal 32768 cap value are switched to shape detection / relaxed bounds
60a396b to
064b3ad
Compare
What
Two preflight fixes for #987 ("context window problem continues", 9router + opencode v2):
max_tokens=32768regardless of the model's window. Upstreams that enforce input+output ≤ window (muse-spark behind 9router) answer such calls with an empty completion (content:"") instead of an error, so every summary attempt is unusable → "no range could be compressed" → client retry loop. Now clamped towindow − input estimate(floor 64, 256-token scaffolding margin); unchanged when headroom is ample or unknown.diagnoseEmptySummaryno longer reports "non-SSE body" for plain-JSON empty completions; it names the shape withfinish_reason/stop_reason/statusand the model id the upstream answered as — which exposes alias mismatches (request saidsubagent, upstream answeredmuse-spark-1.3-contributor).Relation to PR #992 (owner's removal work)
#992 removes the runtime window-learning mechanism (the "window keeps changing" symptom) — that half is superseded by it and no longer in this PR. This fix is orthogonal: zero file overlap with #992, independently mergeable in either order, and still needed after it — once the window is purely declarative, a correctly-declared small window (e.g.
models.subagent.context) would otherwise still dead-end preflight via the 32kmax_tokensrequest above. The clamp reads the effective declared window (deps.config.modelContextLimit).Tests
tests/preflight-window-clamp.test.ts(new): clamp engages at an 8k window — invariantinput + max_tokens ≤ windowon every summary call — and stays at 32768 with ample headroom (control).max_tokens === 32768summary-call detection in five test files (Preflight compression holds the request with zero response bytes; client undici headersTimeout (default 300s) kills it -> repeated[preflight] summarization aborted: client disconnected5-minute death loop, payload never forwarded #568 hold, wire-exit-gap cells, [Bug] 摘要请求看不到被压缩区间里的图片:renderRange 只取 m.text,图片连占位都没有 #781 images, fix: Codex preflight summaries fail with unsupported max_output_tokens #663 max-output-tokens, [Question] preflight 摘要为空就判定"上游没返回内容" —— thinking 默认模型的 reasoning_content 是否有意不参与? #853 cap) switched to shape-based detection / relaxed bounds so the clamp doesn't break them.Pre-flight (head
df840a6on masterea2b33f)typecheck ✅ · full suite 2000 pass / 0 fail / 2 skip (e2e gate) ✅ · build ✅
Addresses #987.