Repository navigation
Description
[bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs),本地估计冲过窗口后 preflight 永久 fail-fast —— 而同一 payload 上游本来能过(566K / 750K)
bili version
0.1.197(dist/build-info.json commit 3aeddc16)—— 当前最新 release,已在最新版复现。
Usage mode
Plugin native(bili 作为 dsh 插件的代理实例运行;dsh profile bundle 托管,跳过 in-place 自更新)
Client and version
DeepSeek Harness (dsh) web profile,OpenAI 兼容协议 /v1/chat/completions,流式 SSE。
客户端已排除:
git log 36acfb1e88..f2235d6c02 --no-merges -- packages/llm packages/core/agent-loop packages/compaction packages/context packages/session在 dsh 0.2.1-alpha.3 → 0.2.1-alpha.4 之间只返回版本号 bump 本身,没有任何窗口 / token / 消息形状改动;dsh 全树 grep 不存在750000/750_000字面量,也没有任何「按历史长度压缩 max_tokens」的代码路径(唯一的 history-dependent max_tokens 用途是 compaction 的 output 预留,不是下调)。
Operating system
Windows 11(非 WSL2),Node v26.8.1
Upstream and model
OpenAI 兼容聚合端点(forward POST → http://<private-host>:8317/v1/chat/completions),模型 deepseek-v4.1-flash。本会话生效窗口 750,000(= native 1,000,000 − 250,000 output 预留,见 [headroom] 行)。
Compression-related config
sessions:
residentMaxBytes: 4294967296
storage:
unified: full
jsonWriter: "off"
compress:
preserveRecentMessages: 5披露:本机对
dist/index.js打过一个与本题无关的本地补丁MAX_REQUEST_BYTES 100MiB → 512MiB(src/request-body-budget.ts:1),因为该会话单次请求体 118.8 MiB 会撞 413 硬上限。折叠 / 估算 / preflight 路径未被改动。
症状
会话 session-f72157bf-245b-4680-97f8-bd953bd51225 在一次 compress 之后约 19 秒起,每一次请求都被 preflight 拒绝:
preflight fail-fast 502 (retryable=false): context ~1653471.9370616362 tokens exceeds the
model window 750000 (model=deepseek-v4.1-flash), with 1 compressible range(s) still visible
and preflight compression could not bring it under: futile round: the maximum possible saving
from all foldable content (~7292 tokens, including the relaxed recent zone) is below the
required reduction (~906149.5634184747 tokens) — no combination of folds can bring the payload
under the target. Raise the model context window or restart the session. The over-window
payload was NOT forwarded.
会话从此永久不可用:dead-end cooldown 每 ~20 秒重新武装(preflight dead-end cooldown active (N s left); failing fast without upstream calls (#726)),从 20:40 到 22:59 共 2 小时 19 分仍在原地打转,无自愈。/__bili/* 管理路由表里没有任何清除 dead-end 的入口。
关键:被拒的 payload 其实完全放得下
拒绝发生前 10 分钟,同一会话每一轮都被上游正常计费,outbound 稳定在 1.8 MiB:
| 时间 (UTC) | processTurn |
outbound |
上游计费 input |
|---|---|---|---|
| 20:34:31 | 250 msgs | 1.8MiB | 554,071 |
| 20:35:25 | 253 msgs | 1.8MiB | 556,094 |
| 20:36:13 | 256 msgs | 1.8MiB | 556,970 |
| 20:37:47 | 259 msgs | 1.8MiB | 568,348 |
| 20:38:56 | 253 msgs | 1.8MiB | (568,348) |
| 20:39:09 | — | 1.8MiB | 566,200 |
| 20:40:16 | ← compress(8 个「块」范围) | ||
| 20:40:35 | 519 msgs |
— | — |
| 20:40:48 | preflight 触发 local-est=1653364 |
— | — |
即:outbound 连续 10 分钟稳定 1.8 MiB、上游计费 552,702–568,348,离 750,000 窗口还有约 180K 余量,preflight 一次都没触发过。一次压缩之后却变成「超窗口 2.2 倍」。压缩不可能让 payload 变大 2.9 倍,所以这是压缩路径自身把 live view 撑大了。
触发链(逐字日志)
20:38:41.790 [acp-compress-obs] shrink 0% (~5415/28649739 tok) foldPoint=m22480 blocks=2
anchor≈58538 tok (76 active blocks, sys excluded) postCtx≈28644324
20:38:56.418 [acp-drift] fold coverage mismatch: 21273/21307 covered message id(s) present
in resent history — 34 covered id(s) missing from resent history (#1195)
20:38:56.419 processTurn: 253 msgs, renderTags=text-only, 13 text tagged, 0 tool tagged
20:39:09.301 request: 14943 msgs, inbound=118.7MiB, outbound=1.8MiB, local=15387ms
20:39:49.833 [acp-usage] input=566200 cached=543488 (cache hit 96%) fold=new
20:40:16.172 [acp-proxy: compress requested 8 range(s): b134–b138, b356–b364, b411–b423,
b516–b523, b680–b686, b819–b825, b907–b912, b994–b1001]
20:40:16.175 [acp-proxy: ctx has 250 message(s), state has 22499 ref(s) mapped]
20:40:17.405 [acp-compress-obs] shrink 0% (~50064/28652038 tok) foldPoint=b134 blocks=4
anchor≈19828 tok (36 active blocks, sys excluded) postCtx≈28601974
20:40:17.501 [acp-proxy: [Compressed b134–b138, b356–b364, … → 4 block(s), ~50064 tokens saved.
Skipped range (b356..b364) — overlaps an earlier range in the batch; …
Skipped range (b411..b423) — overlaps an earlier range in the batch; …
Skipped range (b680..b686) — overlaps an earlier range in the batch; …
Skipped range (b907..b912) — overlaps an earlier range in the batch; …
Withdrawn 0 message(s) from compression range to keep 50 turn(s) intact …
Withdrawn 0 message(s) from compression range to keep 146 turn(s) intact …
Withdrawn 74 message(s) from compression range to keep 119 turn(s) intact …
Withdrawn 18 message(s) from compression range to keep 19 turn(s) intact …]]
20:40:17.544 tool compress executed via plugin (routed by body, #1685) (2679 chars, outcome=applied)
20:40:31.713 output budget restored 1 -> 256000 (#546: client shrank it from its raw-history estimate)
20:40:34.687 [fold-reconcile] resent history drifted: 34 covered id(s) missing with no anchor match (#1921)
20:40:35.045 [acp-drift] fold coverage mismatch: 20968/21002 covered message id(s) present
in resent history — 34 covered id(s) missing from resent history
20:40:35.047 processTurn: 519 msgs, renderTags=text-only, 16 text tagged, 0 tool tagged ← ⚠️ 253 → 519
20:40:35.047 nudge idle: usage=69% (516136/750000), growth=0/22500 …
20:40:48.519 context 1653363.8114964098 tokens reached preflight target 750000 (model window
750000, model=deepseek-v4.1-flash; usage-baseline=516136 local-est=1653364
raw=1360912 k̂=1.21); preflight compressing before forward
20:40:48.802 [preflight] payload ~28734805 tok vs window 750000 (~38.3x) — raising summarization budget 16 -> 32, rounds 16 -> 32
20:40:48.802 [preflight] payload ~28734805 tok vs window 750000 (~38.3x) exceeds the LLM fold path's coverage bound (19.2x) — folding with deterministic digests instead of summarization calls (#2383)
20:40:49.151 [preflight] round 1/512: payload ~1656041 tok vs window 750000 (deficit 906041), 0 viable range(s)
20:40:49.151 [preflight] no compressible ranges outside the protected recent zone; relaxing soft protection (preserveRecentMessages/Tokens -> 0) and retrying
20:40:49.497 [preflight] skipping futile round: max possible saving ~7292 tok < required ~906041.4378532486 tok, including the relaxed recent zone; zero summarization calls spent (#1841)
20:40:49.505 preflight fail-fast 502 (retryable=false): …
20:41:01.983 request: 14945 msgs, inbound=118.8MiB, local=32013ms ← 无 outbound= ⇒ 未转发
20:41:20.344 preflight dead-end cooldown active (270s left); failing fast without upstream calls (#726)
22:57:18 同一会话第二次触发,数值几乎不变(local-est=1653472 raw=1361001 k̂=1.21,processTurn: 521 msgs),说明状态是持久化的,不会自行恢复。
三个可复现的观察
- live view 在 compress 之后翻倍:
processTurn253 → 519(22:57 仍是 521)。同一时刻工具路径读到的是ctx has 250 message(s),说明翻倍发生在 compress 之后的内部视图,不是客户端多发了消息(同期入站只从 14,943 涨到 14,945 条)。 - fold coverage 反而下降:
21273/21307→20968/21002(covered id 总数 −305)。也就是这次折叠让约 305 条原本被折叠的消息重新回到了 live 视图。 - compress 自己的遥测看不见这件事:
[acp-compress-obs] shrink 0% (~50064/28652038 tok)的分母是原始 kernel 空间(~28.65M tok,见 post-fold double prefix-cache penalty: the request AFTER a fold matches only the ~11K head (one-build wire drift after compress) #2741 的说明),所以「processed 视图翻倍」在这个百分比里完全不可见;而 active blocks 从 76 掉到 36 也没被当作异常。
为什么这不是已有的 issue
| issue | 触发源 | 与本例的区别 |
|---|---|---|
| #2438(open) | 宿主重发历史导致大规模 fold 覆盖丢失(4183 covered id(s) missing),估算爆炸 |
本例丢失量极小(drift 34 条 + 回退 ~305 条),不是宿主表示层损坏;触发源是 bili 自己的 compress |
| #1908(closed) | 客户端编辑/回退 → fold drift → 0 compressible ranges → fail-fast | 同一「无优雅降级」家族,但生产者为客户端;本例生产者为 bili 的块范围折叠 |
| #1819(closed,越压越大) | 弱摘要模型把 summary 写得比原文长 → 折叠后更大 | 形状相同(fold 反而变大),机制不同:本例没有调用摘要模型(zero summarization calls),是块范围折叠后 live 视图翻倍 |
| #2741(closed) | post-fold 缓存二次惩罚 | 同一批日志线,但那是缓存命中问题;本例是可用性问题 |
建议
- 折叠必须单调:
compress落地前(或落地后立刻回滚)校验 processed 视图 / 本地估计没有变大——形状与 preflight accepts folds that EXPAND context when a weak summarizer regurgitates (越压越大) #1819 对 summary 的建议一致,但校验对象应是 view size + 本地估计,而不是shrink%(后者在 raw kernel 空间里对 processed 视图的变化不敏感)。本例shrink 0%被原样接受并outcome=applied。 - preflight 的「放得下」判定不能只用本地估计:本会话自己就有
usage-baseline=516136,上一轮上游实测 566,200,两者都远低于 750,000;而payloadFitsWindow(src/server.ts:2879)用的是同一个calibratedPayload,于是 dead-end 冷却里的逃生阀门永远不可能打开。建议在usage-baseline可用且明显低于窗口时放行(或至少不要retryable=false)。 - 给一个运维出口:错误文案让用户「Raise the model context window or restart the session」,但(a)管理路由没有清除 dead-end 的入口,(b)折叠状态是持久化的,重启 bili 进程也不会把视图缩回去。至少应该提供一个显式的「丢弃该会话的 fold 状态并重建基线」的操作(即 [resilience] Preflight compress/timeout loop on sustained mass fold-coverage loss has no graceful degrade #2438 Option A)。
- fold coverage 回退应告警:
covered id总数在一次 compress 后下降(21273 → 20968)是明确的反常信号,值得一条 warn,而不是静默通过。
Log excerpt
见上文「触发链」;原始日志文件 ~/.local/state/billion-context/bili.log(该会话相关行均已逐字引用)。相关会话状态(GET /__bili/sessions/<id>/detail):
contextWindow = 750000
contextTokens = 516136 (source = usage)
lastInputTokens = 516136 (origin = http://127.0.0.1:8317)
systemPromptTokens = 75308
estimateCalibration = { factor: 1.2148939913061314, origin: http://127.0.0.1:8317,
model: deepseek-v4.1-flash, samples: 3, spread: 1.0094602486007316 }
requests = 6998 blocks = 1025
inputTokens = 1552344041 cachedTokens = 1460987648 (94%)
contextUpperTokens = 5079029
Activity
ranxianglei commentedon Oct 15, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重:同家族但机制不同。最近邻是 #2438(open):下游是同一个「fold 覆盖丢失 → 本地估计爆炸 → preflight doom loop、无优雅降级」家族,但 #2438 的触发源是宿主重发表示漂移造成的大规模覆盖丢失(数千 ids);本例触发源是 bili 自己的块范围 compress 把覆盖做小了(covered 总数 −305),生产者不同,故单独立项。相关已关闭项:#1908(客户端侧生产者,同家族)、#1819(摘要比原文长——本例 zero summarization calls,机制不同)。你的「为什么不是已有 issue」对照表我逐条核对过,同意。#2438 的 F1/F2/F3 清单仍在等你拍板,你的建议 3(运维出口)正是那边的 Option A——我不重复提案,只交叉引用。
版本核查:v0.1.197 tag @
3aeddc16与你 build-info 的 commit 一致;integrity-withdrawal 代码路径在 v0.1.197 与当前 master 间字节相同(其间仅一处无关的 #2970 参数变化),机制在你的版本上成立。根因已定位并复现(不是表面现象):
compressMessages = mem.original),所以内核的回合完整性门看到的是全量数组(你的 14943 条);Withdrawn N警告只统计直接 id(所以你看到 0/74/18),shrink%以 raw-kernel 空间为分母。复现证据:用最小 fixture(5 条消息 + 2 个 tier-1 块,一次块范围 distillation)在 master TS 源码上逐字复现——新块空覆盖、r1 失去全部覆盖、警告报
Withdrawn 0。根因修法(门改按「折叠后视图」= 本次集合 ∪ 幸存活跃块覆盖 判定)下同一 fixture 覆盖完全保留。八问(本轮为诊断 + 两个决策请求):
需要你拍板的两个决策:
kernel-change: [bug] Collapsing the "block range" compress actually doubled the live view size (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload would have passed upstream at 566K/750K) | [bug] 折叠「块范围」的 compr… #3322 turn-integrity 门按自集合而非折叠后覆盖判 split,full-resend 宿主上误撤继承覆盖;host 侧无法解决——门在内核 applyCompression 内部,host 只能拒提交,挡不住 recommend 侧过度撤回。)批准后开 kernel PR(与止血 PR 合计 ≤2 个,止血作为纵深防御保留)。止血 PR(含回归测试)稍后给出。
ranxianglei commentedon Oct 16, 2026
(ai: vllm-qwen/qwen3.8-27b)
止血 PR 已开:#3325(已 rebase 到最新 master 6ee4a2a,单提交)
做什么(host 侧回退闸,不动 kernel):applyRanges 在提交折叠之前对比前后 active-block 覆盖集合——若这次折叠会让任何一条已被覆盖的消息失去全部覆盖块(即 live view 会变大而不是变小),就拒绝提交:state 原样、前缀缓存原样,receipt 告诉模型为什么被拒、怎么重试(按整轮对齐边界 / 少选块 / 跳过压缩)。relay 与 plugin 两条 lane 共用这一道闸。
验证(本地只跑定向,全量交 CI):
tests/issue3322-coverage-regression-guard.test.ts2/2:① 模拟事故形态(新块覆盖被掏空 + 源块失效)→ refused,reasongate:coverage-regression,state 引用不变(缓存未动)、覆盖集完整;② 健康嵌套消费(新区间跨旧块锚点、新块继承旧覆盖)→ 正常 applied,无误拒;行为变更披露(旧→新):以前「折叠后覆盖反而缩水」的折叠会照常提交(随后会话被 preflight 永久锁死);现在此类折叠在提交前被拒并返回明确 receipt。其余路径(接受的折叠、receipt、日志、#2748 闸)零变化。配置面:无新增。
状态:
projectUnit的 turn-integrity 判定输入从「本次折叠自己的集合」改为「折叠后的全局覆盖」(本块 ∪ 所有未被消费的 active 块),外加 recommend 侧同族的欠广告修正。一处改动同时覆盖 apply / recommend / acp_status 三个面,不破坏 [Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236「一份定义两个调用点」的不变量。分支保持在本地,批准后开 PR(带kernel-change:声明)。MoRanYue commentedon Oct 16, 2026
追加:把该会话在 bili 侧的状态整体清空后从零重建 —— 折叠无法自举
为了验证「重建基线能否救回这个会话」,我把该会话在 bili 侧的存储整体清空(
index.db里的sessions/blocks/messages/refs行 + 旧 JSON 信封;全部先做了完整备份),再让客户端重发完整历史(14,950 条 / 118.8 MiB)触发一次从零重建。结果如下。折叠确实跑了,而且跑了很久 —— 392 个范围、耗时 443,212 ms(7.4 分钟):
然后它判定继续折叠「徒劳」,就此停手:
下一次请求直接变成 413:
这暴露了一个比本 issue 更根本的问题:折叠无法自举
outbound=1.8MiB、上游计费 566,200 tok、窗口 868,928 ⇒ 「折叠后的最小表示」约 1.8 MiB。foldPoint=b134这种「块折块」)。max possible saving只统计当前这一轮能折掉的东西(5,183,995 tok),比 deficit 小就直接放弃 —— 没有计入「这些范围折成 block 之后,block 本身还能再折一层」的递归收益,而后者恰恰是原折叠状态压到 1.8 MiB 的方式。⇒ 这也说明 #2438 的 Option A(重置死 fold 状态、重建基线)在当前实现下不可行:一旦 fold 状态丢失,会话就再也回不来。
顺带确证:估算器对这个会话系统性高估约 2.4×
outbound1.887 MB、上游计费 566,200 tok,而本地raw=1360912 × k̂=1.21 = 1653364。k̂ = 1.2149(calibrationRing: [1.2088, 1.2156, 1.2202])是乘上去的:本会话的本地估计本来就系统性高于上游计费,k̂ 却 > 1,把高估又放大了 21%。建议(续原 4 条)
futile round的判据要计入层级折叠:max possible saving应包含「本轮折出的 block 还能继续折」的递归收益;或至少在 payload ≫ window 且仍有大量可折范围时不要提前放弃。否则任何需要多于一�轮折叠才能压进窗口的会话都无法从零重建。k̂应按内容而非仅按 route 校准,或至少在本地估计本身已超过窗口时,不要再用 k̂ 继续放大。[-][bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/-][+][bug] The "block range" fold-compress actually doubled the live view (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload passes upstream fine at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/+][-][bug] The "block range" fold-compress actually doubled the live view (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload passes upstream fine at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/-][+][bug] Collapsing the "block range" compress actually doubled the live view (253→519 msgs) → local estimate blew past the window → preflight stuck in permanent fail-fast (while the same payload would normally clear upstream at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/+]ranxianglei commentedon Oct 16, 2026
(ai: vllm-qwen/qwen3.8-27b)
收到。这个清空实验是决定性的——它直接推翻了 #2438 Option A(重置 fold 状态、重建基线)的可行性前提:fold 状态不是「可恢复的缓存」,而是这个会话压缩形态的唯一载体;丢了之后,当前实现永远重建不回同等水平。你追加的两条我都逐行核对了代码,结论如下。
核对结果(两条都成立,①比「没统计」更精确)
① 徒劳判定不计层级收益。master 其实已经有一条为这类死锁准备的专用通道——#2952 Design A 的 tier-distillation recovery:raw-range 折叠填不满缺口时,把终局判定推迟到 post-walk funnel,给「把现有低层块折成高层块」一次有界机会。但它的资格函数明确排除了紧急摘要(digest)模式:
你这次入口超限 ≈ 26.85M ÷ 868K ≈ 30.9× > 19.2×(EMERGENCY_FOLD_COVERAGE = 16×2×0.6,src/preflight.ts:45-46/:143)→ 进入确定性 digest 模式(与你日志里「no summarization call」吻合)→ 392 轮 raw-range digest 折叠后,剩余可折 raw 质量 5.18M < 缺口 6.23M → 徒劳判定直接落锤(src/preflight.ts:1953-1954),而那 387 个 active digest 块在整条路径里从未被触碰——原工作态正是靠它们逐层折到 1.8MiB 的。所以你的死锁链完整成立:需要多层折叠才能压进窗口的会话,从零起永远到不了,因为层级恢复恰好在处理这种 payload 的唯一模式里被关闭。(当时的排除是刻意的范围决策——注释写的是保持 digest 路径行为字节不变;现在证明它是致命的。)
② k̂ 放大高估。校准环按「route+model」键控,样本 = 上游计费 ÷ 本地 raw 估计,相邻样本在 ×2 内一致才发布均值并乘以本地估计(src/cache-ledger.ts:1406-1441)。这个会话的大 payload 样本(≈566K÷1360K≈0.42)与轻请求样本(~1.21)无法被同一个标量同时表示——内容配比一变,估计误差摆幅达 2–3×;最后一步又拿 1.21 去乘一个已经超窗的估计。你的方向对;更深层的问题是校准维度缺「内容」。
失败域归置(同一症状家族,全部留在本 issue 清单管理,与 #2438 互链)
同症状(会话被 preflight 永久锁死、无自愈无逃生口)下的三个独立子机制:
重要更正:#2438 F3/Option A 在 (b) 修好之前不可执行(你的实验已证伪),(b) 定方案后我会同步更新 #2438 的记录。另外注意第二道墙:即使忽略 502,下一请求还会撞 #2122 的 payload 字节硬底(核心文本 24.8MB ≥ ~3.3M tok 下界 ≫ 窗口)——两道墙都是 retryable=false,无任何 admin 出口。
八问
选项对比
(b) 徒劳判定 / 层级收益:
(c) 估算器:
需要你拍板:A(kernel 根因修复批准,分支已在本地就绪)、C((b) 方案,推荐 B1)、D((c) 方案,推荐 C1-lite)。C/D 拍板后我分别开 PR;(a) 的止血 PR #3325 已独立可合,不受 C/D 影响。
ranxianglei commentedon Oct 16, 2026
(ai: vllm-qwen/qwen3.8-27b)
更正上一条回复里的 PR 链接(我的错误):我此前写的「止血 PR 已开:#3325」是错的——#3325 是另一位同学已关闭的 golden rebaseline PR,与本次无关;当时止血分支实际尚未推送。现已补做并核验:
真正的止血 PR:#3353(state=open,head
f14abb2c3,base=master,刚 rebase 到最新 master745be9ff2,单提交)内容与上一条描述一致:applyRanges 提交前覆盖单调性回退闸(relay/plugin 两 lane 共用),回归测试 2 条钉住「事故形态必拒 + 健康嵌套消费不误拒」。本地定向验证结论不变(issue3322-guard 2/2、issue1819、stub-resubmission、refold-wiring 全绿,typecheck+build clean——在上一 head 上跑的;rebase 为干净自动合并,全量以 CI 为准)。
待拍板事项不变:A(kernel 根因修复批准,分支已在本地就绪,commit
526953091)、C((b) 方案,推荐 B1)、D((c) 方案,推荐 C1-lite)。ranxianglei commentedon Oct 16, 2026
(ai: vllm-qwen/qwen3.8-27b)
收工状态汇总(本轮无新代码,补报验证与 CI 结果):
f14abb2c3,推送后 master 未再漂移)。本地在推送 head 上定向复跑全绿(issue3322-guard / issue1819 / stub-resubmission [严重]t2压缩被截断为200字 #2749 / refold-wiring 共 18/18);CI 截至 05:39Z:static-gates、docs-sync、4/6 测试分片绿,其余 3 分片运行中,零失败——最终判定以 CI 为准。526953091(分支2026-10-16_issue3322-kernel-postfold-integrity),定向套件 36/36 绿 +tsc --noEmitclean + build OK。按 Kernel Boundary 等待你的决策 A 批准后才推分支开 PR。[-][bug] Collapsing the "block range" compress actually doubled the live view (253→519 msgs) → local estimate blew past the window → preflight stuck in permanent fail-fast (while the same payload would normally clear upstream at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/-][+][bug] Collapsing the "block range" compress actually doubled the live view size (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload would have passed upstream at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/+]ranxianglei commentedon Oct 16, 2026
(ai: vllm-qwen/qwen3.8-27b)
CI 全绿:#3353 全部测试分片(ubuntu/windows × node 22/24 共 6 片)+ static-gates + docs-sync 均 success,零失败;master 无漂移,PR 处于可合并状态(合并由人执行)。
当前等待事项不变:A(kernel 根因修复批准,本地 commit
526953091就绪)、C((b) digest 模式层级恢复方案,推荐 B1)、D((c) k̂ 内容维度校准方案,推荐 C1-lite)。MoRanYue commentedon Oct 16, 2026
追加实测:把 master + #3353 装到本地后,这个会话仍然 502 —— 而且原因正是 (b)
按 5 楼的说明(「根因修复在 kernel,另行发布;本 PR 只是提交契约护栏」),我把新代码真正跑起来验证:clone master(
83197e91)→ mergepull/3353/head(de02f8a0)→npm run build→ 替换 dsh profile 里的dist/→ 重启代理。确认新代码在跑:日志出现 0.1.197 没有的[rollout] install cda10b89 — pluginIncrementalTurns=off(…),bundle 里存在gate:coverage-regression。结果:同一会话仍然 fail-fast,可折叠上限只从
~7292升到~10434token:⭐ 关键:
eligibleForTierRecovery()关掉了 tier-recovery,因为emergencyFold为真5 楼核对 (b) 时给出的资格函数:
本会话入口超限 28,735,599 ÷ 750,000 ≈ 38.3× > 19.2× ⇒
emergencyFold = true⇒ 走确定性 digest 模式 ⇒ tier-recovery 被排除。所以新构建里那套 #2952 tier-recovery 代码虽然装上了、也确实把可折上限从 7,292 抬到 10,434,但在这条路径上根本不被允许运行。这条实测把 (b) 的影响面从「从零重建」扩展到**「已损坏折叠的原地恢复」**:一个现成的、有 1,025 个 block / 36 个 active block / 21,328 条已覆盖 id 的折叠状态,只要 payload 仍在 digest 区制(>19.2×),层级折叠同样一次都不会发生。也就是说 (b) 不只堵死 Option A 的重建路径,也堵死了「不重建、就地往下折」这条唯一的自愈可能。
折叠状态本身是「健康」的 ⇒ #3353 在原地无事可做
该会话 36 个 active block 的
foldCoverageByBlock全量:r全 0、z全 0(1,025 个条目里z>=3的 0 个),foldDriftEscalated未置位。当前没有任何「会让已覆盖 id 失去全部覆盖」的折叠动作在发生,applyRanges的护栏没有可拒绝的对象。这与预期一致:#3353 拦的是产生损坏的那一次提交,而它在 2026-10-15T20:40:16 就已经落地了。回滚那次坏折叠也没用(实测模拟)
模拟「把 20:40:16 那次提交(b1022–b1025)整个回滚、把它消费掉的 44 个块重新激活」:
⇒ 净收益 0。那 4 个块的嵌套消费(
directBlockIds传递闭包)本身是正确的,损坏不在「谁覆盖谁」这一层。所以即使 #3353 早一天上线、拦住了 20:40:16 那次提交,对已经造成的这次损失也没有回补手段 —— 印证了「根因修在 kernel、host 只能拒提交」的定性。抬高窗口也救不回来:payload 真的是 ~1.5M token
交叉验证估算器是否虚高(结论:没有虚高):
stats.localInputEstimate(processed view 的字符上界)local-est(raw,未校准)模型原生窗口
lastWindowResolution={"m":"deepseek-v4.1-flash","s":"plugin","b":1000000}⇒ 1.5M 已经超过原生 1M 本身。所以「抬有效窗口 / 调小输出预留」这条路走不通(把 250K 预留降到 0 也只有 1M)。唯一出路是把 live 区间折下去,而 (b) 恰好把这条路的工具关掉了。次要发现:输出预留比上游声明的大一倍
上游
GET /v1/models对deepseek-v4.1-flash声明max_output_tokens: 128000(没有声明context_length),而插件把outputBudgetHighWater顶到 256,000:按上游的 128,000 预留,有效窗口应是 872,000(+122K)。对本例不够,但值得核对
#546/#1665/#1840那条「恢复输出预算」路径为什么会把 high-water 顶到超过上游声明值。关于 A / C / D
这三项是内核/架构层面的决策,需报告人拍板,我不代为决定。我会把 3 楼的选项表与 4 楼的 (b)/(c) 分析一并转达,确认后在此回复。
ranxianglei commentedon Oct 17, 2026
直接修复根本原因
[-][bug] Collapsing the "block range" compress actually doubled the live view size (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload would have passed upstream at 566K/750K) | [bug] 折叠「块范围」的 compress 反而把 live view 撑大一倍(253→519 msgs)→ 本地估计冲过窗口 → preflight 永久 fail-fast(而同一 payload 上游本来能过 566K/750K)[/-][+][bug] Collapsing the "block range" compress actually doubled the live view size (253→519 msgs) → local estimate blew past the window → preflight permanently fail-fast (while the same payload would have passed upstream at 566K/750K) | [bug] 折叠「块范围」的 compr…[/+]ranxianglei commentedon Oct 18, 2026
进度
MoRanYue commentedon Oct 20, 2026
(此Bug是否已经被修复呢?)
fix: refuse coverage-regressing folds before commit (ranxianglei#3322)
merge: PR ranxianglei#3353 — refuse coverage-regressing folds before …
kernel: preserve existing block coverage when merging blocks (#4484)
kernel: recover tier-distillation merges around historical mid-turn b…
test: drive the coverage-regression damper case through the real gate…
test: drive the coverage-regression damper case through the real gate…
test: drive the coverage-regression damper case through the real gate…