Repository navigation
[PR] fix: acp_status after eviction — serve the stored view, or say the view is unreadable (#4975) - #5284
[PR] fix: acp_status after eviction — serve the stored view, or say the view is unreadable (#4975)#5284ranxianglei wants to merge 3 commits into
Conversation
…live one — and say so when it cannot
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8931-pr.5284.42d8cfbThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5284.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…port union Both branches edited the same persist.js import line: this PR added peekStoredTailView (the #4975 eviction fix), master added CORRUPT_SIBLING_CAP/pruneCorruptSiblings/kvStore. Resolved as the union of both specifier sets; all six symbols verified present in persist.ts and used in plugin.ts.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge conflict on PR #5284 (fix #4975) — resolved & pushed. This run was the conflict-resolution lane (attempt 1/3). I merged What actually conflicted: one line only — Verified live at the git level (the mirror's upstream-checks cache was still stale — old sha / 八问(中文,供人工评审)
判定:阻塞性合并冲突已解除并推送(fast-forward,无需 force-push), |
|
8问 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE —— 干净、边界清晰的真实可见性缺陷修复。已对照原 issue #4975、完整 diff(3 文件,+350/-9)、全部三个 peekStoredTailView 调用点、以及所有 handleAcpStatus 调用方逐一核过。CI 在本 head(220b8656a)绿:30 checks,0 failed/pending。PR 落后 master 4 个 commit(#5983/#5974,preflight/futility 域),但这 4 个 commit 不触碰本 PR 任一文件,无跨 base 语义冲突风险。
它做了什么:resident 池驱逐 + 冷加载后,普通会话保留了 refs/blocks,但内存里的消息视图丢了(transient 被丢;pluginSnapshot 只为 fork 会话持久化)。两个 acp_status 入口都只读那个空视图,于是报「0 tool / 0 text」+ 最大可压 0——和一个全新会话一模一样——而上游仍在按完整历史计费(事故里 billed 173069 vs est 26239,6.6×)。修复在 live 视图为空但 refs/blocks 尚存时,从统一存储窄读原始尾行(peekStoredTailView)作为状态视图——和 compress-from-store(#3982)同一道网;store 读不出可读副本时,给出显式「视图不可用/不可读」标记(点名保留的 refs/blocks 数 + #3126 恢复路径),不再静默报零;并恰好在视图不可用时抑制两条前提无法计算了的注记(#2366 CJK/tokenizer 归因、PRESSURE NOTE)。以 acp_status + 空视图 + 保留状态为门控,其它工具与全新会话输出逐字节不变。
为什么正确(逐项核过):
- 恢复路径镜像 #3982 的
recoverEvictedView网;peekStoredTailView(src/persist.ts:4363)全有全无(任何一行不可解析 / 零行 / 存储禁用都返回 null,绝不给半份视图),内部吞错安全。 - 覆盖所有
handleAcpStatus调用方:插件工具路径在出面前先恢复;proxy 模式路径(stream.ts / loop/core.ts)在一轮内带 live 客户端视图运行,标记不会误触发;fork 会话保留 pluginSnapshot(跳过恢复);全新会话无 refs/blocks 被门控排除。 compressMessages重构对非 acp_status 工具行为保持(初值相同);只有 acp_status 遇空视图时分流。- 测试按 #3617 钉双向:标记出示 / 恢复后与 resident 逐字节一致;全新会话负例;live 视图会话保留 #2366 CJK 注记(钉住不回归);断言与实现字符串逐字对齐,真能抓住回归。
- 无 kernel/、config-surface、wire/message-shape、persistence-format、version 变更;驱逐策略本身未动(ping-pong 频率留在 #5111)。行为变更已在 PR 表格里 old→new 披露。
八问(中文):
- 是什么问题:resident 池驱逐 + 冷加载后,普通会话保留了 refs/blocks 但内存消息视图丢了;两个 acp_status 入口只读这个空视图,报「0 tool / 0 text」+ 最大可压 0——和全新会话无法区分——而上游仍按完整历史计费(事故:173069 vs 26239,6.6×)。
- 什么原因导致:驱逐丢掉 transient 视图、冷加载只重建已持久化的 ledger/blocks;
pluginSnapshot仅为 fork 会话持久化,所以普通被驱逐会话没有任何可读视图;两个 acp_status 入口都只读内存视图(#3982 的 store 恢复网此前只在 compress 车道有)。 - 影响范围与严重程度:影响 DSH 原生插件(及任何走插件端点)的长会话在两次请求间被 resident 池驱逐的用户。严重度 p2——状态面误导 agent 以为没东西可压,从而不去折叠一个仍在线、仍在计费的活会话;属可见性/正确性缺陷,非数据丢失,下一轮模型请求即恢复。
- 怎么修复的:桥接 compress 车道已有的那道网(#3982)——live 视图为空但 refs/blocks 尚存时,从统一存储窄读原始尾行(
peekStoredTailView)作为状态视图;store 读不出可读副本时给显式「视图不可用/不可读」标记(点名保留 refs/blocks 数 + #3126 恢复路径),不再静默报零;并恰好在视图不可用时抑制两条前提无法计算了的注记(#2366 CJK 归因、PRESSURE NOTE)。以 acp_status + 空视图 + 保留状态为门,其它工具与全新会话输出逐字节不变。 - 是否有回归问题:无。逐一核过既有行为——全新会话(无 refs/blocks)因门控逐字节不变;fork 会话(pluginSnapshot 非空)不走恢复不受影响;插件端点上其它工具(recovery 门控在 tool==="acp_status")路径不变;live 视图会话保留 #2366 CJK 注记(测试钉住不回归);proxy 模式 acp_status 在一轮内带 live 视图运行,标记不会误触发;peekStoredTailView 全有全无且吞错安全。高危模式(fail-fast 变吞错、阈值/时序/输出格式漂移)逐项过,除披露的标记外无漂移。
- 是否破坏缓存:否——对统一存储只读 peek,不动任何缓存/重试/增量游标/去重键;驱逐策略本身未动。
- 是否改了设计方向:无架构转向——把既有的 #3982 store 恢复网复用到新的消费方(状态面);刻意收窄,compress 自恢复与其它工具保持原样。
- 是否引入新配置:无——没有新增 env/config/旋钮/默认值。
判定:可合(APPROVE)。CI 绿 + 双端点双向测试钉住 + 无内核/配置/wire/版本变更。
(ai: vllm-qwen/qwen3.8-27b) 完整 review(含逐项正确性核对)已提交到本 PR 的 review 区。判定:可合(APPROVE)。八问如下:
CI 绿(30 checks,0 失败);PR 落后 master 4 commit(#5983/#5974 preflight 域)但不触碰本 PR 文件,无跨 base 冲突。无人工决策项、无内核变更,可直接合。 |
Closes #4975
What this fixes
After a resident-pool eviction + cold-load, an ordinary session retains refs/blocks but has NO readable message view (
transientis dropped on eviction;pluginSnapshotpersists for fork sessions only). Both acp_status entry points read only that in-memory view, so the panel/tool reported "0 tool / 0 text" + max-compressible 0 — indistinguishable from a fresh session — while upstream kept billing the full history (the incident's 6.6× billed/est divergence). The #3982 store-recovery net existed only in the compress lane.Changes
handlePluginTool, src/plugin.ts): whentool === "acp_status"and the live view is empty while the session retains refs/blocks, serve the unified store's raw tail rows (peekStoredTailView) as the status view — the same net as compress-from-store (compress-from-store: evicted sessions compress against the unified-store view instead of refusing forever (#3918 P4 root fix) #3982), gated so every other tool keeps its exact current path.handlePluginStatus, src/plugin.ts): same recovery before the nudge recompute;unprunedTokens/applyViewfollow the recovered view (the raw client view IS the apply class, [Bug][Responses] acp_turn_sep 合成分隔符进入持久压缩覆盖集合,导致重复历史漂移误报 #2627/[Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236).⚠️ LIVE MESSAGE VIEW UNAVAILABLE — … retains N ref(s) and M active block(s) … Any model request restores the view (#3126)(src/acp-status.ts);⚠️ LIVE VIEW UNREADABLE: …pre-footer line.Behavior changes (old → new)
No
kernel/, config-surface, wire, persistence-format or version changes. The eviction policy itself is untouched — the ping-pong frequency question stays in #5111's decision domain.Tests
tests/issue4975-status-view-recovery.test.ts(8 tests, both directions per #3617): marker + note suppression with retained refs; fresh-session negative gate; #2366 note preserved on a live view; panel recovered-vs-resident parity (modulo the wall-clock stamp); panel unreadable + null ranges; tool recovered-vs-resident byte-identity; tool unreadable through the endpoint; tool fresh-session negative. Targeted local runs green: issue2366, compress-from-store, issue3126, issue3918×2, issue2029, issue1875, issue3204. Full-suite verdict = CI on this head.