Repository navigation
[PR] fix: refuse unservable compress ranges on an empty view instead of tombstoning live refs - #3863
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4909-pr.3863.d9905f9This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3863.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 本 PR 是 #3859(空视图 compress 把活引用永久记成 DEAD)的唯一修复 PR。同家族条目:#3126(已关,原 gate 出处)、#2362(kernel dead-ref pass 机制来源)。本 PR 的 CI 红与内容无关——是继承自 master 的两处静态门禁红,在途 PR #3871 已在修同一根因,不另立项、不并列开修。 标签: bug / pi / scope/kernel / p2(缺陷类;Pi 插件车道触发;上下文管理核心逻辑;p2——tombstone 在下次模型请求后自愈,窗口期内只有误导性 DEAD 状态与回执,非数据丢失)。 独立审核结论(不复述 issue 侧分析)机制核实——报告里的损坏链是真的,且闭合是精确的:
本地验证(定向,全量留给 CI):
diff 卫生: 3 文件 +183/-25,每一行都在本 PR 目的内;无 kernel/ 改动、无配置面、无版本变更;master 领先 10 提交但未触碰 src/stream.ts 或受影响测试 → 干净合并,无热文件竞争。 CI 现状(唯一一次 run @ head): 全部门禁通过,除 结构化八问
判定代码审查通过,可合入。当前唯一阻塞是继承自 master 的两处静态门禁红(非本 PR 引入,#3871 在途修复);#3871 合入后本分支需一次 rebase/空推以在此 head 上取得完整 core-matrix 绿,即可由人工合并。 |
26465c6 to
573ae42
Compare
573ae42 to
0100282
Compare
…mbstoning live refs (#3859) The no-visible-context guard (#3126) exempted any request whose range SPAN-OVERLAPPED an active block span. The kernel's dead-ref test (danglingMessageRefs) judges per BOUNDARY ref, not per span overlap: a range can overlap one block while its boundary refs sit in gaps between blocks. On an evicted/restarted session (view=0, refs mapped) such requests passed the gate, reached applyCompression with an empty message list, and the kernel recorded those still-live refs as DEAD — committed by the host even when zero blocks were created. The gate now mirrors the kernel's own test: on an empty view with mapped refs it yields to the kernel only when every requested range's message-ref boundaries are point-covered by some active block's effectiveMessageIds (block-ref boundaries carry no raw id and can never be tombstoned). That set equals exactly the shapes the kernel can serve from state alone (#403/#2748 restoredInline refold, already-compressed warnings); everything else is refused up front with zero state writes, retryable once the next model request restores the view. Tests: flipped issue3126 test (e) (block-touching request on empty view is now refused, no dead refs) and added tests/issue3859-no-visible-context-overlap.test.ts (multi-range gap-boundary shape refused whole-batch; mixed batch refused; pure b-ref distillation still yields to the kernel with its honest already-compressed warning; non-empty-view negative row). refold-wiring suite (state-alone refold landing, #2748 net-shrink, negative control) stays green.
0100282 to
4af1753
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决:分支已 rebase 到当前 master( 语义组合核查(本次 rebase 的真正风险点):master 期间合入的 #3982 家族(3 个提交)重构了本 PR 改的同一处拒收路径——把 gate 抽成导出函数 结构化八问
收工判定:冲突已清,PR 处于可合状态,等 CI 绿后由人工合并即可;agent 侧无后续动作。 |
Rebased 2026-10-21 onto current master (56a0f5a) — master moved twice during review (#3918 among others); the final rebase preserves upstream's new refusal-tail wording verbatim and drops the two incidental gate-fix commits below, which landed upstream independently in the meantime.
Closes #3859
What
The #3126 no-visible-context gate had a span-overlap exemption: any requested range overlapping an active block span handed the whole batch to the kernel even when the message view was fully empty. The kernel's dead-ref pass (#2362) tombstones per BOUNDARY ref not point-covered by an active block — span overlap ≠ per-ref coverage — so the reporter's ranges (overlapping some of 15 active blocks, boundary refs in the gaps between them) escaped the gate, failed to anchor (nothing anchors on an empty view), and their uncovered boundary refs were permanently recorded as DEAD. The host commits the cloned state even when zero blocks land, so the tombstones persisted.
Fix (host-side,
src/stream.tsonly)On an empty view with mapped refs, the gate now yields to the kernel ONLY when every message-ref boundary of every range is point-covered by some active block's
effectiveMessageIds— exactly the shapes the kernel can serve from state alone without writing anything new: the #403/#2748 in-place refolds and their "already compressed" /gate:no-net-shrinkdiagnostics. Block-ref boundaries are never examined by the kernel's dead-ref pass, so purebN..bMdistillation calls stay vouchable. Anything else is refused as a whole batch up front — zero state writes — keeping the existing retry-after-next-model-request receipt wording.The predicate mirrors
danglingMessageRefs(kernel/src/compress.ts) line-for-line, so host and kernel cannot drift apart again over which refs would get tombstoned.Behavior change (old → new)
gate:no-visible-context, zero state writes; retry after the next model request restores the viewWhy not a fully unconditional refusal (the issue's first proposal): it regresses the pinned #403/#2748 behavior — after a full-block inline restore, a later same-span re-compress must still land from state alone (tests/refold-wiring.test.ts pins all three variants, including proxy-shaped empty views). The coverage-vouch rule closes exactly the corruption door without touching those paths.
The kernel-side alternative (distinguishing unavailable input messages from genuinely dead refs before writing tombstones) was considered and rejected: the kernel treats
input.messagesas the authoritative client view by contract and cannot know the host evicted its transient copy; the disambiguating signal exists only host-side, where #3126 already placed the guard. No changes underkernel/.Config surface
None — no config fields, env vars, or CLI flags added or changed.
Tests
tests/issue3126-no-visible-context.test.ts: the block-touching pin (which asserted the old pass-through) now asserts the refusal plus no dead refs.tests/issue3859-no-visible-context-overlap.test.ts: the reporter's multi-range shape (partial overlaps + gaps → refused, no deadRefs, blocks untouched); a mixed batch with ONE uncovered range → refused as a whole; a pure block-ref call → still reaches the kernel's own diagnostics with no dead refs; non-empty-view negative row.tests/refold-wiring.test.ts(ACP_PASSTHROUGH one-click silent kill of all compression: no logs / no banners / panel invisible and non-clearable, all sibling env knobs take effect in silence | ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #403/手动 compress 仍接受零/负净收益折叠,先改写缓存再提示上下文增长 #2748 pins) green unchanged; adjacent compress suites green locally (typecheck + build clean). Full-suite verdict left to CI on this head.顺手修复的既有 master 红(独立标注 commit,与 #3859 无关)
CI 验证本 PR 时发现两个门禁在 master 上已红(查重:open/closed issue 与 PR 均无对应条目):
storage.unified的 pre-Storage wrap-up: 6 fixes + switch default mode to full (single PR) | 存储收尾六修 + 缺省模式翻 full(一个 PR 统一处理) #3818-flip 默认值行、storage.sqliteAutoDownload的 pre-SQLite unified storage degraded to legacy-only (bili v0.1.201, node v20.19.5, win32-x64) #3788 冷却文案行),与生成器输出不符。已在 master 独立合入(原 commit81f6654ba):从website/config-reference/*.yaml重新生成,删除陈旧行(纯删 4 行,无语义变化)。src/log-mask.ts的maskUrlForPublish([security][web] Diagnostics blob prints private relay hosts verbatim in the config section — the "secrets masked" header only masks values, not hosts | 诊断包 config 段原样输出内网中转地址:标题说"密钥已遮蔽",但只遮值不遮主机 #3811)无任何模块 import(仅同文件maskUrlsForPublish调用),export 属死面。已在 master 独立合入(原 commit26465c656):去掉export关键字转模块私有,零行为变更。两者均为各 guard 规定的机械修复。最终 rebase 到 56a0f5a 后这两个修复已随上游存在,本 PR 收敛为单一 fix commit(573ae42),不再重复携带。