Skip to content

[PR] compress-from-store: evicted sessions fold against the unified-store view instead of refusing forever (#3982) - #3983

Merged
ranxianglei merged 4 commits into
masterfrom
2026-10-20_compress-from-store
Oct 21, 2026
Merged

ranxianglei merged 4 commits into
masterfrom
2026-10-20_compress-from-store

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #3982 (root fix for #3918 Phase 4 — the compress REFUSED forever loop on sessions too large to stay resident).

What / 干了什么

store (messages table, every save)          live in-memory view
        │                                            │
        └─── #3982: view empty? → recover ──→ applyRanges folds
                     (peek-only, read-only)      against the persisted
                     any bad row → refusal       raw view + state

Why cheap / 为什么便宜

The unified store already persists the full raw view on every save; this PR only wires the compress path to it. No kernel change, no persist-format change, no eviction-policy change (LRU untouched — #3943 makes the verdicts honest, this makes the button work).

Verification

@ranxianglei ranxianglei changed the title compress-from-store: evicted sessions fold against the unified-store view instead of refusing forever (#3982) [PR] compress-from-store: evicted sessions fold against the unified-store view instead of refusing forever (#3982) Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-20_compress-from-store (e04876a)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4895-pr.3983.2edcf35

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3983.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei force-pushed the 2026-10-20_compress-from-store branch 2 times, most recently from 0d1c951 to 63d17f5 Compare October 20, 2026 15:24
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复。 全仓(含已关闭)检索失败签名「evicted session / REFUSED forever / peekStoredTailView / compress-from-store」:本 PR 是该机制的唯一实现。相关项对照:#3982(设计 issue,本 PR 即其落地)、#3918(P4 父任务,实测场景)、#3943(判决诚实化,正交——它管回执说真话,本 PR 管按钮能用)、#3859(no-visible-context guard 对活跃块重叠 range 的绕过,不同机制不同症状)。无并行同类 PR。

标签:bug + dsh + scope/kernel + p1(保留 pr)。理由:超常驻预算的会话 compress 永久拒收 = 核心承诺(上下文压缩)对该类会话结构性失效、上下文只增不减 → 按 owner 2026-10-19 修订归 p1;证据场景来自 dsh(#3918);改动域是 compress 拒收门(persist/stream/external-summary),归 scope/kernel。

状态:正在做独立审核——rebase 到当前 master、定向测试、逐段读 diff(含回归清点与测试有效性审查),结论按八问体例随后发出。

@ranxianglei ranxianglei added bug Something isn't working dsh p1 scope/kernel labels Oct 20, 2026
ranxianglei and others added 2 commits October 21, 2026 01:30
…ore refusing (#3982)

- applyRanges + the external-summary gate recover the raw client view from
  the unified transcript (peek-only, read-only; any unparsable row keeps the
  honest #3126 refusal) when the effective view is empty
- live views never consult the store; legacy/no-store refusals stay
  byte-identical
- 4-test stake pins: recovery fold lands / no-store refusal / corrupt row
  refuses / live view untouched
@ranxianglei
ranxianglei force-pushed the 2026-10-20_compress-from-store branch from 63d17f5 to 37c0186 Compare October 20, 2026 17:31
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

审核结论(独立重审):未发现硬回归;一个设计问题待确认;旧 head 的 CI 红已根因定位并已处置。

① 是什么问题:大到无法常驻内存的会话(超过 512MiB 常驻预算)每次请求后都被逐出,compress 永远撞「没有活视图」而拒绝,且回执还承诺「下一轮模型请求后自愈」——对这类会话是假的,按钮永久失效。本 PR 让压缩路径在拒绝前从统一存储恢复原始客户端视图,fold 得以落地。

② 什么原因导致的:压缩路径只认内存视图(ctx.compressMessages ?? ctx.messages),而逐出/重启恰好清空这个视图、refs 却完整保留;存储侧(#3911)每次保存已把全量原始视图落库,但压缩路径没接上——数据在库里,决策面看不见。

③ 影响范围与严重程度:只影响无法常驻的大会话(正是目标人群);修复前这些会话的 compress 完全不可用(p1 级不可用);修复后 fold 直接落地。小会话/正常会话路径字节级不变。

④ 怎么修复的:在 noVisibleContextRefusal 闸门之前,当有效视图为空时调 peekStoredTailView(sessionId)——peek-only(不构造 store 实例)、任何一行解析失败即返回 null 保持诚实拒绝。两条入口接线:applyRanges + external-summary 车道。本次审核另加第 3 个 commit:把两处逐字重复的恢复块抽成共享 recoverEvictedView(ctx)(纯重构,零行为变化)。

⑤ 是否有回归问题(diff 触碰路径的既有行为逐项清点):

⑥ 是否破坏缓存:不涉及——前缀缓存/重试/增量游标策略未触碰;恢复只为单次 fold 决策提供输入,不改出站内容。

⑦ 是否改了设计方向:不涉及架构转向,只是把压缩路径接到既有存储。有一个设计问题需确认(非阻塞缺陷):

peekStoredTailView 按 seq 读该会话全部行,未按 sessions.tail_json.tailSeqs 过滤。某些形态下表里会存在当前逻辑视图之外的行(lane-owned 会话按设计跳过清扫、孤儿行留作审计底;envelope-only 保存会追加 render 身份行)。幽灵行的 id 是内容派生的、劫持不了被请求的 refs,kernel 的顺序中心 reconcile 也容忍顺序漂移,实际伤害限于位置相关判定——但目前是未测试状态。两个选项:(a) 在 peek 内按 tailSeqs 过滤(与重载后的视图结构相同,snapshot-render 同款做法);(b) 保持全量行,文档说明在 order-centric 教义下为何安全,并补一个混合口径回归测试。推荐 (a),或 (b)+测试;取舍留给你拍板。

⑧ 是否引入新配置:无。

行为变更披露:此前会「永久拒绝」的 compress 调用,现在在统一存储有可读行时会成功——这就是修复本身(旧行为即缺陷);其余拒绝路径与文案不变。

CI 状态:旧 head(63d17f5)CI 红 = 5 个 shard 失败,根因两类:① #3769 已知 flake(master 765abe3 已修,属 stale base);② 新测试文件 2 个失败(recovery 返回 null / index.db 缺表)——本地连续 13 次运行(含原始 head 与两次 rebase 后 head)全部 4/4 通过,家族回归 88/88 + 存储/快照 31 pass/1 skip,typecheck 干净,判为 CI 环境特异的非确定性失败,本地不可复现。已 rebase 到当前 master(bc4a3f8)并推送,新 head 37a65bc(含重构 commit),等新 CI 裁决。

收工判定:方向正确、无硬回归;等新 CI 绿后可合入;建议先确认⑦的口径问题(若选 (b) 请补测试后再合)。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.711-master.02bc1b5 (rolling master tag).

npm install -g billion-context@0.0.711-master.02bc1b5  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p1 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compress-from-store: evicted sessions compress against the unified-store view instead of refusing forever (#3918 P4 root fix)

1 participant