Repository navigation
[PR] kernel: root-cause fix for kernel-compress batch — truncated-input misdiagnosis (#6946) + compress-orphan boundary pin (#5455) - #6983
ranxianglei wants to merge 10 commits into
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.12482-pr.6983.49e03d6This 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.
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
(ai: vllm-qwen/qwen3.8-27b) 再次接冲突,已解决并推送,merge 状态实时核实为干净( 本次做了什么:
本地定向验证(合并后全过):
CI 状态:新 head 的 CI 正在跑。镜像缓存显示上一 head( 一个观察(非阻塞):这个 PR 在等 owner 批准期间,每次 master 的 kernel 版本前进都会制造一次同样的版本串冲突,需要重接 + 重 bump。机械可解(本次即为例证),但若批准周期还长,可以考虑 owner 直接 merge 时让 GitHub 自动解(版本行取 master 后手动 bump),或批准前由本车道保持定期重接——按现状我会在每次唤醒时重接,无需决策。 结构化八问
收工判定:冲突已清、本地验证全过、CI 在新 head 上运行中;剩余路径仍是 CI 绿 + owner 对 kernel 变更的 human-only 批准与合并。 |
…ed, not content-not-array (#6946) Rebased onto master (kernel 0.0.203). The salvage fix (parse-compress-input.ts + test) is byte-identical to the original; the kernel version is bumped 0.0.203 -> 0.0.204 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.
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
(ai: vllm-qwen/qwen3.8-27b) 第三次接冲突,已解决并推送,merge 状态实时核实为干净( 本次做了什么:
本地定向验证(合并后全过):
CI 状态:新 head 的 CI 正在跑,绿/红等完成后确认,若红按流程先查 #4599。 复发说明:这是本 PR 等批准期间的第三次同类冲突(11-20、11-23、本次),模式完全一致:master 的 kernel 版本前进 → 版本串撞号 → 重接 + 重 bump。机械可解,每次唤醒即重接;若 owner 近期不打算批准,也可以考虑直接关闭本 PR 让 #6946/#5455 的修复以新分支重出——但这需要 owner 决策,本车道不擅自做。 结构化八问
收工判定:冲突已清、本地验证全过、CI 在新 head 上运行中;剩余路径仍是 CI 绿 + owner 对 kernel 变更的 human-only 批准与合并。 |
…ed, not content-not-array (#6946) Rebased onto master (kernel 0.0.208). The salvage fix (parse-compress-input.ts + test) is byte-identical to the original; the kernel version is bumped 0.0.208 -> 0.0.209 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.
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
(ai: vllm-qwen/qwen3.8-27b) 第四次接冲突,已解决并推送,merge 状态实时核实为干净( 本次做了什么:
本地定向验证(合并后全过):
CI 状态:新 head 的 CI 正在跑,绿/红等完成后确认,若红按流程先查 #4599。 复发说明:第四次同类冲突(11-20 / 11-23 / 11-24 / 本次),模式不变:master 的 kernel 版本前进 → 版本串撞号 → 重接 + 重 bump。本 PR 已挂了近 9 天,期间 master 的 kernel 版本从 0.0.200 走到了 0.0.210。每次重接都消耗一次全量 CI 通过。如果 owner 近期不打算批准,建议直接关闭本 PR、以新分支重出(冲突成本一次性付清);若近期会批准,本车道继续每次唤醒重接即可。此选择需要 owner 拍板,本车道不擅自做。 结构化八问
收工判定:冲突已清、本地验证全过、CI 在新 head 上运行中;剩余路径仍是 CI 绿 + owner 对 kernel 变更的 human-only 批准与合并。 |
…ed, not content-not-array (#6946) Rebased onto master (kernel 0.0.210). The salvage fix (parse-compress-input.ts + test) is byte-identical to the original; the kernel version is bumped 0.0.210 -> 0.0.211 to satisfy the version-discipline gate (kernel/src changed). This is the 4th rebase of this PR. This PR is superseded by #6983 (the rcagg aggregation carries the same fix as a faithful cherry-pick). Close after #6983 merges.
# Conflicts: # kernel/package-lock.json # kernel/package.json # package-lock.json
Resolve kernel version collision: master 0.0.217 + this PR's parse-compress-input change -> 0.0.218 (kernel-guard requires a bump for kernel/src changes); both lockfiles synced.
(ai: vllm-qwen/qwen3.8-27b) Sixth conflict re-landed, resolved and pushed; merge state live-verified clean ( What I did this run:
Local verification after merge (all green):
CI state: the mirror check cache still refers to the previous head Recurrence note (sixth time: 11-20 / 11-23 / 11-24 / 11-25 / 11-28 / this run): the PR has now been open ~13 days while master's kernel version walked 0.0.200 → 0.0.217. The option I raised to the owner last run stands: ① keep re-landing on each wake (status quo, what I did here) vs ② close and re-cut on a fresh branch to pay the conflict cost once. Still awaiting owner's call; until then this lane maintains ①. 结构化八问
收工判定:冲突已清、本地验证全过、新 head CI 运行中(旧 head 镜像缓存为全绿);剩余路径仍是 CI 绿 + owner 对 kernel 变更的 human-only 批准与合并。 |
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.