Skip to content

fix: stop telling DSH to call an unreachable compress tool (#3177) - #3287

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-15_dsh-compress-surface-off
Oct 16, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-15_dsh-compress-surface-off

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #3177

What & why

In DSH (DeepSeek Harness), bili registers its ACP compression tools (compress / decompress / …) at the host scope via dsh-native.js, which the preset-standard agent cannot reach — the issue's full scan found 0 of 3939 request headers carrying bili's tools, while third-party MCP tools appeared in 758. Despite that, bili still did two things for DSH-bound plugin sessions:

  1. injected the standing compress system prompt, and
  2. injected the "call compress now" nudge,

telling the model to invoke a tool it can never see or call → recurring Error: unknown tool "compress". The bursts were amplified by the #3004 self-heal 10-minute re-arm cap, which kept re-triggering the nudge on a session that is structurally incapable of compressing.

This fix suppresses both the nudge and the standing compress system prompt for DSH-bound plugin sessions, across all four wires (openai / google / responses / anthropic). pi / omp / opencode and proxy-mode sessions are unchanged — their ACP tools are visible, so they keep the nudge as their proactive trigger (#451).

How

Per wire, one gate:

const dshCompressSurfaceOff = pluginMode && session.metadata["pluginAgent"] === "dsh";

then the nudge gate and the compress-system-prompt gate additionally require !dshCompressSurfaceOff. On the responses wire this is folded into compressSurfaceOn = shouldInject && !dshCompressSurfaceOff so a DSH session takes the same stable tags-only developer slot as any non-injecting session (this keeps the prefix cache append-stable across the native-compaction rebase — without it the developer-message slot would appear/disappear and break cache-friendly-plugin). inject.ts gains an optional suppressCompressPrompt parameter used by the anthropic wire. Tool-schema injection, absorb, and rules gating are intentionally left on the raw injectTool flag (separate features, out of scope).

Behavior change (old → new)

  • OLD: DSH-bound plugin sessions received the standing compress system prompt + the "call compress" nudge (identical to omp/pi). Net effect: the model repeatedly attempted an unreachable tool.
  • NEW: DSH-bound plugin sessions receive neither — they fall back to the tags-only ACP prompt, no nudge. Context-pressure relief for DSH comes from its native compaction (dsh.allowDshCompaction) or bili's externalSummary + autoFold, not from the model calling compress.
  • UNCHANGED: proxy mode; pi/omp/opencode plugin lanes (still get the nudge); absorb/rules features; tool-schema injection gating.

Config surface

No new config keys, env vars, or CLI flags. No config schema, persistence-format, or wire-shape change beyond dropping the two model-facing artifacts described above.

Tests

Rebase note

Rebased onto current master; auto-merged cleanly alongside #3229 (codex mid-history developer) and #3251 in prepare-responses.ts — disjoint regions, no semantic interaction with the compressSurfaceOn gate.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-15_dsh-compress-surface-off (00a1f24)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3879-pr.3287.c6a60bc

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-pr3287.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复。按失败签名+机制检索 open/closed issue 与近期 PR:同症状(DSH unknown tool "compress")的只有原 issue #3177,本 PR 即其修复;最接近的 #3077(dsh 导出缺失)、#3149(title sidecar)症状与机制均不同。本 PR 无并列重复修复 PR 在途。

这是 agent 完成的 PR(正文为 PR 描述),我按 PR Review 规范做独立审核——不复述 PR 自述,重新核 diff、既有行为与测试有效性,结论用结构化八问给出。注意一点:PR base(6b5b283)落后当前 master(545db5f),我会核对新 master 上是否有与本 PR 触碰路径相关的变更,需要的话先 rebase 再下结论。稍等。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

独立审核结论(非转述 PR 描述,全部对 pr 分支代码重读核实)

方向关:#3177 最终定调是「DSH 会话的整个模型侧压缩面关掉(nudge + 常驻 compress system prompt),四条 wire 全关,其他 lane 不动」。本 PR 实现的就是这个承诺,不多不少。修在产生端:删掉的是「指示模型去调用工具」的两个产物本身,不是事后过滤报错——疏不是堵。若明天 DSH 冒出别的 unknown-tool 形态,这个修法依然成立。✓

回归审查(逐项既有行为):

  • proxy 模式:pluginMode=false → 门为假,nudge/compress prompt 原样保留。测试有 proxy 对照组钉住。保持。
  • pi/omp/opencode 插件 lane:pluginAgent !== "dsh" → 门为假,nudge 保留(0.1.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急 #451 主动触发语义不变)。测试有 omp 对照组钉住。保持。
  • emergency nudge / directive 文本(在 willInjectNudge && turn.nudge 分支内):对 DSH 一并被抑制——有意且正确,它们同样指示调用不可达的 compress。
  • responses wire 的 developer slot:改后 DSH 走 tags-only 稳定槽位(与任何不注入会话一致)。读码确认:之前该槽位随 shouldInject 出现/消失,native-compaction rebase 时前缀缓存会断;改后每轮恒定存在,append 更稳。既有 cache-friendly-plugin P6 场景(dsh rebase、四 wire)钉住此行为。保持且改善。
  • anthropic inject.ts 签名:新增参数可选、默认 false,所有既有调用点行为不变。保持。
  • absorb/rules/工具 schema 注入:按 PR 声明有意未动(仍在 raw injectTool/shouldInject 上)——见下方新发现。
  • 绑定时序:pluginAgent 在 prepare* 调用之前落定(handle.ts:1403-1405 先于 :2134-2152,sticky 恢复 :1379),DSH 首个请求即已打标,无首轮不一致窗口。
  • dsh上下文700K不触发压缩 #3004 self-heal 放大器:其 streak 只在 nudge 实际注入时推进;修后 DSH 永不产生 nudgeActive → 10 分钟 re-arm 循环自然死亡。这正是它消除爆发而不仅仅是让错误消失的原因。
  • 高危模式逐项:无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化——唯一的行为变化就是作者已披露的那两个模型侧产物的移除(旧值→新值:DSH 收到常驻 compress prompt+nudge → 不再收到,回落到 tags-only ACP prompt;原因:工具在 DSH 侧不可达)。披露合规。

测试有效性:两个新测试是真测试——hermetic(临时端口、确定性 usage 报告 arm、唯一 session id),断言有牙。我在未修复的 origin/master 上复跑 PR 的测试文件:两条 #3177 用例均失败(not ok 3 ... drops the compress nudge、not ok 4 ... drops the standing compress system prompt),对照组通过;repoint 后的 #2432 breaker 子测试换到 omp lane 后覆盖仍然有意义。小缺口(可接受):新测试只钉了 openai wire;responses wire 的 DSH 路径由既有 cache-friendly-plugin 套件覆盖,google/anthic 的门是同构的一行插入。

CI 过程说明(重要):PR 原 head 195ecfba3 四个 shard-1 test lane 全红——排查后是存量红 master:#3071(经 PR #3101 合入)给 src/server/budget.ts 加了 OUTPUT_CLAMP_MIN_OUTPUT=4096 能力下限,但没更新 #3148 测试里钉死的 1360 期望值;我在 origin/master 单文件复跑得到完全相同的失败,确认与本 PR 无关。已在 PR 分支补一个独立标注 commit test: update #3071 4096 capability floor 的 #3148 钳制 pin(red master since #3101)(6e6fac75a,只改断言与其算术注释,存储值回显 fixture 不动)。当前 head 30/30 全绿。

审核中发现的新问题(不同机制,未并入本 PR):absorb 开启后,插件模式会话会被注入 absorb 指令但 absorb 工具 schema 在插件模式下从不注入——与 #3177 同症状家族(unknown tool)、机制不同(absorb 门控漏查 pluginMode,波及所有插件 lane)。已按规范另立 issue:#3293 (带来源标记与查重声明)。

结构化八问

  1. 是什么问题:DSH 会话被 bili 的常驻 compress 提示词和尾部 nudge 反复要求调用一个 DSH 永远看不到的 compress 工具(bili 把工具注册在 DSH host 作用域,preset-standard agent 不可见),持续报 unknown tool "compress"。
  2. 什么原因导致的:注册作用域与模型可见作用域错配(0/3939 请求头带 bili 工具)是直接根因;pluginMode 正确地剥离了工具注入却留下了两个模型侧指示产物;dsh上下文700K不触发压缩 #3004 self-heal 的 10 分钟 re-arm 上限在结构上无法压缩的 DSH 会话上反复重触发 nudge,放成了爆发式报错。
  3. 影响范围与严重程度:所有 DSH 绑定的插件会话;长会话中每约 10 分钟一轮工具报错噪音、浪费轮次;无数据丢失,但 DSH 的两条减压路径默认都是关的(native compaction 默认拒绝),实际体验是上下文压力无处释放。
  4. 怎么修复的:每条 wire 加一个门 pluginMode && pluginAgent === "dsh",同时抑制 nudge 与常驻 compress system prompt;responses wire 并入 compressSurfaceOn 使 DSH 落在与不注入会话相同的稳定 tags-only developer 槽位(保前缀缓存 append 稳定)。删的是指示的产生端,self-heal 循环随之失去输入而自然停止。
  5. 是否有回归问题:未发现。proxy、pi/omp/opencode 各 lane 行为逐项核对并由测试对照钉住;emergency nudge 对 DSH 的抑制是有意的同因处理;无阈值/时序/输出格式漂移。
  6. 是否破坏缓存:否。responses wire 的 developer 槽位对 DSH 反而从「随条件出现/消失」变为「恒定存在」,跨 native-compaction rebase 的前缀缓存 append 稳定性保持(cache-friendly-plugin P6 套件覆盖)。
  7. 是否改了设计方向:否。沿用既有的 per-lane pluginAgent === "dsh" 门控纪律;DSH 的上下文减压仍走原生 compaction / externalSummary+autoFold,不变。
  8. 是否引入了新的配置:无。无新 env/config/flag,无 config schema、持久化格式或 wire 形状变更(除移除上述两个模型侧产物外)。

判定

建议合并(head 6e6fac75a,CI 30/30 绿;base 仅落后 #3277 一个提交且零文件交集,mergeable=clean)。涉及模型可见 wire 内容变化,按 §7.4 不在自动合并范围,请人工合并:#3287

@ranxianglei

Copy link
Copy Markdown
Owner Author

冲突 ,另外看起来是特判? 是不是打的狗皮膏药 没有到根本原因?

@ranxianglei
ranxianglei force-pushed the 2026-10-15_dsh-compress-surface-off branch from 6e6fac7 to 00a1f24 Compare October 15, 2026 18:51
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

冲突已解决:rebase 到当前 master(6ee4a2ac9,含 #3268/#3053/#3289 三个新合入)后 force-push,新 head 00a1f2432,GitHub 已确认 mergeable(clean)。

冲突点只有一处,且是重复修复:分支第二个 commit(6e6fac75a,修 #3148 clamp pin 1360→4096 的红 master 断言)与 master 随后独立合入的 ba456cfff("fix two CI reds … stale #3148 expectation")改的是同一个测试同一处断言——逐行比对后两者语义完全相同(都钉 4096,只差注释措辞)。按「先来后到 + 不搬重复劳动」原则跳过本分支那个冗余 commit,保留 master 版本。PR 现在收敛为单个 fix commit,对 master 的 diff 与原 PR 范围一字不变(同 7 个文件)。

rebase 后验证(rebased head 本地):typecheck + build 干净;定向套件全绿——plugin-nudge-injection + issue2432-dsh-local-compaction 15/15、cache-friendly-plugin 11/11(后者钉住 responses wire DSH 槽位跨 native-compaction rebase 的前缀缓存稳定)。全量回归交 CI。

结构化八问

  1. 是什么问题:系统转发上游 PR 冲突(dirty)——master 前进 3 个合入后,本 PR 分支与其产生合并冲突。
  2. 什么原因导致的:本 PR 顺带修了一个红 master([bug] 上游在会话中途不可用时,bili 把一次故障放大成四重代价:固定节奏 20 连击全部冷发、输出预算被静默钳制 83 次(最狠 65536→1360)、紧急收缩与 nudge 停摆均不可见 #3148 旧 pin),而 master 在 PR 挂起期间由另一个 PR(ba456cfff)修了同一个红——两处改动撞在同一测试文件的相邻行。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性;无代码行为影响。
  4. 怎么修复的:rebase 到最新 master;对撞车的冗余 commit 先做逐行等价性验证(两侧断言值相同、仅注释差异)再跳过,不做机械取边。
  5. 是否有回归问题:无。diff 范围与 rebase 前完全一致(未引入任何新行);高危模式逐项过——无语义漂移、无阈值/时序/输出格式变化。
  6. 是否破坏缓存:不涉及(无新增 wire 变化;既有 responses developer 槽位行为由 cache-friendly-plugin 11/11 复验通过)。
  7. 是否改了设计方向:否。
  8. 是否引入了新的配置:否。

关于「特判?狗皮膏药?」(floor 6)

直说:是 lane 门控(特判),但在 bili 边界内它是根因修复,不是遮症状。分两层:

  • 本仓内的根因:报错的产生端是 bili 自己注入的两条模型侧指示(常驻 compress prompt + nudge)在指向一个 DSH 永远不可达的工具。删掉产生端 = 疏不是堵;dsh上下文700K不触发压缩 #3004 self-heal 循环也随之失去输入而自然停。若明天 DSH 冒出别的 unknown-tool 形态,这个修法依然成立。lane 门控(pluginAgent === "dsh")与仓库既有的 per-lane evidence-permitlist 纪律一致([bug] dsh:side request 先到会抢走 persona 锚点,主会话被 fork 到 |sub:<fp>,原生 compress 永久失败 #2156 sideRequestLike 同款),不是裸 if。
  • 更深的根因(DSH 侧):bili 把 ACP 工具注册在 DSH host scope,preset-standard agent 作用域看不到(0/3939 请求头带 bili 工具)。要让 DSH 真正能调 compress,得在 dsh 的注册通道上让工具进入 agent 可见作用域——那是 dsh 侧能力 + 产品决策(DSH 本身有 native compaction 减压路径,是否值得为它打通 bili 工具链需要你拍板)。这超出本 PR 边界,我不擅自扩scope;若要推进,我按来源标记另立 issue 跟踪,等你决定。

判定:冲突已清,head 00a1f2432 mergeable=clean,CI 跑完即可人工合并:#3287

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

这条评论(冲突 + 特判/狗皮膏药)已在上一条回复里完整作答,这里不重复全文,只给结论指针:

  1. 冲突:已解决——rebase 到 master 6ee4a2ac9,撞车的 [bug] 上游在会话中途不可用时,bili 把一次故障放大成四重代价:固定节奏 20 连击全部冷发、输出预算被静默钳制 83 次(最狠 65536→1360)、紧急收缩与 nudge 停摆均不可见 #3148 pin 修复与 master 的 ba456cfff 语义等价后跳过冗余 commit,新 head 00a1f2432,mergeable=clean。
  2. 是否狗皮膏药:不是。在 bili 边界内删的是报错的产生端(两条指向不可达工具的模型侧指示),属根因修复;lane 门控沿用仓库既有 evidence-permitlist 纪律。更深的根因在 DSH 侧——bili 工具注册在 host scope、preset-standard agent 不可见,要让 DSH 真正能调 compress 需 dsh 注册通道支持 + 你拍板是否值得。要推进的话我按来源标记另立 issue,等你一句话。

详见上一条回复(含八问):#3287 (comment)

@ranxianglei
ranxianglei merged commit 5bbef69 into master Oct 16, 2026
33 of 41 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.477-master.5bbef69 (rolling master tag).

npm install -g billion-context@0.0.477-master.5bbef69  # 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 Oct 16, 2026
…3312-#3320 batch)

- keep #3298 changes on master's post-absorb shapes: relay round-2 rebuild
  and all four prepare* paths keep withProjectAttribution; absorb imports/
  sections dropped with #3309
- storage-render goldens: metadata-section drift after the merge (absorb
  fields gone from session metadata) — regenerated via
  scripts/update-storage-render-goldens.ts, wire-body sections unchanged
This was referenced Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant