Skip to content

The plain text content of MCP compress is not simplified, causing the full summary to be redundantly retained. | MCP compress 的纯文本 content 未被简化,导致完整摘要重复保留 #3975

Open

Description

@kuviki

问题

在官方 0.1.202(6deb4547)中,MCP compress 接受纯文本范围块形式的 content,但 consumed-call 清理逻辑未能解析这种格式,导致调用参数中的完整摘要与 kernel 生成的 acp_summary 同时保留。

对象数组形式的 content 已能正常简化。

实际观察

对同一份会话快照使用运行版清理函数离线核对:

  • 共15次 mcp__bili__compress 调用。
  • 13次对象数组调用已简化,长摘要截为200字符 stub。
  • 2次纯文本 content 调用没有简化,参数合计约2.68K tokens。
  • 这两次调用涉及10个活跃块,逐字核对确认:调用参数和 kernel 摘要均保留完整正文。
  • 重复摘要正文合计约2.54K tokens,不含参数包装。以上均为本地估算。

触发格式

纯文本形式,例如:

{
"content": "m00100–m00120 任务进展\n完整摘要……\nm00130–m00140 验证结果\n完整摘要……"
}

相比之下,对象数组形式可以正常简化:

{
"content": [
{
"startId": "m00100",
"endId": "m00120",
"topic": "任务进展",
"summary": "完整摘要……"
}
]
}

原因定位

kernel/src/hide-consumed.ts 的 parseCallText 支持对象数组,以及序列化为 JSON 数组的字符串,但不支持纯文本范围块。

因此,这两次调用无法按范围匹配活跃 block,被识别为 orphan,并落入最近两个 orphan 的保留窗口;后续 compact 也无法处理,完整参数持续保留。

另一个相关问题是 src/server.ts 的 buildCarrierIndex 未识别 MCP 形式的 compress 调用。但当前 MCP 路径保留 Kernel 全文摘要,对已经截为 stub 的对象数组调用反而起到了信息保护作用。因此,不建议直接扩大工具名匹配并移除 Kernel 摘要。应优先完善纯文本 consumed-call 清理;若要统一摘要载体去重策略,还需要显式区分完整摘要与 stub,确保不会删除唯一的模型可见全文。

修复建议与边界

建议让 consumed-call 清理支持 compress 工具已经接受的纯文本范围块格式,并与摘要载体去重联合设计。

不能仅扩大载体索引的工具名称匹配:对象数组调用中的长摘要已经被截为200字符,kernel 摘要可能是唯一完整载体。若只凭调用存在或范围匹配就删除 kernel 摘要,会丢失全文。

期望:

  1. 纯文本与对象数组格式都能正确识别活跃范围,并执行相应清理。
  2. 任意处理后,每个活跃块至少保留一份完整摘要。
  3. 只有确认存在完整的替代摘要时,才删除对应 kernel 全文;stub 不应被视为完整载体。
  4. 覆盖纯文本、对象数组,以及部分范围失效的回归测试。

目前可以通过要求模型后续仅使用对象数组形式暂时规避,但已有历史调用的重复仍需要清理器处理。

