Skip to content

[PR] Remove head/tail tags from the compression success receipt (keep excerpts) + add collapse timestamps + annotate kernel a | 压缩成功回执去掉 head/tail 标签(保留摘录)+ 打折叠时间戳 + kernel 锚点引文标注来源(模型可见文本,4 处) - #7105

Merged
ranxianglei merged 4 commits into
masterfrom
fix/lean-compress-receipt
Nov 18, 2026

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

⚠️ MODEL-FACING TEXT CHANGE —— 本 PR 改动 4 处模型可见的回执文本(均非指令语义变化,属「去掉误导标签 / 补上时间戳 / 标注引文来源」)。消费链推演见文末。

修了什么

会话 01a1e89d(ti_an,qwen3.8-27b)诊断(2026-11-17)确认:压缩成功回执是唯一一类引用用户话语、却在线路上不带任何 <acp> 时间戳的系统行(user 消息都带 time=,tool 结果全是裸文本)。弱模型扫尾部找「用户刚说了什么」时只能看到回执里嵌的引文/摘录,产生了三类混淆(现场:编出 "user's latest message (m02386/m02387) 要求一段 PR 总结",ref 与内容全是幻觉;对刚建的块做防御性 decompress)。四处文本改动:

① 指纹行去掉 head/tail 标签、保留摘录

旧: · b1 full summary 10600ch [2026-11-17 10:35:14 – …] · head "…" … tail "…"
新: · b1 full summary 10600ch [2026-11-17 10:35:14 – …] "… … …"

head/tail 标签读起来像「只存了开头和结尾」,是 #2544 误读的源头;摘录本身保留(#1294 自查价值 + #1615 surrogate 切口守卫 safePrefix/safeSuffix/scrubLoneSurrogates 原样工作),两节摘录共一对引号。

② 成功回执头追加折叠时刻

[Compressed m00001–m00192 → 1 block(s), ~51613 tokens saved.]
→ 同行尾部追加: folded at 2026-11-18 10:05:12

提交时墙钟(formatTagTime(Date.now()));回执是全新尾消息、不进前缀缓存稳定区,无缓存后果;追加在原行内,回执行号结构不变。

③ #2544 指引句去掉与摘录绑定的前半句

旧: Fingerprints show head/tail only — every summary is stored in full. To retrieve …; decompress only if the excerpt doesn't answer it.
新: Every summary is stored in full — to retrieve a specific detail from a new block, call search_context({ query }) first; decompress only if that doesn't answer it.

search_context 优先的检索路由保留。

④(kernel 0.0.198 → 0.0.199)Last-user anchor 引文标注来源

kernel/src/unit-projection.ts 保护带排除警告:

旧: Last-user anchor: m00003 "…"
新: Last-user anchor (historical quote, NOT a new user message): m00003 "…"

kernel-change: 机械性措辞修复(引文来源标注),owner 已于 2026-11-18 批准(会话 01a1e89d 诊断);版本按 kernel 边界纪律 bump。

金色快照更新(有意,非漂移)

② 的 folded at <时刻> 是第三种墙钟形状(前两种:tag 属性 time=、回执覆盖跨度 [start – end],均已被 tests/golden-storage-drive.ts 归一化)。按同一类处理:新增 FOLDED_AT_RE 并接入全部 5 条 digest 通道(wire body / citeNorm / state / stateAligned / section+key),重生成 tests/golden/storage-render/ 四个快照——diff 只有 fold 轮的 sha/bytes 与 state digest 变化,无形状漂移。

