Repository navigation
[PR] kernel: root-cause fix for kernel-compress batch — truncated-input misdiagnosis (#6946) + compress-orphan boundary pin (#5455) - #6983
Conversation
…ed, not content-not-array (#6946) The vLLM-style gateway stringifies the compress content array, so content arrives as a JSON string of the array. When that string is cut mid-stream the prefix is a clean JSON-array start followed by EOF. The line-form fallback misread the JSON prefix as headerless prose and reported content-not-array / no-valid-ranges, steering the model away from a format that was legal all along. Three facets in parse-compress-input.ts: 1. salvageContentEntries recovers complete depth-0 STRING entries (not just {...} objects); a partial trailing string is dropped, never guessed. 2. An EOF gate in the string-content fallback: when the fence-stripped content starts with '[' and looksTruncated (unbalanced brackets / unterminated string = mid-stream cutoff), classify as truncated via finishSalvage instead of the line-form ladder. Balanced-but-malformed input keeps today's path (no regression). 3. Record diag.length + rawPrefix for a truncated stringified content array so the host argCorruption receipt fires instead of the misleading array-wrap hint. kernel-change: fix input-parse misclassification of truncated stringified content arrays; the host argCorruption receipt already exists, no host change needed. (cherry picked from commit 4ba234d)
#5455: stripOrphanedToolCalls (prune.ts:625) exempts every compress call by name, so it cannot distinguish a genuinely-pending call from one that was answered in the input but whose result was covered away. The state is currently UNREACHABLE through the pipeline (no producer), but the exemption means it would ship an unanswered compress tool_call if it ever became reachable. No behavior change — this pins the boundary with tests only: B (prune side): fix the misleading comment in carrier-advertise-validate.test.ts that claimed stripOrphanedToolCalls 'drops any call whose result left the view' (untrue for compress calls, which are exempt). Add a tripwire test showing an answered compress call whose result is covered still survives the orphan strip, contrasted with an ordinary answered call whose result is covered (stripped). C' (apply side): pin the pair-atomicity invariant at the source — applyCompression never emits a block with a tool-result lacking its adjacent tool-call. This is the invariant that keeps the #5455 state unreachable. No kernel/src change, no version bump (tests only).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11007-pr.6983.2386d4eThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6983.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 本 PR 即 owner 裁决(2026-11-16 "修复走聚合 issue 统一出 PR")下的 kernel-compress 聚合唯一修复 PR(#5455 + #6946 合一);独立 PR #6970 被本 PR 取代(cherry-pick CI 状态(已实时核实):head 49f19da 的 CI 唯一失败是
已执行: |
(ai: vllm-qwen/qwen3.8-27b) 审核结论:代码与行为核实通过,可合入(kernel 变更属 human-only 审核档,合并由 owner 执行;#6970 被本 PR 取代,合入后请关闭)。 查重: 不重复——本 PR 即 owner 裁决下的 kernel-compress 聚合唯一修复 PR;#6970 为其被取代的独立分支。 我独立验证了什么(非照抄 PR 描述):
结构化八问
一处小观察(非阻塞):PR 正文用 |
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决并推送,merge 状态已实时核实为干净( 本次做了什么:
本地定向验证(合并后全过):
CI 状态:新 head 的 CI 正在跑(镜像 check 缓存仍停在 11-16 的旧 head,暂无法实时确认绿/红;若红,按 CI 协调流程先查 #4599 再处置)。 结构化八问
收工判定:冲突已清、本地验证全过、CI 在新 head 上运行中;剩余路径是 CI 绿 + owner 对 kernel 变更的 human-only 批准与合并。 |
[ework] CI fix verified green ✓ |
…ed, not content-not-array (#6946) Rebased onto master (kernel 0.0.200). The salvage fix (parse-compress-input.ts + test) is byte-identical to the original; the kernel version is bumped 0.0.200 -> 0.0.201 to satisfy the version-discipline gate (kernel/src changed). This PR is superseded by #6983 (the rcagg aggregation carries the same fix as a faithful cherry-pick). Close after #6983 merges.
Root-cause aggregation: kernel-compress (2 items)
This is the unified root-cause fix PR for the
kernel-compressaggregation batch (mirror #6980 / GitHub #6979). Per the owner's ruling on both member issues (2026-11-16): "修复走聚合 issue 统一出 PR" — the fix ships through this single aggregation PR.Fixes
contentis misdiagnosed askind=content-not-array; no salvage path recognizes truncated JSON-array input | 尾部截断的 compress 入参被误诊为 content-not-array,现有 salvage 均不识别截断的 JSON 数组 #6946 — [Bug][compress] Tail-truncated tool-call content misdiagnosed as content-not-arrayWhat this PR does
#6946 (cherry-picked from #6970 with
-x, authorship preserved): the compresscontentstring (a JSON-array doc as a string) was tail-truncated on the wire and misdiagnosed askind=content-not-array/no-valid-rangesinstead oftruncated. Three facets, all inkernel/src/parse-compress-input.ts, host zero-change:salvageContentEntriesrecovers complete depth-0 STRING entries (a partial trailing string is dropped, not the whole salvage).[thatlooksTruncated→ classify astruncatedviafinishSalvage, skipping the line-form ladder.diag.length+rawPrefixfor truncated string content so the hostargCorruptionreceipt fires.Kernel version bump 0.0.198 → 0.0.199 (with both lockfiles synced, #3782).
#5455 (new, tests only — no
kernel/srcchange, no extra version bump):stripOrphanedToolCalls(kernel/src/prune.ts:625) exempts every compress call by name, so it cannot distinguish a genuinely-pending call from one answered in the input whose result was covered away. The state is currently UNREACHABLE through the pipeline (no producer), but the exemption means it would ship an unanswered compress tool_call if it ever became reachable. This PR pins the boundary with tests only (zero behavior change):carrier-advertise-validate.test.tsthat claimedstripOrphanedToolCalls"drops any call whose result left the view" (untrue for compress calls, which are exempt). Adds a tripwire test: an answered compress call whose result is covered still survives the orphan strip, contrasted with an ordinary answered call whose result is covered (stripped).applyCompressionnever emits a block with a tool-result lacking its adjacent tool-call. This is the invariant that keeps the kernel: distinguish answered compress orphans from genuinely pending calls #5455 state unreachable.Note on #6970
#6970 is the standalone PR for #6946. Its core fix is cherry-picked here (with
-x). Per the owner's ruling that the fix ships through the aggregation PR, #6970 is superseded by this PR and should be closed after this merges.Testing
parse-compress-input,prune-orphan-mcp,carrier-advertise-validate,tool-pair-integrity(124 tests, 0 fail).testlanes on the pushed head.kernel-change
kernel-change: #6946 truncated-input misdiagnosis fix (parse-compress-input.ts, owner-approved "go ahead 内核允许改") + #5455 boundary pin (tests only, no src change). Both member issues carry owner approval for the kernel change.