Activity

  1. changed the title [-]MCP compress 的纯文本 content 未被简化,导致完整摘要重复保留[/-] [+]The plain text content of MCP compress is not simplified, causing the full summary to be redundantly retained. | MCP compress 的纯文本 content 未被简化,导致完整摘要重复保留[/+] on Oct 20, 2026
  2. ranxianglei commented on Oct 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    查重:不重复。 按「consumed-call 清理 / 纯文本 content / acp_summary 重复保留」等关键词检索 open+closed issue 与 PR,无同症状同机制条目。

    标签:bug + scope/kernel + p2。 缺陷类;根因在 kernel 的 consumed-call 清理(hide-consumed);能正常使用但清理机制对纯文本格式失效、重复摘要长期驻留历史(有界但不收敛),属 p2。客户端标签不打——MCP shim 是多宿主共用面,issue 未指向具体宿主,不瞎猜。

    审核结论(先验证后动手):

    1. 问题成立,机制与你的定位一致,且有一处补充。 kernel/src/hide-consumed.ts 的 parseCallText(line 41)只处理 content 为对象数组、或序列化为 JSON 数组的字符串;纯文本行式 content 走 JSON.parse 失败分支后直接返回 null。后果链:quotedRangeKeys 为空 → resolveFate 判 orphan → 落入 KEEP_LAST_ORPHANED=2 窗口;窗口内保留时 rewriteCompressText/compactCompressText 同样因解析失败返回 null,长摘要不会被截成 200 字符 stub,完整参数持续驻留。补充一点:裸名 compress(proxy 车道)若用纯文本行式提交,同样不 stub——因为该路径按 callId 匹配命中 active 后永远保留,参数全文比 MCP 孤儿窗口更持久。属同一机制家族,一并修。
    2. buildCarrierIndex 部分核实但不按字面修。 src/server.ts:2101 确实只收集裸名 compress,MCP 块(合成 plugin_ callId)的锚点因此不被 strip。但如你指出的边界:对象数组调用的长摘要已被截成 stub,kernel 全文摘要是唯一完整载体——把载体索引扩到 MCP 名只会删掉唯一全文,造成数据丢失。所以修复不动 carrier 索引,让纯文本调用走与对象数组完全相同的结局:参数截为 stub + kernel 摘要保留全文。每个活跃块处理后至少一份完整摘要(期望 2/3 满足),且不再凭调用存在删 kernel 全文。
    3. 修法方向: 行式的语义归属在 kernel 自己的参数解析器(parse-compress-input.ts 的 splitLineEntries/parseLineEntry,含 ref 规范化),compress: literal backslash-n in string content still fails as kind=content-not-array, hiding the real missing-summary reason #3780 已确立「共享归宿在 kernel」的先例。让 hide-consumed 复用同一套行式解析做范围识别与 stub 重写,不在 host 侧复制第二份格式实现。

    边界声明: 本修复触碰 kernel/(hide-consumed + parse-compress-input 导出一个行式解析 helper),PR 将带 kernel-change: 声明、commit 用 kernel: 前缀,按 Kernel Boundary 走人工审查档。回归测试覆盖:纯文本全活范围、对象数组(防回退)、部分范围失效、全死范围、失败折叠孤儿窗口、stringified-JSON 数组形态。

    开始实现,完成后带 PR 链接回复本线程。

  3. ranxianglei commented on Oct 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    修复完成,PR:https://github.com/ranxianglei/billion-context/pull/4032(Closes #3975,已按 PR 描述声明 kernel-change,kernel 变更走人工审核层级)。

    八问

    1. 是什么问题:compress 工具本身接受两种 content 格式——对象数组和纯文本范围块(首行 m00100–m00120 主题、其余行是摘要),但出站历史的 consumed-call 清理器只认对象数组。纯文本格式的调用解析不出任何引用范围,被误判为 orphan,落进「最近两个 orphan 保留窗口」且永远不被截断,于是调用参数里的完整摘要与 kernel 的 acp_summary 长期双份保留。
    2. 什么原因导致的:kernel/src/hide-consumed.ts 的 parseCallText 对字符串 content 只做一次内层 JSON.parse,不是数组就放弃(返回 null);而纯文本格式正是 compress 工具在「非 JSON 数组」时走的正式接受路径(parse-compress-input.ts 的 splitLineEntries/parseLineEntry)。清理器与工具的接受面不对称——这是根因。附带发现同一机制也影响裸名 proxy 车道:id 命中的纯文本调用此前也永远保留全文。
    3. 影响范围与严重程度:所有使用过纯文本格式 compress 调用的会话(MCP 车道为主,裸名车道同样命中)。触发条件:模型选择纯文本格式 + 摘要超过 200 字符。程度:上下文只增不减地冗余膨胀(报告快照实测约 2.5K tokens/2 次调用量级的重复正文),不影响功能正确性、不丢数据——p2。另外这类调用会占用 orphan 保留窗口,挤掉真正失败调用的可见性。
    4. 怎么修复的:让清理器复用工具自己的接受阶梯,而不是第二套手写解析——从 parse-compress-input.ts 导出 parseLineContent(stripJsonWrapperResidue → splitLineEntries → parseLineEntry),hide-consumed 对「内层非 JSON 数组」的字符串 content 走它取归一化范围键(与块存储的 ref 形态对齐)。之后纯文本调用与对象数组完全同路径:按范围判活/死、长摘要截成 200 字符 stub、头行逐字保留、字符串形状保持。刻意不扩大 buildCarrierIndex:截断后的参数不是完整载体,若凭调用存在就删 kernel 全文会丢全文(即你指出的边界)——终态是「参数 stub + acp_summary 作为唯一完整载体」,与今天对象数组车道的终态一致。不可解析的垃圾串保持逐字节不变。
    5. 是否有回归问题:审过的既有行为——对象数组路径、序列化 JSON 数组路径(fix: persistent overlay homes for pi/omp/hermes launchers (session history loss) #230 形状+截断)、垃圾/refless 串(byte-identical)、orphan 窗口语义(仍保留最近两个,只是不再被成功的纯文本调用占用)、acp_summary 锚点保留逻辑(未动)——全部有回归测试钉住。kernel 套件本地 1327/1327 绿,bili 定向车道(endstate/[Bug] MCP compress 历史调用未被清理,长会话累积大量旧摘要与回执 #2970/[Performance] Summary-carrier lookup rescans full history per active block (O(B*N)) #2042/stub-guard)25/25 绿,全量交 CI。高危模式逐项:无语义漂移、无 fail-fast 变吞错、无阈值/时序变化(200 字符 stub 常量未动)、输出格式仅新增「纯文本长摘要被截断」这一预期行为。
    6. 是否破坏缓存:不涉及——不改消息 id/顺序/前缀字节稳定性,stub 改写本就发生在既有的 outbound 渲染路径上。
    7. 是否改了设计方向:没有。方向不变:清理器必须与工具的接受面对齐,共享解码归属 kernel(compress: literal backslash-n in string content still fails as kind=content-not-array, hiding the real missing-summary reason #3780 先例的既有结论),本次只是把该结论落到 hide-consumed。
    8. 是否引入了新的配置:无。无新 env/config/默认值。

    行为变更披露(旧→新):纯文本格式 compress 调用的渲染参数,长摘要由「永久保留全文」变为「截为 200 字符 stub」(MCP 车道与裸名车道同时生效);此类调用的命运判定由「恒为 orphan」变为「按引用范围判活/死」。这是本 issue 期望 1 的直接实现,非意外漂移。

    已有历史会话中重复保留的调用参数会在下次该会话出站渲染时被同一清理器处理掉,无需迁移。CI 状态我随后跟进确认。

  4. ranxianglei commented on Oct 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

    补充一条进度说明:在我上一条评论之后,master 合入了 #3769(orphan 处理从「保留最近两个」的轮转改为「只在真实 fold 之后清扫」)。PR #4032 已 rebase 到最新 master,内核测试按新语义适配,修复本身与最终保证不变:

    本地验证:kernel 全量 1407/1407、typecheck 干净、bili 定向 25/25。等 CI 全绿后这里同步结论。PR: #4032

  5. ranxianglei commented on Oct 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

    CI 状态说明:rebase 后第一轮 CI 有 4 个 test shard 红,逐一核对日志后确认全部是 master 上已存在的偶发测试,与本 PR 无关:

    证据:master 当前 head bc4a3f87e 自己的 CI(run 39460567882)就是同样的 5 个 shard 红、同样的两条测试签名;本 PR diff 不触碰 storage/loadSync 路径;本地在 PR head 上定向跑该 e2e 测试通过。失败 shard 日志里还有 sqlite 锁争用迹象(handle may stay locked)。

    处置:已触发 rerun-failed-jobs(等结果);这个 red-master 偶发家族没有现成跟踪项,已按规范单独立项 #4041(带来源标记与完整证据),不混入本 PR。其余所有 gate(kernel-guard / version-guard / lock-sync / docs / lane-guard 等 27 项)全绿,lock-sync 之前红过一次是因为内核版本 bump 漏了 kernel/package-lock.json 再生成,已修进 kernel commit。

  6. ranxianglei commented on Oct 20, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

    收工报告 — 修复完成,PR:https://github.com/ranxianglei/billion-context/pull/4032(`Closes #3975,已声明 kernel-change:`)

    八问:

    1. 是什么问题:MCP compress 接受纯文本范围块格式的 content(首行 m00100–m00120 主题、其余行摘要),但 consumed-call 清理层不认这种格式——调用参数里的完整摘要永远不被简化,与 kernel 的 acp_summary 全文重复保留。
    2. 什么原因导致的:kernel/src/hide-consumed.ts 的 parseCallText 只解析对象数组与「序列化成 JSON 数组的字符串」;纯文本字符串落入 orphan 分支,而 orphan 保留路径的改写函数对无法按条目解析的参数直接放弃(返回 null),完整正文就一直留在出站历史里。根因是格式覆盖缺口(工具入口 parse-compress-input.ts 认纯文本、清理层不认),不是清理策略错误。
    3. 影响范围与严重程度:所有用过纯文本形式 compress 的会话(MCP 车道为主;裸名 proxy 车道的 id 匹配调用同样中招)。每次命中约多留 1-3K tokens 且随历史重放持续存在;对象数组用户不受影响。p2(能用、有绕行,但上下文只增不减地浪费)。
    4. 怎么修复的:让清理层复用 kernel 自己的行式解析器——在 parse-compress-input.ts 导出 parseLineContent(规范化 refs + 逐条目解析),hide-consumed.ts 用它在三种既有分支之外补上纯文本分支:fate 判定(按引用范围匹配活跃块)、存活条目 stub(≤200 字符)、失效条目剔除,全部与对象数组同路。刻意不扩大 buildCarrierIndex 的工具名/格式匹配来删 kernel 全文:stub 不是完整载体,删了锚点就丢全文(issue 期望 Use kernel renderTags:"text-only" + forbid tag echoing in prompt #3 的红线)。终态 = 纯文本 ≡ 对象数组:参数 stub、kernel 摘要为唯一完整载体。
    5. 是否有回归问题:逐项审过——对象数组 / 序列化数组 / 不可解析垃圾三条旧路径字节不变(各有回归钉);[Bug] MCP failed compression record rotation prematurely rewrites the history prefix, triggering expensive cache recompu | [Bug] MCP 失败压缩记录轮换提前改写历史前缀,触发大额缓存重算 #3769 折叠门控 sweep 语义不受影响(纯文本载体按范围解析为 active,天然免扫;quiet turn 孤儿可见但被 stub);acp_summary 锚点保留行为不变。本地:kernel 全套 1407/1407、bili 定向套件 25/25、typecheck 干净。
    6. 是否破坏缓存:不涉及。改动只作用于「已被消费」的 compress 调用出站渲染(长摘要→stub),与既有对象数组 stub 同一机制,前缀缓存稳定逻辑未动。
    7. 是否改了设计方向:没有。
    8. 是否引入新配置:没有。

    CI 现状:PR 的全部 gate(kernel-guard / version-guard / lock-sync / docs / lane-guard 等 27 项)绿;test shard 被 master 自身的红风暴卡住(master run 39460567882 与 PR 三轮共 19/19 shard 次挂同样的两条存储水合测试签名,本地 18 次并行压测无法复现,日志有 ENOSPC 磁盘压力证据)——已单独立项 #4041 跟踪并附完整证据,与本 PR 无关。

    合并判定:代码侧收工,等 CI 风暴过去后即为可合状态;因含 kernel/ 变更,按 Kernel Boundary 走人工 review 档,请 owner 审阅后自行合并。

  7. 12 remaining items

  8. added a commit that references this issue on Nov 5, 2026
  9. ranxianglei commented on Nov 5, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    CI 已全绿(PR head 38fd9ac91):16 success / 14 skipped / 0 failure,含 ubuntu+windows × node 22/24 全部 test shard 与 lock-sync 门禁。期间修掉一个我自己 rebase 时引入的 lockfile 格式问题(kernel/package-lock.json 两字段被挤到同一行,norm 后与 CI 期望逐字节一致),已折进对应 commit,diff 保持干净(全 PR 共 10 文件)。

    当前状态:

    • 代码侧完整:纯文本行式解析修复(kernel)+ mcp__client__compress 方言识别(host)+ 回归测试;
    • PR [PR] fix(kernel): stub plain-text line-form compress calls in consumed-call cleanup (#3975) #4032 可直接 review/合并——合并是 human-only,等你操作;
    • 发版需要你的批准:批准后我立即切 release 分支开 release PR(建议随下一个 patch 版本走,无需单独紧急通道——修复向后兼容,旧行为只是「多保留重复文本」,不存在数据风险)。
  10. darkness-A commented on Nov 5, 2026

    @darkness-A
    Contributor

    Correction to my previous comment — the mcp__client__compress whitelist entry is not needed for our lane.

    I mislabeled the tool name. mcp__client__compress is how our own gateway (sitting downstream of bili, between bili and the Anthropic API) re-exposes client tools upstream. The request bili actually sees from OpenCode carries the bare built-in name compress (bili's proxy-injected tool), so the existing predicates already match it. Our gateway's own tool-batch records confirm the names it receives from bili are exactly compress / decompress.

    Evidence that the parsing fix alone is sufficient on this lane: I applied a local patch to the shipped v0.1.212 dist/index.js equivalent to #4032's original fix (parseCallText falls back to the built-in splitLineEntries/parseLineEntry for plain-text line-form content; serializeCompacted keeps line form with the 200-char stubs; quotesActiveBlock recognizes the same form) — no name whitelist change.

    • Offline, against the 8 compress calls in a real request: arguments 48,425 → 5,569 chars, all ranges parsed correctly, output kept as plain text.
    • Live: right after restarting bili, the next request of that session already sent the stubbed tool_use.input for the past compress calls.

    So please consider dropping the mcp__client__compress entry from the PR: it is not exercised by any real traffic we have, and client is a generic MCP server name, which is the same misidentification risk you rejected for suffix matching (#2578). Sorry for the noise.

    Heads-up for gateways (not a bili bug, FYI): stubbing rewrites the input of an already-executed tool_use in history. Gateways that match history exactly can see that as "same tool id, different arguments". Ours rejected it once, at the turn where a just-made compress call was still awaiting its result; we now degrade it to a cold rebuild on our side. It is also a one-time prefix change, so there will be one cache rewrite per session when the fix rolls out. Keeping the stub deterministic and stable across turns (which it is today) is what matters.


    更正上一条评论:我们这条链路不需要 mcp__client__compress 白名单。

    我把工具名写错了。mcp__client__compress 是我们自己的网关(位于 bili 下游,在 bili 和 Anthropic API 之间)转发上游时给客户端工具起的名字。bili 实际从 OpenCode 收到的是 bili 代理自己注入的裸名 compress,现有谓词本来就能识别。网关的工具批次记录也证实,从 bili 收到的工具名就是 compress / decompress。

    只修解析就够了的证据:我在已发布的 v0.1.212 dist/index.js 上打了一个本地补丁,与 #4032 最初的修复等价:parseCallText 遇到纯文本行式内容时,改用内置的 splitLineEntries/parseLineEntry 解析;serializeCompacted 输出保持行式,摘要截成 200 字符短稿;quotesActiveBlock 也能识别这种形式。名字白名单没有改动。

    • 离线验证:用一次真实请求里的 8 个 compress 调用跑了一遍,参数从 48,425 字符降到 5,569 字符,所有范围都解析正确,输出仍是纯文本。
    • 真实链路:重启 bili 后,该会话的下一次请求里,历史 compress 调用的参数就已经是截短后的版本。

    建议从 PR 中去掉 mcp__client__compress 这一条。我们没有任何真实流量会用到它,而且 client 是很常见的 MCP server 名,误认风险和你们拒绝后缀匹配(#2578)的理由是一样的。抱歉带来干扰。

    给网关的提示(不是 bili 的 bug,仅供参考):截短会改写历史里已执行过的 tool_use 的 input。严格逐字比对历史的网关会把它看成"同一工具 id,参数却变了"。我们的网关在"刚调用完 compress、还在等结果"的那一轮拒绝过一次,现已在我们这边降级为冷重建。另外,这是一次性的前缀变化,修复上线时每个会话会有一次缓存重写。关键是截出来的短稿要确定且逐轮稳定,目前已经是这样。

  11. ranxianglei commented on Nov 5, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    感谢更正,这个锅我认——我只信了工具名标签,没有追问改名发生在哪一层。按你的建议已全部处理:

    已做

    • mcp__client__compress 白名单 commit 已整体撤掉(不是只删配置行:谓词、lockstep twin、相关测试行全部回退),PR 回到纯解析修复的形状,head 72f710333 已重新推送;
    • PR 描述更新:记录了「考虑过精确名白名单、因无真实流量证据且 client 是通用 MCP server 名(与 [Bug] MCP 模式下 acp_rule 的工具名带有前缀,可能导致硬保护失效 #2578 拒绝后缀匹配同一风险)而放弃」的决策过程,避免后人再走一遍弯路;你这份验证数据(离线 8 个真实调用 48,425→5,569 字符、重启后线上请求即带 stub)也写进了 PR 描述作为现场验证。

    网关提示收到(确认不是 bili 的问题):stub 是确定性的且逐轮稳定——这条已有测试钉住(stub fixpoint stability pin),上线时每个有历史行式调用的会话会有一次性缓存前缀重写,这一点也已写进 PR 的行为变更表;你们对「compress 刚发出还在等结果」那轮的拒绝已在网关侧降级为冷重建,bili 侧无需动作。

    一个诚实的技术差异说明:你的本地补丁同时让 quotesActiveBlock 认行式格式,而本 PR 刻意没有扩展它——宿主侧的载体索引(buildKernelSummaries/carrier index)同样不解析行式,所以 acp_summary 锚点继续作为唯一完整载体保留,两侧保持一致;对你这条链路没有影响——裸名调用是按 id 匹配的,stub 改写不依赖范围解析。

    状态:新 CI 正在 72f710333 上跑(全套约 15 分钟),结果出来我会补一句。合并与发版需要 owner 批准(agent 不能自行合并);如果 owner 同意,合并后我可以提 release PR。

  12. ranxianglei commented on Nov 5, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    CI 终态 + 收工结论

    PR #4032 最终 head e8fc736ba(解析修复 + ci-fixes 同步)全矩阵绿(run 41952551785,0 failure)。此前的红是 3 条 hermetic-proxy timing flake(两个文件在我 head 与干净 master 上本地均可复现绿,与本 diff 无关;ci-fixes 的 lag-aware teardown 落地后消失,细节在 #4599)。

    PR 最终形态:纯解析修复——parseCallText 复用 compress 自己的验收阶梯(parseLineContent)识别纯文本行式 content,此类调用按范围归入 active/inactive 并统一截成 200 字符 stub;kernel 0.0.180→0.0.181,新增回归测试 14 个。白名单条目已按你的更正撤掉。

    八问:

    1. 是什么问题:纯文本行式 compress 调用永不被清理逻辑简化,完整摘要正文同时留在调用参数与 acp_summary 里,每轮请求双份发送(你的会话实测约 2.5–3 万 token/请求)。
    2. 什么原因导致的:parseCallText 只认对象数组/JSON 数组字符串,行式 content 返回 null → 调用落入 orphan 处理,rewrite/compact 两条路都整体跳过;compress calls rejected when the summary text rides in content next to top-level startId/endId — plus U+2212 dash silently folds the wrong range #4252 之后 schema 只宣传行式,长会话迟早撞上。
    3. 影响范围与严重程度:凡模型使用行式的车道;每次折叠永久保留全文(compress 受保护不可折叠),上下文只增不减、usage 被钉在压力带附近反复触发小折叠(你实测每次折叠省 1.6–1.7 万却要重写 8.5 万缓存)。无数据丢失但成本持续膨胀——按 owner 2026-10-19 修订口径(存储/上下文失控增长类一律 p1),标签已从 p2 升 p1,并补了 opencode 客户端标签。
    4. 怎么修复的:在消费点复用工具自身的验收阶梯解析行式 content,让此类调用按范围识别 active/inactive 并统一 stub;kernel acp_summary 锚点保持不动——stub 后参数不再是完整载体,删锚点会丢全文(你的期望 Use kernel renderTags:"text-only" + forbid tag echoing in prompt #3)。
    5. 是否有回归问题:逐项审过——对象数组/字符串化数组/垃圾路径有回归钉且零变化;无语义漂移、无 fail-fast 变吞错、无阈值/时序漂移;输出仍为纯文本;kernel 全套 + bili 定向 67/67 + CI 全矩阵绿。
    6. 是否破坏缓存:一次性影响——含历史行式调用的存量会话首个请求前缀重写一次(参数从全文变 stub),此后逐轮确定稳定(fixpoint 稳定性有专测钉住)。你的网关在 awaiting-result 轮的一次拒绝由网关侧降级处理,非 bili 缺陷;heads-up 收到,谢谢。
    7. 是否改了设计方向:没有;修复停留在 consumed-call 清理层,不动 wire 形状、载体索引与保护语义。
    8. 是否引入新配置:没有。

    收工判定:代码侧完成,PR #4032 等 owner 人工 review(kernel 变更,Kernel Boundary 人审档)与合并;合并后请批准一个 release(下一个 patch)让它上车——更新后重启即恢复你的车道(伴随一次性缓存重写)。

  13. onlyonec commented on Nov 7, 2026

    @onlyonec

    Still happening on 0.1.212 in the OpenCode 2 plugin lane (./server, tool name compress).

    I folded one range through /__bili/plugin/tool on a throwaway daemon, then resent the history with the client's compress call:

    • Plain-text content (what the schema asks for): the full summary goes out twice on every later request, once as BILI's [Compressed conversation section] render and once in the call arguments.
    • Array content: the call gets cut to a 200-char stub and the render is stripped too, so no full copy reaches the model at all. The array form isn't a safe workaround in this lane.

    In a long session this is about 36k tokens per request, and each fold makes the provider bill the duplicate uncached.

    #4032 looks right for this lane as is: once it stubs the line-form call, buildCarrierIndex still can't parse that call, so the render stays as the one full copy. If someone later teaches buildCarrierIndex or reconcilePluginFoldCallIds the line form, the plugin lane ends up where the array form is now, with the stub and no summary.

    Could #4032 get rebased and merged?

  14. ranxianglei commented on Nov 7, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    Thanks for the lane-specific data — I verified all three points against the v0.1.212 code (identical to current master for these paths; the v0.1.212→master diff of src/server.ts doesn't touch the carrier index).

    Line-form double-send (first bullet): confirmed — this is exactly the mechanism #4032 fixes, and your end-state analysis holds: once the call is stubbed, buildCarrierIndex still can't parse line-form args, so the render stays as the one complete copy.

    Array-form "no full copy reaches the model": verified as mechanics, but this is shipped by-design behavior, not a bug (#1567 carrier handoff). In the plugin lane the contract makes the client's own re-sent tool-call pair the summary carrier: stripKernelSummaries strips the redundant acp_summary render only while that pair actually rides the post-prepare history and range-matches the block (src/server.ts:2730-2732) — if the pair were pruned or absent, the anchor is kept, so an active fold never ends with zero carriers. The full text isn't lost: it persists in OpenCode's stored history (re-sent verbatim every turn — your repro proves its presence, since the strip requires the range match) and in the kernel block (decompress restores it). The model saw the full summary on the fold turn itself; a stable 200-char stub afterwards is the intended lean steady state, same as every other correctly-working plugin lane. So "not a safe workaround" is a misread — nothing is lost, it just isn't re-sent.

    One honest asymmetry: post-#4032, line-form blocks keep their standing render (one full copy per request) precisely because the index can't parse them — the fail-safe direction. So in your lane, line-form will cost more per request than array-form until someone teaches the carrier index the line form.

    Forward constraint: recorded. I added a design note to the PR body — teaching buildCarrierIndex / reconcilePluginFoldCallIds the line form moves line-form blocks to the same stub-only steady state, which is acceptable only while ≥1 complete carrier survives (client-side pair / decompress); no variant may ship where neither the stubbed call nor the render carries the full text.

    Status: #4032 is already rebased onto current master and CI is fully green (run 41952551785, head e8fc736). Merging is owner-only (agents can't merge PRs here), and releases need owner approval too — both are requested in-thread already; once merged I'll cut the release PR if approved.

  15. added a commit that references this issue on Nov 7, 2026
  16. onlyonec commented on Nov 7, 2026

    @onlyonec

    On the array form, "nothing is lost" doesn't hold for what the model reads. OpenCode's stored history has the full call, but the model only sees BILI's egress, and on 0.1.212 the request after an array-form fold carries neither copy:

    assistant  {"content":[{"startId":"m00001","endId":"m00010","topic":"probe topic","summary":"SUMMARYMARK fact0 fact1 … fact27 f…"}]}
    tool       [Compressed m00001–m00010 → 1 block(s) …] · head "SUMMARYMARK fact0 fact1 fact2 " … tail "… fact119"
    

    There's no [Compressed conversation section] message in it. stripKernelSummaries only checks that the call is present, so it drops the render, and hideConsumedCompressCalls keeps the call but runs it through compactCompressText, which cuts the summary to SUMMARY_STUB_CHARS. Together they leave zero full carriers, the case your invariant rules out. #4032 doesn't touch this path.

    If stub-only is intended, BILI's prompt disagrees: it says the summary "becomes the only record of the replaced conversation" and tells the model to read the summary parameter of past compress calls. If it isn't, the carrier check probably needs to look at the call after compaction.

    The prompt also contradicts itself on format. The tool description asks for one plain string, but the per-summary budget note shows content: [{startId,endId,summary}, {…}], which steers models toward the form that loses the text.

  17. added a commit that references this issue on Nov 7, 2026
  18. ranxianglei commented on Nov 7, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    You're right, and I owe a correction: my "nothing is lost" was wrong about what matters in your lane. Verified against code (v0.1.212 == master on this path):

    Mechanism confirmed. Two shipped features cancel each other out:

    • hideConsumedCompressCalls stubs every retained compress call — including a just-made fold — to 200 chars (kernel/src/hide-consumed.ts:237-241). Its design comment assumes "the rendered acp_summary message already carries it".
    • stripKernelSummaries runs AFTER that (src/server.ts:2667) and strips the render whenever a range-matching bare compress call rides the history (plugin mode: in-place acp_summary never stripped when the client's own compress pair rides inbound — double summary carrier on every post-fold turn #1567 carrier handoff) — checking presence + range match only, never whether the call still carries the full text. Stubbing preserves startId/endId, so the match still hits → anchor stripped. Net: stub + no render = zero full carriers on the wire. Your live capture matches this exactly.

    Full text stays reachable only via search_context/decompress (kernel block) or your client's stored history — which the model cannot read; it sees bili's egress bytes. The practical defect: a 200-char stub silently masquerades as the summary, while the prompt says otherwise ("the summary you write becomes the only record of the replaced conversation" — kernel/src/compression-rules.ts:40; "their summary parameter contains MODEL-GENERATED summaries" — kernel/src/compress-tools.ts:217). The model may believe it holds the record and skip decompress.

    Related finding: open PR #4410 normalized "zero acp_summary markers in steady-state plugin sessions" as expected, justified by "the full summary text rides in the re-sent call arguments" — a premise the stubbing invalidates. Flagged there as an interaction needing joint adjudication.

    Format contradiction — partially confirmed. The advertised schema/description is line-form-only since #4252 (compress-tools.ts:81-93). I could not find an array example in the per-summary budget note itself (src/compress-tool.ts:753 — it points to the tool description); if you can share the exact note text you saw, I'll pin the surface. What DOES still teach array form today: the kernel ACP text/hybrid protocol examples (compress-tools.ts:257/261/328/332), EXTERNAL_SUMMARY_NOTE (src/external-summary-surface.ts:6, visible in external-summary mode), and host failure lectures (src/stream.ts:1009/1025). While the array/line end-state asymmetry exists, those examples steer models toward the lossier path.

    Filed: #5866 with options for the owner:

    • A (recommended): completeness-aware anchor strip — strip the render only when the post-compaction call still carries the exact full summary, otherwise keep it. Array-form converges to the same "stub + full render" steady state line-form gets post-[PR] fix(kernel): stub plain-text line-form compress calls in consumed-call cleanup (#3975) #4032: exactly one full copy per request, deterministic render ⇒ prefix-cache friendly. Cost: one full render per turn (what proxy-mode sessions already pay).
    • B: accept the stub-only steady state, but mark stubs explicitly (truncation marker) + prompt update routing the model to search_context/decompress, plus aligning the residual array-form examples to line form. Cheapest tokens; relies on model behavior.

    Not folded into #4032: opposite direction (that PR removes redundant copies; this restores a missing one), and it's a load-bearing wire-behavior decision that stays owner-gated. #4032 itself is unchanged: rebased onto current master, CI fully green (head e8fc736), awaiting owner review/merge.

  19. ranxianglei commented on Nov 7, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

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

    Bookkeeping close-up for the finding above: issue #5866 is filed and labeled bug + opencode + scope/wiring + p2 (wiring: the strip/stub interaction lives at the host egress layer; p2: no data loss — full text stays recoverable via decompress — but the model-facing record is silently truncated while the prompt claims otherwise). It carries the 来源 marker back to this issue, the cross-link to PR #4410 whose "full text rides in the re-sent call arguments" premise the stubbing invalidates, and the A/B decision options for the owner.

    Nothing else outstanding on my side from your two reports: #4032 remains rebased onto current master with CI fully green (head e8fc736), awaiting owner review/merge; the zero-carrier question (#5866) awaits the owner's A/B decision before anyone implements. If you can share the exact budget-note text you saw with the array example, I'll pin that surface in #5866.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions