Skip to content

[PR] relocate compress pair to its fold point | feat(compress): 压缩后把 compress 调用对挪到它自己的折叠点(+可选清未签名思考),两个默认关闭的实验开关 (#5470) - #5471

Merged
ranxianglei merged 8 commits into
masterfrom
2026-11-01_compress-at-fold-point
Nov 1, 2026

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Fixes #5470

两个默认关闭的实验开关(opt-in;A 于 2026-11-01 真实模型验证通过,owner 决定保持 opt-in):显式开启后布局为 [已折叠区]–[调用对]–[保护消息],不开 = 与旧布局字节级一致。

改什么

弱注意力模型会把重放历史尾部挂着的未折叠 compress 调用对误读成新命令。本 PR 让这对消息回到它自己的折叠点:[已折叠区] – [compress 调用对] – [保护消息];第二个开关在挪位瞬间清掉紧邻的未签名思考段(让开头干净),默认不清。

开关 env 配置键(compress 下)
A 挪位(默认关) BILI_COMPRESS_AT_FOLD_POINT compressAtFoldPoint
B 清未签名思考(默认关,依附 A) BILI_COMPRESS_AT_FOLD_POINT_CLEAR_THINKING compressAtFoldPointClearThinking

实现

验证

边界(v1)

  • Responses-API 重请求循环不走 processTurn,v1 不覆盖(其余路径全覆盖);
  • 回滚 = 不设 env / 删配置键,无数据迁移。

kernel-change: #5470 — 新增视图变换模块 relocate-compress.ts + 管线节点(compress.ts 注册)+ Config 字段;不改折叠记账/refs/持久化状态

Config surface(为何新键而非复用既有面)

新增两个布尔键(compress.compressAtFoldPoint / compress.compressAtFoldPointClearThinking)而不是复用既有配置面,原因:

  • preserveRecentMessages:控制"折叠时保护尾部多少条原文不压",管的是哪些消息进摘要,不管调用对留在视图哪里。两者正交。
  • externalSummary:控制"摘要由谁写、多长",是内容管线开关;本功能是视图布局变换(消息字节不动、只挪位置),不在其语义域内。
  • orphan-sweep / hide-consumed 相关阈值:只决定"过期调用对隐藏还是清扫",对仍处于 active 载体的位置无任何表达力——而问题恰恰出在 active 载体上。
  • 没有现成的"位置策略"枚举可以挂这两个值,布尔 ×2(env>file>默认)是该面最小扩展。回滚 = 删键/不设 env,无迁移。

评审回应(#5470 八问评审,2026-11-01)

  • BLOCKER docs-sync:已修于 38b1f71e(gen-config-docs generate 四产物已提交),评审评论基于旧 head a4d9f15;该 head CI 38 成功/0 失败。
  • 后续更新(2026-11-01):aeeb430f 恢复默认关(owner 明确只要本地开、代码保持 opt-in),保留一项真修复——resolveRequestConfig 原先在“零 compress 配置”时短路返回 base,只用 env 设这两个开关会静默失效;现任一旋钮解析为真才走映射,都没设时短路行为与旧版完全一致。本地 pi lane(qwen3.8-27b@sglang)实测:折叠点布局正确、稳态不漂移、思考未误删、模型行为正常。
  • Web 配置页(2026-11-01):#/config 页新增 on/off 开关“压缩折叠是否原位置替换”(compressAtFoldPoint,默认关;备注注明对 qwen3-27b 等注意力有问题的小模型有用)。勾选写 true、取消删键(文件保持干净),与现有 quick 开关同一提交链路;clear-thinking 伴生开关暂不上 web(env/JSON only)(7c9a9f0a)。
  • S4 配置源较稳态窄(provider/model 层级设键会失步):已在 src/plugin-render.ts 站点代码注释写明为 v1 有意边界(8d894d16),跟进项留待后续。
  • 双 cast:与该文件既有写法一致,记录在案,不改。

…tional unsigned-think clear (#5470)

两个默认关闭的实验开关(BILI_COMPRESS_AT_FOLD_POINT / ..._CLEAR_THINKING,配置文件键 compress.compressAtFoldPoint / compressAtFoldPointClearThinking)。弱注意力模型会把重放历史尾部挂着的未折叠 compress 调用对误读成新命令(pi 稳态位置别扭;代理模式第 2 轮甚至追加到请求最末)。开关打开后布局变为 [已折叠区] – [compress 调用对] – [保护消息]:acp-kernel 新节点 relocate-compress-carriers(hide-compress-calls 之后、view-latch 之前),落点=第一条 ref > max(endRef) 的存活消息之前,不存在则追加到尾部(#4732);纯视图变换,off 时字节级一致。第二个开关在挪位瞬间清紧邻的未签名思考段;strict-echo(#684)或存在签名思考块(#1658)时整个机制不出手。host 镜像:4 条 prepare* + relay round-2(幂等)+ S4 render;Responses 重请求循环 v1 不覆盖。kernel 0.0.177。验证:kernel 1542/1542(新增 21 单测);root 全套 9927 测试中 22 个失败已在干净 master 复现(外网/环境依赖),与本改动无关。
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-01_compress-at-fold-point (7c9a9f0)

Latest build — install this exact version

npm install -g billion-context@0.0.7753-pr.5471.4e61bf0

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

Recent builds (commit → version)

commit version build
7c9a9f0 billion-context@0.0.7753-pr.5471.4e61bf0 build
aeeb430 billion-context@0.0.7752-pr.5471.9a0205f build
4f91175 billion-context@0.0.7750-pr.5471.8e2e5a8 build
8d894d1 billion-context@0.0.7748-pr.5471.ed93501 build
38b1f71 billion-context@0.0.7741-pr.5471.0423a49 build
a4d9f15 billion-context@0.0.7737-pr.5471.779fec1 build
833bfa4 billion-context@0.0.7736-pr.5471.62b9637 build
079f8cf billion-context@0.0.7735-pr.5471.6fe36d3 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title [PR] feat(compress): 压缩后把 compress 调用对挪到它自己的折叠点(+可选清未签名思考),两个默认关闭的实验开关 (#5470) | relocate compress pair to its fold point [PR] relocate compress pair to its fold point | feat(compress): 压缩后把 compress 调用对挪到它自己的折叠点(+可选清未签名思考),两个默认关闭的实验开关 (#5470) Nov 1, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复。 检索 open+closed issue/PR(relocate compress、fold point、compressAtFoldPoint、弱注意力误读 compress 调用对等关键词)均无命中——这是新引入的实验性视图变换,没有既有同类机制或并行工作。

标签:p3 · scope/kernel · pr(功能类实验开关、非缺陷不打 bug;核心是新增 kernel 模块+管线节点故 scope/kernel;默认关闭、外部影响最小故 p3)。

CI 现状(最新 head a4d9f15):25 success / 18 skipped / 1 failure。kernel-guard 已转绿(no-op rerun 生效);test / static-gates / mysql-contract 等全绿;唯一红:docs-sync,根因见末节。

结构化八问(独立审 diff,非复读 issue 结论)

  1. 是什么问题:弱注意力模型会把重放历史末尾挂着的未折叠 compress 调用对当成一条要执行的新命令。本 PR 把这对消息挪回它自己的折叠点 [已折叠区]–[调用对]–[保护消息],第二个开关可选再清紧邻的未签名思考段。两个默认关闭。
  2. 什么原因导致的:compress 调用对在折叠时创建于活视图尾部并停在那里(pi 持久化 / proxy loop 每轮重挂),尾部工具交换对长尾弱注意力模型有歧义。属「视图布局」层问题、不是记账/refs 层——修法落在纯视图变换是对层次的(疏而非堵)。
  3. 影响范围与严重程度:默认双关时输出字节级不变(节点 fast-path 返回同数组引用,relay/S4 直接跳过)→ 现有用户零影响;仅显式开启后才改出站顺序,且是实验性 opt-in。严重度:默认无外部影响(p3)。
  4. 怎么修复的:新增纯函数模块 kernel/src/relocate-compress.ts(plan+apply)+ 管线节点(hide-compress-calls 之后、view-latch 之前,off 透传)。落点=第一条 ref > max(endRef) 的存活消息之前,无则追加尾部(Plugin history render drops an entire fold (covered rows suppressed AND no summary anchor) when the fold reaches the transcript tail — ok:true, no error #4732)。host 侧 4×prepare* + relay round-2 + S4 render 用同一纯函数镜像(幂等,重复应用安全)。清思考三重门控(clearThinking && predicate 是函数 && 逐核通过),strict-echo([bug] compress 保护区过滤在完整性调整之后挖洞,导致 assistant tool-call 消息缺 reasoning_content(DeepSeek 思考模式 400) #684)/ 存在签名思考块([bug] dropCompressReasoning (#651) strips inbound thinking from compress tool_use on Anthropic wire, triggering thinking-pair-violated warning (#684) #1658)整个机制不出手。
  5. 是否有回归问题:逐项过——off 路径字节级一致(无回归);refs/state/缓存标记不动(view-only);签名思考/strict-echo 处处保护、永不重写删除;不动既有 nudge/阈值/默认值。唯一行为变化=「显式开启后出站顺序变化」(首开一轮在折叠点处一次性断缓存,之后稳定)——有意且文档化,非回归。
  6. 是否破坏缓存:确定性 f(history,state),第 2 轮起布局字节稳定 → 稳态额外成本≈0;开启瞬间一次断点(预期)。prefix-cache 策略本身不受影响。
  7. 是否改了设计方向:否。纯增量视图变换,不改协议形状/身份语义/持久化格式;两压缩模式都覆盖(proxy=节点+round-2 镜像,plugin=S4 render 镜像)。
  8. 是否引入了新的配置:是——两个布尔键 compress.compressAtFoldPoint / compress.compressAtFoldPointClearThinking(env BILI_COMPRESS_AT_FOLD_POINT[_CLEAR_THINKING],env>文件>off,默认 false)。回滚=删键/不设 env,无数据迁移。

代码质量(④⑤b)

命名达意、无死代码、异常全走「安全方向」(重复 callId / 结果不相邻 / toolCallId 不符 / 缺 ref / inactive / legacy 一律原地不动)、注释讲为什么、风格与仓库一致、无新依赖。测试有牙:kernel 21 例覆盖异常矩阵+幂等+refs 不动;host 5 例满足 #3617 双向门禁(strict-echo→拒 / 签名→拒 / 未签名→清);verif-subset-guard(compress.ts 守卫文件)过。版本纪律正确(kernel 0.0.176→0.0.177 且两处 lockfile 同步,root version 未动)。

合并前唯一阻塞

  • [BLOCKER] docs-sync 红:改了源 website/config-reference/compress.yaml(加两条)却没重新生成并提交派生产物。该门禁(ci.yml:513)跑 tools/gen-config-docs.mjs generate 后 diff CONFIGURATION.md / CONFIGURATION.zh-CN.md / website/main.js / website/docs/index.html,漂移即红——两个新 env 变量目前都不在 CONFIGURATION.md(grep 确认缺失)。修法一条命令:node tools/gen-config-docs.mjs generate 后把这 4 个再生文件一并提交。我可以直接替你补这个 commit(回一句即可),或你并入下一次推送都行。

次要观察(非阻塞)

  • S4 render 镜像读的配置源比稳态窄:src/plugin-render.ts 用 loadConfigFile().compress?.compressAtFoldPoint(仅文件顶层+env),而稳态 prepare*/relay 走完整级联后的 resolved 值。若用户在 provider/model 层级(非全局)设该键,S4 渲染前缀不挪位而稳态轮次会挪位 → 两者失步。默认关+常见场景是全局设,风险低,但这是个真实不对称,值得留意。
  • 类型桥接:relay.ts / plugin-render.ts 里 as unknown as CoreMessage[] / as unknown as BiliMessage[] 双 cast 桥接 BiliMessage↔CoreMessage,运行时同形可用,但留了类型洞(与该文件既有写法一致,仅记录)。
  • 流程小瑕:AGENTS.md 要求新配置字段在 PR 带 "config surface" 小节说明既有面为何表达不了;本 PR 有 yaml+LIFECYCLE 但缺这段论证。作者即 owner(签批隐含)且走标准 knob 模式,不算阻塞。
  • v1 边界(PR 已自述):Responses-API 重请求循环不走 processTurn,v1 不覆盖——实验特性可接受的范围界定。

判定

方向与实现都对准了正确的层次、足够保守、测试扎实——可合,前提是先补上 docs-sync 那条机械 codegen(上方 BLOCKER)。补完 44 项应全绿。要我直接推这个 doc-regen commit 吗?

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

补一条收工状态(完整八问审核已在上条评论发出):

  • 查重:不重复(新引入的实验性视图变换,无既有同类机制)。
  • 标签:p3 · scope/kernel · pr。
  • CI(最新 head a4d9f15a1):25 success / 18 skipped / 1 failure = docs-sync。kernel-guard 已被 no-op rerun 转绿;test/static-gates/mysql-contract 等全绿。
  • 判定:可合,唯一阻塞是 docs-sync —— 改了源 website/config-reference/compress.yaml 却没重新生成并提交派生产物。修法:node tools/gen-config-docs.mjs generate 后提交 CONFIGURATION.md / CONFIGURATION.zh-CN.md / website/main.js / website/docs/index.html 这 4 个再生文件。
  • 次要(非阻塞):S4 render 镜像读的配置源比稳态窄(provider/model 层级设键会失步);relay/plugin-render 的 as unknown as 双 cast 类型桥接;缺 config-surface 论证小节(作者即 owner,签批隐含)。

当前停在这一步等你拍板:要我直接把这个 doc-regen commit 推到 PR 分支吗? 回一句即可。我之所以没擅自推——CI 自动修复车道本窗口已到上限(floor-3 提示需 owner 决策),且你正在这个分支上连续推送,直接推有碰撞风险。

ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…#5471)

The captured request bodies are JSON, so kernel time="..." tag attributes arrive with escaped quotes (time=\"...\"). The old regex only matched unescaped quotes and therefore never normalized anything; whenever phase A and phase B straddled a wall-clock second boundary the byte-equality assertion failed spuriously. This false divergence is what seeded issue #5471 (multipart image flattening), which does not reproduce at any level when the client re-sends the multipart array verbatim.
@ranxianglei

Copy link
Copy Markdown
Owner Author

再重点review是否造成缓存泄露

Real-model verification (pi lane, qwen3.8-27b via sglang): the relocated
pair sits at [folded region]-[pair]-[protected messages] in the round-2
re-request and stays pinned there across steady turns; thinking untouched
(switch B still off). Flips resolver/config-doc/LIFECYCLE defaults and
closes the resolveRequestConfig short-circuit hole so the ON default and
an explicit env=off both reach lanes with zero configured compress
settings.
@ranxianglei

Copy link
Copy Markdown
Owner Author

owner 侧已处理,逐条回应(截至 head 4f91175b):

  1. BLOCKER docs-sync:已修于 38b1f71e(gen-config-docs generate 的四个派生产物 CONFIGURATION.md / zh-CN / website×2 已提交)。上面两条评审基于旧 head a4d9f15;该 head CI 已是 38 success / 19 skipped / 0 fail。
  2. S4 配置源较稳态窄(provider/model 层级设键会失步):已在 src/plugin-render.ts 现场注释写明为 v1 有意边界(8d894d16),跟进项留待后续接线 resolved 值。
  3. 双 cast:与 relay/plugin-render 既有写法一致,记录在案不改。
  4. config surface 论证:已补进 PR 描述「Config surface」小节(preserveRecentMessages / externalSummary / orphan-sweep 各自语义域为何表达不了"位置策略")。

默认值变更:4f91175b 按 owner 决定把 A(compress 调用对挪到折叠点)转正为默认开,B(清未签名思考)保持 opt-in 默认关。同时堵住一个真漏洞:resolveRequestConfig 原先在"零 compress 配置"时短路返回 base,会导致默认值与 env=off 都到不了 lane——现在两个旋钮任一解析为真就强制走映射,env=off 仍可干净关闭(测试覆盖 identity 与 stamp 两种路径)。yaml/LIFECYCLE/CONFIGURATION 文档同步翻转,docs-sync 产物已重新生成。

真实模型验证(pi lane,qwen3.8-27b@sglang,bili start 221021):round-2 重发请求中 pair 落在 [m00001]–[call+result]–[m01840…] 即折叠点,后续两轮(53/55 条)零漂移;思考块未动(B 关);模型无"把工具交换当新命令"行为,继续原有任务正常跑完测试。

当前无待办,等待人工签批合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

更正:上一条评论里说的『A 已转正为默认开』按 owner 澄清撤回——代码保持 默认关(纯 opt-in),见 aeeb430f。唯一保留的是可靠性质修复:只用 env 设开关时不再被 resolveRequestConfig 的短路吞掉(都没设时行为与旧版字节级一致)。PR 描述、LIFECYCLE、配置文档已全部同步回 opt-in 口径。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

独立评审(基于真实 head 7c9a9f0ac,覆盖 default-on→opt-in 回退 + web 开关的全部提交;未照抄前两条基于旧 head 的评审,diff/行为/回归均重新独立走过一遍)

TL;DR:代码正确、缓存安全、测试有牙、范围正确收敛为纯 opt-in。未发现回归或缓存泄露;仅 1 处 kernel/ 内极小的文档措辞不一致(不可达路径,非阻塞)。因本 PR 触碰 kernel/,本车道按仓库政策不批准,人工签批路由见后续 🔶 评论。

结构化八问

  1. 是什么问题:功能([Feature][experimental] After compression, relocate the compress call pair to its own fold point (weak-attention models | [Feature][experimental] After compression, relocate the compress call pair to its own fold point (weak-attention models | [Feature… #5470)。弱注意力小模型会把重放历史尾部的 compress 调用对(call+result)误读成一条新的用户命令。修法=把这对挪到它自己的折叠点,让历史以「[已折叠区]–[调用对]–[保护消息]」结尾而非以一次工具交换结尾;可选 B 在挪位瞬间清掉紧邻其前的未签名思考段。

  2. 什么原因导致的:根因是视图布局,不是模型。内核折叠把某段压成摘要,但触发折叠的那次 compress 调用对仍留在重放视图的尾部相邻位置;对位置注意力弱的模型,末尾的工具交换看起来像待执行的新命令。调用对的规范位置本就是尾部(模型在那里发出),挪位是纯视图层重排。

  3. 影响范围与严重程度:两个开关默认全关,纯 opt-in。不开=零行为变化(env / file / web 任一显式开启才生效)。开启后改变该会话出站线布局(调用对从尾部移到折叠点)=预期效果;不动 refs/state,无数据丢失。关闭时字节级等同引入前。属体验优化、gated,无可用性/数据风险。

  4. 怎么修复的:确定性纯视图变换 relocateCompressCarriers(新内核模块 kernel/src/relocate-compress.ts + 管道节点,位于 hide-compress-calls 之后、view-latch 之前)。找每个仍可见的 compress 调用对(按活动块 callId 唯一、call 紧跟匹配 result),标记两者移除,插入序位=第一个 ref>该块 endRef 的存活消息(无则尾部落底),按序位重排输出;幂等(第二遍 no-op→同数组引用);关→返回同一数组引用(字节级不变)。宿主按请求经 env>file 级联解析;relay round-2 与 S4 plugin-render 施加同一变换使各车道一致。B 用 makeFoldPointReasoningDroppable 谓词工厂(仅 B 开时装载):strict-echo 会话或视图含签名思考块→整机制不出手,否则丢紧邻移动对之前的未签名思考核。

  5. 是否有回归问题(最仔细查的一项):

    • 关路径已逐层验证字节级等同:内核节点 fast-path(if(!cfg.compressAtFoldPoint) return io)、relocate(if(!plan.changed) return messages 同引用)、宿主各门全在开关之后、且 resolveRequestConfig 在「什么都没设」时保留原短路(返回 base 同引用)。默认用户零变化。
    • 开路径缓存/回归:确定性前缀稳定变换(见下方专项)——追加新一轮不会移动已挪位对的插入序位,⇒ 每轮视图保持严格前缀 ⇒ 无周期性缓存断。仅当某对首次挪位那一轮有一次性重计费,且落点在折叠本身已破坏的前缀区内(折叠把 [start..end] 换成短摘要,前缀在 start 处即断)⇒ 被折叠吸收、不叠加。签名思考块绝不触碰(B 遇之即退)。两种压缩模式都过了:plugin(客户端自持持久化、每轮按规范位置重发,relocate 确定性归一)与 proxy(临时对,relay 按规范位置重建后再挪),均稳。
    • resolveRequestConfig 可靠性修复:原先只用 env 设开关时,env 不进文件级联、hasCompressSettings 看不见它,「零配置」短路会直接返回 base、开关被静默吞掉。现短路额外要求两个 fold-point 旋钮都解析为假。什么都没设时两者皆假→原短路逐字节保留(零行为变化)。纯可达性修复,测试覆盖(没设→同引用;仅 env 开 A→stamp true;仅 env 开 B→强制映射)。
    • 高危模式逐项:无 fail-fast 变吞错(坏布尔仍 fail-loud)、无阈值/时序漂移、除预期布局外无输出格式变化、无静默缓存失效。
  6. 是否破坏缓存:无泄露。详见下方专项。

  7. 是否改了设计方向:无架构转向。既有压缩管道内加一个 opt-in 视图变换(定槽新节点)+ 一对宿主配置键 + web 开关;内核新增模块但沿用既有节点约定。S4 render 车道有意只读 env+全局 compress(不走 provider/model 级联)——已在 8d894d16 注释标为 v1 有意边界,后续接线 resolved 值。

  8. 是否引入了新的配置:是,一对 opt-in 布尔,均在 compress 下:compressAtFoldPoint(env BILI_COMPRESS_AT_FOLD_POINT)与 compressAtFoldPointClearThinking(env BILI_COMPRESS_AT_FOLD_POINT_CLEAR_THINKING),默认皆 false;解析 env>file>默认(false)。新增内核 Config 两字段(acp-kernel 0.0.176→0.0.177)。web 配置页只加 A 的开关(B 仍走 env/JSON)。文档 en/zh 同步(CONFIGURATION.md、LIFECYCLE.md、website)。迁移:无需(opt-in,缺省=关=旧行为)。

缓存泄露专项(owner 点名重点)

  • 机制:前缀缓存缓存每个请求的最长匹配前缀;泄露/抖动=跨轮稳定前缀缩短(重计费区扩大)或只增不减。
  • 前缀稳定性证明:relocate 是纯确定性 f(history,state)。论断:尾部追加新高 ref 消息 X,永不移动已挪位对的插入序位——对插在「第一个 ref>块 endRef 的存活消息」之前,X ref 最高,只有当不存在其它这样的存活消息(尾部落底情形)时才可能成为那个「第一个」,此时对移到紧邻 X 之前、前缀 [..存活..,对] 完全不变;否则更靠前的存活消息仍是锚。⇒ relocated(T) 严格是 relocated(T+1) 的前缀,稳态附加成本≈0。
  • 一次性过渡成本:某对首次挪位那一轮会在「折叠点↔旧尾部」区间重计费一次——但该区间已被折叠本身失效(前缀在 start 处断),挪位落在此已破区内⇒被吸收、不叠加。
  • 多对:块 endRef 一经创建不可变;对按 callId/callIndex 确定性排序;之后无关的折叠不会移动更早那对的锚。无跨轮抖动。
  • B:按轮确定性丢未签名思考核;签名思考存在性在客户端侧单调(签名块常驻客户端历史)⇒丢弃集不翻转⇒无周期断。最坏=B 开且签名存在性过渡时的有界一次性差量(罕见)。B 默认关。
  • 结论:无周期性/无界缓存泄露。 默认关=生产用户零变化;opt-in 会话稳态≈0,仅折叠吸收的一次性过渡。与 PR「额外缓存成本≈0」一致(稳态准确;一次性过渡是折叠固有,已披露)。

发现(均非阻塞)

  1. (极小,kernel/)kernel/src/relocate-compress.ts 思考清理循环:doc 写「run … may be dropped IF opts.reasoningDroppable accepts each one」(读作全有全无),但代码跳过不合格核而不断走循环→丢的是合格子集(理论上可不连续)。经宿主实际谓词不可达(它是全有全无:含签名思考→整机制关,否则在未签名-only run 上逐核 !hasSignature)。文档/实现泛化度小差异;kernel 边界内不动。非阻塞。
  2. (已知,owner 已处理)S4 render 只读 env+全局键,provider/model 层级设键会与稳态失步——已在 8d894d16 注释标为 v1 有意边界,后续接 resolved 值。可接受。
  3. relay/plugin-render 的双 cast as unknown as Parameters<…> 与相邻既有写法一致,记录不改。

测试有效性:有牙。钉住:默认关解析、env 级优先、garbage fallthrough、applyCompressSettings 映射(unset→false 透传)、resolveRequestConfig(没设→resolved===base 同引用;仅 env 开 A→stamp true;仅 env 开 B→强制映射)、内核单测(关→同数组引用;幂等二遍;多对按 callId 排序;尾部落底定位)。能抓住破坏字节稳定/off 路径的回归。

CI:镜像缓存显示 head 7c9a9f0ac 的检查运行中(in_progress);owner 报更早 head(a4d9f15)38 success / 19 skipped / 0 fail。其后提交为文档+小而受测的配置修复+web UI。代码评审结论不阻塞于 CI(CI 独立跑)。

判定:代码正确、缓存安全、受测充分、正确收敛为 opt-in;仅极小非阻塞观察。触碰 kernel/ ⇒ 本车道按政策不批准,人工签批路由见下一条 🔶 评论。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

本 PR 触碰 kernel/ 并带 kernel-change: 声明,按仓库政策(Kernel Boundary §、auto-merge gate §7.4)agent 评审不批准内核变更,需人工授权+合并。此条为正式边界记录,非重新开启已定的设计取舍。

  • 被门禁的 diff(PR [PR] relocate compress pair to its fold point | feat(compress): 压缩后把 compress 调用对挪到它自己的折叠点(+可选清未签名思考),两个默认关闭的实验开关 (#5470) #5471,head 7c9a9f0ac):kernel/src/relocate-compress.ts(新模块)、kernel/src/compress.ts(注册 relocate-compress-carriers 节点)、kernel/src/types.ts(Config 增 compressAtFoldPoint / compressAtFoldPointClearThinking)、kernel/package.json(acp-kernel 0.0.176→0.0.177)、kernel/tests/relocate-compress.test.ts。
  • 设计取舍(opt-in、默认关、缓存安全的纯视图变换)已由 owner 在本线程拍板并经真实模型验证(pi lane qwen3-27b@sglang:round-2 调用对落在折叠点、后续轮零漂移、思考块未动)。
  • 独立评审结论见上一条:代码正确、缓存安全、受测充分;仅 1 处 kernel/ 内极小文档措辞不一致(不可达路径,非阻塞,未改动)。
  • 已打 needs-decision 标签。最终签批与合并由 owner 执行。

@ranxianglei

Copy link
Copy Markdown
Owner Author

开关打开后 是否有缓存问题

@ranxianglei
ranxianglei merged commit e7d17df into master Nov 1, 2026
97 of 98 checks passed
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.993-master.e7d17df (rolling master tag).

npm install -g billion-context@0.0.993-master.e7d17df  # 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.

ranxianglei pushed a commit that referenced this pull request Nov 1, 2026
…me format

The kernel stamps tag time attributes as 'yyyy-mm-dd hh:mm:ss' — SPACE
between date and time per the tag contract. The mask class written for
the escaped-quotes half of #5471 ([0-9T:.Z+\-]) has no space, so whenever
the legacy and fastpath phases straddle a wall-clock second boundary the
timestamps survive normalization and the byte-equality assertion fails on
a pure clock difference. Caught live: phase A stamped 2026-11-02 00:28:19,
phase B 00:28:20. Add space to the class; five consecutive runs green
after the fix.
ranxianglei pushed a commit to mariopasquali/billion-context that referenced this pull request Nov 5, 2026
…ing-cache A/B comparisons

Review fix on top of a6ea2a0. The new suite's byte-exact A/B assertions
compared raw rendered history across two separately-run arms; ranxianglei#4313 message
timestamps are on by default and each arm's kernel renders carry that arm's
first-sight wall clock in time="..." attributes, so 8/10 tests failed
deterministically whenever the arms crossed a second boundary (they always
do). Apply the same normalization tests/issue5403-watermark-fastpath.test.ts
already sanctions (ranxianglei#5471): mask only the time attribute before comparing.
Product code untouched; with this, 10/10 pass standalone.
ranxianglei added a commit that referenced this pull request Nov 11, 2026
…at-fold-point

[PR] remove: the experimental compressAtFoldPoint feature — fold-point relocation (v1 #5471 + unreleased v2 #5949), #6132
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Nov 11, 2026
…anxianglei#6132)

Owner-directed full removal of the experimental compressAtFoldPoint /
compressAtFoldPointClearThinking feature (v1 ranxianglei#5471 + unreleased v2 ranxianglei#5949):
two distinct live pathologies in 9 days on its own target model family —
2026-11-08 voluntary re-compress loops (v1, ranxianglei#5949 field report) and
2026-11-10 authorship misattribution (v1 in v0.1.213 production: the pair's
relocation left the turn's own answer text bare at the transcript tail, and
a 27B model read its own last utterance as a user message, m00376 chain).

- delete kernel/src/relocate-compress.ts + kernel/tests/relocate-compress.test.ts
- drop the relocate-compress-carriers pipeline node (after hide-compress-calls,
  before view-latch) and its registration
- drop Config.compressAtFoldPoint / .compressAtFoldPointClearThinking /
  .reasoningDroppable and the public relocateCompressCarriers/plan exports
- drop the already-folded-echo parse kind + v2 pointer marker
  (parse-compress-input.ts) and the two echo tests
- kernel 0.0.192 -> 0.0.193 (both package-locks)

kernel-change: removed relocate-compress.ts, the pipeline node, 3 Config
fields and the public exports (full feature removal, owner decision after the
2026-11-10 incident, ranxianglei#6132); with the switch off the transform was a
byte-identical no-op, so removal changes nothing for the default layout.
kernel 0.0.192 -> 0.0.193.

Closes ranxianglei#6132 (kernel side; host/web/docs follow in the next commit of this PR)
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Nov 11, 2026
…#6132)

Companion to the kernel removal: strip the experimental fold-point
relocation feature (v1 ranxianglei#5471 + unreleased v2 ranxianglei#5949) from everything else.

- env knobs BILI_COMPRESS_AT_FOLD_POINT(_CLEAR_THINKING) + resolvers
  (knobs.ts), file keys compress.compressAtFoldPoint(_ClearThinking)
  (config.ts: CompressSettings fields, COMPRESS_SETTING_FIELDS, parser
  loop), compress-settings.ts cascade/pass-through/reachability,
  relay.ts round-2 mirror + drop-predicate install, the four prepare*
  install sites, plugin-render.ts S4 mirror, makeFoldPointReasoningDroppable
  (server.ts), the v2 already-folded-echo ack in stream.ts
- stale configs: one-shot INERT deprecation warning extended to the two
  removed keys (every level incl. top-level), values ignored
- web config row + i18n strings (en/zh), config-reference yaml, site docs,
  site i18n strings, blog post + article entries deleted (owner instruction)
- docs configuration en/zh + lifecycle ledger (rows removed, §5 note),
  CHANGELOG entry
- tests: delete tests/compress-at-fold-point.test.ts, drop the echo test
  from compress-reject-reasons.test.ts, extend removed-compress-keys-inert
  with the removed fold-point keys

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

Projects

None yet

1 participant