消费链推演(#6855 规则)

  • 模型对每处新文本会做什么:①去掉标签后,模型不再把指纹行解读为「块里只有两端」→ 减少无谓 decompress;摘录仍支持 [feature] compress 回执加摘要指纹 + inline decompress 回执给再折叠指引 #1294 自查。②folded at 给回执一个绝对时刻,模型扫尾部时能区分「这是历史回执」而非「刚发生的事」。③指引句不再出现 head/tail 字样,与 ① 一致。④anchor 引文显式标注 historical,模型不会把它复制成新用户指令。
  • 对抗检查:无新增数字/ref/位置锚点可被传播(②是时间戳,模型不以其推导 ref);④的括号说明是纯文字,无字段可半拷贝。
  • 两条压缩模式都过一遍:plugin 模式回执不进线(agent 本地折叠)、proxy 模式回执为 user 消息 —— ①②③ 只改 proxy 模式可见文本;④ 两模式的 unit-projection 共用,措辞一致。

回归

本地:7 文件 66/66 ✅、8 文件关联清扫 61/61 ✅、kernel 套件 1640/1640 ✅、typecheck + build + dist 守卫 ✅。全量以 CI 为准。

Ref: session 01a1e89d diagnosis (2026-11-17);方案 owner 2026-11-18 批准(先按简单的做 + 去 head/tail 标记)。

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: fix/lean-compress-receipt (90e1d7c)

Latest build — install this exact version

npm install -g billion-context@0.0.10754-pr.7105.ac827ba

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
90e1d7c billion-context@0.0.10754-pr.7105.ac827ba build
a91e536 billion-context@0.0.10744-pr.7105.09f039d build
3a1bd65 billion-context@0.0.10738-pr.7105.d85707d build
497efc7 billion-context@0.0.10733-pr.7105.e03272a build
f5e604b billion-context@0.0.10719-pr.7105.e4e2003 build
0114827 billion-context@0.0.10712-pr.7105.759c22b build
e85888e billion-context@0.0.10702-pr.7105.d62c7ef build
e1d9cc0 billion-context@0.0.10698-pr.7105.4f29f54 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title 压缩成功回执去引文泄漏 + 打折叠时间戳(模型可见文本,4 处) [PR] Strip citation leakage from compression success receipt + stamp collapse timestamp (model-visible text, 4 occurrences) | 压缩成功回执去引文泄漏 + 打折叠时间戳(模型可见文本,4 处) Nov 18, 2026
@ranxianglei ranxianglei added bug Something isn't working p2 scope/kernel labels Nov 18, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

这是 [PR] 镜像单:PR 已建好(上一轮会话 01a1e89d 续),本轮做核对 + 修 CI 红 + 报告。

核对结论:代码与描述一致,4 处改动全部在位

CI:40/41 绿,唯一红已就地修掉

  • lock-sync 红 = PR bump kernel 版本但漏同步 package-lock.json(lockfile 仍记 0.0.198);master 侧一致,非继承性失败。就地修:npm install --package-lock-only 同步,commit ca5e29c290,本地重跑该检查通过。
  • 顺手修(独立 commit e85888e34f):CHANGELOG 本 PR 条目把 kernel 版本误写为 0.0.193 → 0.0.194(旧稿残留,实际 bump 是 0.0.198 → 0.0.199),且写「三处文本改动」实际列了 ①②③④ 四条——同 commit 一并改对。
  • 分支落后 master 8 个提交,已 merge master(无冲突)并推送,新 head e85888e34f,CI 重跑中。

本地验证(定向)

  • 6 个 host 侧测试文件 60/60 绿;kernel 全套 1640/1640 绿;npm run typecheck 干净;lock-sync 检查本地通过。

标签:bug + p2 + scope/kernel(按 PR 自身 diff 判定:修模型可见文本缺陷;触发面 = 弱模型 + 含折叠的长会话;机制在压缩回执路径,含 kernel 一处)。

八问

  1. 是什么问题:压缩成功回执是唯一一类引用用户话语、却在线路上不带任何 <acp> 时间戳的系统行,弱模型把回执里嵌的引文当成用户最新指令(现场:编出「user's latest message (m02386/m02387) 要求一段 PR 总结」,ref 与内容全是幻觉)。
  2. 什么原因导致的:回执文本内嵌摘要 head/tail 摘录与 Last-user anchor 引文,而该行本身无时间戳——模型无法区分「折叠发生在何时」与「用户刚说了什么」。
  3. 影响范围与严重程度:仅压缩成功回执文本(失败/no-op/loop-guard 路径不受影响);受影响面 = 弱模型 + 含折叠的长会话;严重度 = 模型可能编造用户指令并据此行动,触发条件有限,p2。
  4. 怎么修复的:去掉引文通道(指纹行改 length-only)、回执打折叠时刻、kernel 锚点引文显式标注「历史引文,非新用户消息」;检索路由(search_context 优先)保留。
  5. 是否有回归问题:回执行号结构不变(folded at 与摘录移除都在原行内);log 侧(日志清理隐私信息 #1718)本来就是 length-only;7 个测试文件 8 处断言重钉新形状;存储/折叠逻辑/缓存语义零变化;旧格式回执已持久进历史会话,与新格式并存属正常([PR] ⚠️ MODEL-FACING TEXT CHANGE: The ref snapshot line in the compression failure receipt is changed to a point-in-time anno | ⚠️ MODEL-FACING TEXT CHANGE: 压缩失败回执的 ref 快照行改为时点标注(弱模型把陈旧副本误读成数据损坏 → 7 连发幻影终点) #7078 同理)。
  6. 是否破坏缓存:否——回执是全新尾消息,不进前缀缓存稳定区;指纹行保持确定性(feat: Support precise timestamps for each message, allowing the model to recognize which messages are outdated and which | feat: 给每个消息支持精确时间,以让模型认识到什么消息是过期的什么是当前的新的 #4313 时间窗来自存储 stamp,非墙钟)。
  7. 是否改了设计方向:否——纯文本面修复,架构/边界/数据流不变。
  8. 是否引入新配置:否。

判定:代码核对通过,唯一 CI 红已修并推送(head e85888e34f),等 CI 重跑全绿;按单内说明,合并留给人。

@ranxianglei
ranxianglei force-pushed the fix/lean-compress-receipt branch 2 times, most recently from f1886f9 to 0114827 Compare November 18, 2026 02:51
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

跟进:分支被 force-push 成修订版实现(0114827616:指纹行去掉 head/tail 标签、保留摘录,其余三处不变),已按新方案重新核对并补齐 lockfile。

新方案核对

lock-sync 第二次红 = 同一个机制的第二条腿

本轮操作

状态:CI 在 runner 队列里排队(同分支已有 2 个 run 在列,e2e 车道对新 head 已全绿),等主 CI 出结果;合并留给人。

…, fold timestamp, kernel anchor quote labeled as historical

⚠️ MODEL-FACING TEXT CHANGE(四处,均为模型可见回执文本;消费链推演 + receipt 级回归见 PR body)
kernel-change: last-user anchor 引文标注来源(历史引文≠新用户消息),owner 已批准(2026-11-18 会话 01a1e89d 诊断);机械性措辞修复 + 复现用例。

会话 01a1e89d(ti_an, qwen3.8-27b)诊断的三类混淆载体都在压缩回执里:
① 指纹行去掉 head/tail 标签、保留摘录:
   · b1 full summary 10600ch [2026-11-17 10:35:14 – …] · head "…" … tail "…"
   → · b1 full summary 10600ch [2026-11-17 10:35:14 – …] "… … …"
   标签读起来像「只存了开头和结尾」,触发模型对刚建的块做防御性
   decompress(#2544 误读源头是标签本身);摘录保留 #1294 自查价值
   与 #1615 surrogate 切口守卫(safePrefix/safeSuffix/scrubLoneSurrogates)。
② 成功回执头追加折叠时刻:… tokens saved.] folded at 2026-11-18 10:05:12
   回执是唯一一类引用用户话语却无 <acp> time= 的系统行;提交时墙钟,
   回执是全新尾消息,无缓存后果。
③ #2544 指引句去掉与摘录绑定的前半句(search_context 优先的检索路由保留)。
④ kernel(unit-projection.ts)保护带排除警告里的 Last-user anchor 引文
   标注为历史引文:Last-user anchor (historical quote, NOT a new user
   message): m00003 "…" —— 防模型把回执里的用户话语引文当成刚说的新指令
   (现场:编出 "user's latest message (m02386/m02387)" 并要求执行)。
   kernel 0.0.198 → 0.0.199。

金色快照(有意更新,见 PR body):② 的 folded at 是新墙钟形状,
tests/golden-storage-drive.ts 按既有 STAMP_ATTR/STAMP_SPAN 同类归一化
新增 FOLDED_AT_RE(5 处 digest 通道),重生成 tests/golden/storage-render/
四个快照(仅 fold 轮 sha + state digest 变化)。

回归:tests/compress-fingerprint-refold.test.ts(无标签形状 + #1615 四个
surrogate 切口/清洗用例钉新格式)、tests/issue4313-fingerprint.test.ts、
tests/issue4313-message-timestamp-toggle.test.ts、tests/text-safe.test.ts、
tests/issue5173-last-user-anchor.test.ts、tests/issue6021-image-offload-anchor.test.ts、
kernel/tests/issue5109-anchor-skip-injections.test.ts、
tests/golden-storage-render.test.ts(5/5)、storage-engine-proofs 四 wire 平价(4/4)。
本地:7 文件 66/66、8 文件关联清扫 61/61、kernel 套件 1640/1640、typecheck/build 绿。
全量以 CI 为准。

Ref: session 01a1e89d diagnosis (2026-11-17), plan approved by owner 2026-11-18.
@ranxianglei
ranxianglei force-pushed the fix/lean-compress-receipt branch from f5e604b to 497efc7 Compare November 18, 2026 04:31
@ranxianglei ranxianglei changed the title [PR] Strip citation leakage from compression success receipt + stamp collapse timestamp (model-visible text, 4 occurrences) | 压缩成功回执去引文泄漏 + 打折叠时间戳(模型可见文本,4 处) 压缩成功回执去掉 head/tail 标签(保留摘录)+ 打折叠时间戳 + kernel 锚点引文标注来源(模型可见文本,4 处) Nov 18, 2026
@ranxianglei ranxianglei changed the title 压缩成功回执去掉 head/tail 标签(保留摘录)+ 打折叠时间戳 + kernel 锚点引文标注来源(模型可见文本,4 处) [PR] Remove head/tail tags from the compression success receipt (keep excerpts) + add collapse timestamps + annotate kernel a | 压缩成功回执去掉 head/tail 标签(保留摘录)+ 打折叠时间戳 + kernel 锚点引文标注来源(模型可见文本,4 处) Nov 18, 2026
@ranxianglei
ranxianglei merged commit 3f0c1d2 into master Nov 18, 2026
52 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1232-master.3f0c1d2 (rolling master tag).

npm install -g billion-context@0.0.1232-master.3f0c1d2  # 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 18, 2026
…nder golden conflict

Master's lean-compress-receipt fix (#7105) and the PR's additive lastFoldDrift metadata field both touched the 4 storage-render goldens. Regenerated from the merged code (scripts/update-storage-render-goldens.ts) so the snapshots reflect BOTH changes; golden suite 5/5 green.
ranxianglei pushed a commit that referenced this pull request Nov 18, 2026
…eceipt reword + #6775 persisted fields)

Master's compress success receipt change (497efc7, PR #7105) and the #6775
persisted-field work moved the persisted message shas and state digests.
Regenerated all four storage-render goldens on the final rebased tree with
scripts/update-storage-render-goldens.ts: wire shas are now byte-identical to
master's pins; the only remaining delta vs master is this PR's own
post-retire persist contract (retired-id anchor swap + digest fields).
ranxianglei pushed a commit that referenced this pull request Nov 18, 2026
…lict at 0.0.200

Master advanced past the PR base again (batch11 wave11 #6827, lean-compress
receipt #7105, wire-client-sidecars #7083, p1 batch b2/b3, #7087, #7101 ->
kernel 0.0.199, storage-render goldens regenerated for #6775 persisted
fields, 400 files). Content hunks auto-merged (kernel/src/compress.ts,
kernel/src/types.ts, all four storage-render goldens); the only conflicts
were the three kernel version lines, resolved at 0.0.200 = master's 0.0.199
+ this PR's kernel/src change, per the CI-enforced kernel version discipline.

Targeted local verification: tests/golden-storage-render.test.ts 5/5,
tests/storage-state-fields.test.ts 2/2, kernel issue6116/issue3769/
hide-consumed suites 27/27.
ranxianglei pushed a commit that referenced this pull request Nov 19, 2026
…eceipt reword + #6775 persisted fields)

Master's compress success receipt change (497efc7, PR #7105) and the #6775
persisted-field work moved the persisted message shas and state digests.
Regenerated all four storage-render goldens on the final rebased tree with
scripts/update-storage-render-goldens.ts: wire shas are now byte-identical to
master's pins; the only remaining delta vs master is this PR's own
post-retire persist contract (retired-id anchor swap + digest fields).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant