Repository navigation
[PR] fix: read Claude Code's deferred-tools list in lane decisions (#6958) - #6967
ranxianglei wants to merge 4 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10634-pr.6967.1b5a5e7This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6967.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Claude Code keeps MCP tools out of tools[] until the model loads them with
ToolSearch; until then it lists them by name in a message. bili decided both
lane decisions from tools[] alone:
(1) mcpDialect was true only when tools[] declared mcp__bili__compress, so
while the tool was deferred the prompt named bare compress — a tool that
does not exist on the host (14 workers hit 'No such tool available:
compress', 13 grew to 133K-234K tokens).
(2) Claude Code has no host profile, so the anonymous profile's
toolsHostScopedByDefault=false kept the compress surface on whatever
tools[] held — an agent with no bili tool was nudged 127x up to 440K
tokens with no way to fold.
The fix reads the deferred list: mcp__bili__compress counts as listed when
declared OR deferred, and a Claude Code request (system block carrying
cc_version=) with no compress tool declared or listed reads as unreachable.
Other hosts keep today's behaviour (the deferred-list header phrase is
Claude-Code-specific).
Host-side only; no kernel change.
Fixes #6958
8516d48 to
ab88993
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重: 重复 — 本 PR 与 #6960 同修 #6958,同方案(从消息读 CC deferred-tools 列表)、同测试文件名。 #6960 先开(2026-11-16 14:43Z,报告者的 fork 分支),本 PR 后开(15:20Z)。按 one-PR-per-thread 与先来后到,两者应收敛为一个 — 收敛方向需要拍板,见本线程随后的 🔶 需要决策 评论。 Review of #6967 (head Method. Read both PR diffs line-by-line; verified the real Claude Code wire shape against the code — CC is a header-less launcher-mode lane ( Key finding — #6967 does not fix bug 2 in real CC traffic. The pre-existing zombie clause in
The tests set What #6967 does fix: bug 1. #6960 comparison (same probe): its prefix gate Behavior change to disclose (applies to whichever PR lands): turning the surface off for tool-less CC sessions also kills the zombie self-heal probe. Minor observations (non-blocking):
CI state (verified live, 2026-11-16 ~17:35Z):
八问(中文,供人工 reviewer):
Verdict: #6967 as-is is not mergeable — it fixes bug 1 only, and its tests assert a traffic shape real Claude Code never sends, so bug 2 (the 127-nudge storm) would ship unfixed while the test suite is green. The consolidation question (keep #6960 vs. rework #6967) needs your call — see the 🔶 需要决策 comment below. |
🔶 需要决策 背景一句话:#6958 有两个并行 PR 同修同案——#6960(报告者 fork,14:43Z 先开)与 #6967(本账号,15:20Z 后开);审核实测 #6967 对真实 CC 流量(headerless)修不掉 bug 2(zombie 条款恒真, 待决问题:保留哪个 PR? 选项(各带代价):
附带披露(两个选项共有):surface-off 门生效后,CC 无工具会话(含 MCP 中途死亡的真 zombie 场景)不再自动 degrade-to-proxy 自愈——旧行为是 nudge 风暴 5 轮后降级恢复压缩,新行为是静默、无压缩、只涨。这是 issue Expected 明确要的行为;若你想保留自愈,需要另行设计(如:nudge 抑制但按请求数推进 zombie 探针),可作为后续工作。 我的推荐 + 不决定的默认行为:推荐 A(先来到 + 真实形状正确 + 测试贴合流量)。若你不决定:两个 PR 都保持 open(agent 不合并、不关闭),不做任何代码动作;#2929 继承红由 #4599 哨兵继续收敛,无需你动作。 |
(ai: vllm-qwen/qwen3.8-27b) 收工状态:审核已交付——本线程两条回复(上两条):①完整 review(查重结论 + 实测发现 + CI 状态 + 八问);②🔶 需要决策(保留 #6960 vs 修 #6967,推荐 A)。 一句话结论:#6967 按现状不可合——实测它只修 bug 1(deferred 工具名);bug 2(无工具 CC 会话 nudge 风暴)在真实 headerless 流量下修不掉,因为 zombie 条款 待你拍板:A) 收敛到 #6960(推荐)/ B) 修 #6967(补 zombie 门 + 改测试为真实形状)/ C) 都保留(不推荐)。不决定则两个 PR 保持 open,不做代码动作;CI 剩余红项(#2929 ×3)为 #4599 在档的继承红,哨兵收敛中。 |
…eping master's variant (5d852d2) The PR's own variant (ab88993) and the owner-landed master variant (5d852d2, 2026-11-17) both fix #6958 in the same two files with mutually exclusive behavior: the PR's CC surface-off gate is the exact gate the owner's commit explicitly rejects (it would starve the #4372 zombie self-heal probe on headerless rounds), and the PR's tests assert that rejected behavior. Resolution: keep master's variant for both src/server/lane-decisions.ts and tests/claude-deferred-tools.test.ts. The PR's diff against master is now empty — the fix already lives on master; the PR is superseded and ready for the owner to close.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved — but this was a semantic conflict, not a mechanical one: master already carries your own variant of this fix, and the PR is now a no-op against master. What I found. The "dirty" merge state was not ordinary drift. Master already contains the owner-landed variant of this exact fix:
What I did.
Label: removed What needs your action (owner-only): PR #6967's diff against master is now empty — the fix it was carrying already lives on master in your variant. Please close it as superseded by 八问(中文,供人工 reviewer):
判定:冲突已解(head |
What this PR does
Claude Code keeps MCP tools out of
tools[]until the model loads them with ToolSearch; until then it lists them by name in a message. bili decided both lane decisions fromtools[]alone:mcpDialectwas true only whentools[]declaredmcp__bili__compress, so while the tool was deferred the prompt named barecompress— a tool that does not exist on the host. 14 workers hitNo such tool available: compress; 13 grew to 133K–234K tokens and never folded.toolsHostScopedByDefault=falsekept the compress surface on whatevertools[]held. 10 research subagents with no bili tool were nudged 127×, up to 440K tokens, with no way to fold.Fix (host side, no kernel change)
In
resolveLaneDecisions(src/server/lane-decisions.ts), read the deferred-tools list from the messages:mcp__bili__compressas listed when it is declared or deferred; setmcpDialectfrom that.cc_version=), turn the surface off when no compress tool is declared or listed. Other hosts keep today's behaviour (the deferred-list header phrase is Claude-Code-specific).Test
tests/claude-deferred-tools.test.tsbuilds anthropic-wire requests in the shape Claude Code 2.1.325 sends (billing header in the system block, deferred-tools list in a message). 5 cases + 1 regression guard for non-CC hosts. On master, 3 of the 5 cases fail; with the fix all pass.Regression check
tests/lane-decisions-matrix.test.ts: 111/111 pass.tests/lane-decisions-b-class.test.ts,tests/issue5527-additional-tools-reachability.test.ts,tests/issue4344-mcp-dialect.test.ts: 22/22 pass.Closes #6958