Repository navigation
[PR] relocate compress pair to its fold point | feat(compress): 压缩后把 compress 调用对挪到它自己的折叠点(+可选清未签名思考),两个默认关闭的实验开关 (#5470) - #5471
Conversation
…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 复现(外网/环境依赖),与本改动无关。
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7753-pr.5471.4e61bf0This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5471.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ernel 0.0.177 into both package-locks (CI gate fixes)
…ed after the push snapshot
…docs-sync gate)
(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。 结构化八问(独立审 diff,非复读 issue 结论)
代码质量(④⑤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 未动)。 合并前唯一阻塞
次要观察(非阻塞)
判定方向与实现都对准了正确的层次、足够保守、测试扎实——可合,前提是先补上 |
(ai: vllm-qwen/qwen3.8-27b) 补一条收工状态(完整八问审核已在上条评论发出):
当前停在这一步等你拍板:要我直接把这个 doc-regen commit 推到 PR 分支吗? 回一句即可。我之所以没擅自推——CI 自动修复车道本窗口已到上限(floor-3 提示需 owner 决策),且你正在这个分支上连续推送,直接推有碰撞风险。 |
…#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.
|
再重点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.
|
owner 侧已处理,逐条回应(截至 head
默认值变更: 真实模型验证(pi lane,qwen3.8-27b@sglang,bili start 221021):round-2 重发请求中 pair 落在 [m00001]–[call+result]–[m01840…] 即折叠点,后续两轮(53/55 条)零漂移;思考块未动(B 关);模型无"把工具交换当新命令"行为,继续原有任务正常跑完测试。 当前无待办,等待人工签批合并。 |
…nv-only opt-in reachability gap (#5470)
|
更正:上一条评论里说的『A 已转正为默认开』按 owner 澄清撤回——代码保持 默认关(纯 opt-in),见 |
(ai: vllm-qwen/qwen3.8-27b) 独立评审(基于真实 head TL;DR:代码正确、缓存安全、测试有牙、范围正确收敛为纯 opt-in。未发现回归或缓存泄露;仅 1 处 kernel/ 内极小的文档措辞不一致(不可达路径,非阻塞)。因本 PR 触碰 结构化八问
缓存泄露专项(owner 点名重点)
发现(均非阻塞)
测试有效性:有牙。钉住:默认关解析、env 级优先、garbage fallthrough、applyCompressSettings 映射(unset→false 透传)、resolveRequestConfig(没设→ CI:镜像缓存显示 head 判定:代码正确、缓存安全、受测充分、正确收敛为 opt-in;仅极小非阻塞观察。触碰 |
🔶 需要决策 本 PR 触碰
|
|
开关打开后 是否有缓存问题 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.993-master.e7d17df # this exact build
npm install -g billion-context@master # always the newest merged build
|
…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.
…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.
…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)
…#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
Fixes #5470
两个默认关闭的实验开关(opt-in;A 于 2026-11-01 真实模型验证通过,owner 决定保持 opt-in):显式开启后布局为
[已折叠区]–[调用对]–[保护消息],不开 = 与旧布局字节级一致。改什么
弱注意力模型会把重放历史尾部挂着的未折叠
compress调用对误读成新命令。本 PR 让这对消息回到它自己的折叠点:[已折叠区] – [compress 调用对] – [保护消息];第二个开关在挪位瞬间清掉紧邻的未签名思考段(让开头干净),默认不清。compress下)BILI_COMPRESS_AT_FOLD_POINTcompressAtFoldPointBILI_COMPRESS_AT_FOLD_POINT_CLEAR_THINKINGcompressAtFoldPointClearThinking实现
relocate-compress.ts(纯函数)+ 管线节点relocate-compress-carriers(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)。纯视图变换:不改 refs/持久化状态/缓存标记,每轮确定性重算 → 额外缓存成本≈0。任何异常(重复 callId、结果不相邻、缺 ref、inactive)原地不动;website/config-reference/compress.yaml两条(config-surface-guard 门禁)。验证
verif-subset-guard(compress.ts 守卫文件)过;边界(v1)
kernel-change: #5470 — 新增视图变换模块 relocate-compress.ts + 管线节点(compress.ts 注册)+ Config 字段;不改折叠记账/refs/持久化状态
Config surface(为何新键而非复用既有面)
新增两个布尔键(
compress.compressAtFoldPoint/compress.compressAtFoldPointClearThinking)而不是复用既有配置面,原因:preserveRecentMessages:控制"折叠时保护尾部多少条原文不压",管的是哪些消息进摘要,不管调用对留在视图哪里。两者正交。externalSummary:控制"摘要由谁写、多长",是内容管线开关;本功能是视图布局变换(消息字节不动、只挪位置),不在其语义域内。评审回应(#5470 八问评审,2026-11-01)
38b1f71e(gen-config-docs generate 四产物已提交),评审评论基于旧 heada4d9f15;该 head CI 38 成功/0 失败。aeeb430f恢复默认关(owner 明确只要本地开、代码保持 opt-in),保留一项真修复——resolveRequestConfig 原先在“零 compress 配置”时短路返回 base,只用 env 设这两个开关会静默失效;现任一旋钮解析为真才走映射,都没设时短路行为与旧版完全一致。本地 pi lane(qwen3.8-27b@sglang)实测:折叠点布局正确、稳态不漂移、思考未误删、模型行为正常。#/config页新增 on/off 开关“压缩折叠是否原位置替换”(compressAtFoldPoint,默认关;备注注明对 qwen3-27b 等注意力有问题的小模型有用)。勾选写 true、取消删键(文件保持干净),与现有 quick 开关同一提交链路;clear-thinking 伴生开关暂不上 web(env/JSON only)(7c9a9f0a)。8d894d16),跟进项留待后续。