Repository navigation
[PR] fix: read Claude Code's deferred-tools list to name and reach bili's compress tool - #6960
Conversation
…compress tool
Claude Code keeps MCP tools out of `tools` until the model loads them with
ToolSearch and lists them by name in a message instead. bili read only
`tools`, so it told Orca workers to call bare `compress` ("No such tool
available"; 13 of 81 workers never folded) and nudged research subagents
whose allow-list holds no bili tool 127 times. bili now takes the deferred
list into account for the MCP dialect, and drops the compress surface for a
Claude Code agent that has bili's tool in neither list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Reviewed the diff, traced all 5 new tests against the new code, and pulled the CI failure logs. Assessment below. Direction & correctness — solid, root cause not symptom. The fix reads Claude Code's actual deferred-tools announcement ( CI — all 4 failures are inherited master-red, none are this PR's.
The PR's own new test passed (it sits in a passing shard). Path to green per the CI policy: Minor, non-blocking:
8问(供人审):
Verdict: Correct, well-scoped, root-cause fix; clean code (clear names, no |
…cture-docs fixes Inherited master failures (not PR-introduced), per owner policy 2026-10-24: - test (ubuntu 24/3, windows 22/4, ubuntu 22/3): ranxianglei#2929 nudge-fold probe anchor drift — recalibrated on ci-fixes (245ecb1, 7247410) - architecture-docs: src/responses-system-sections.ts missing from module map — added on ci-fixes (8ed56be) Zero file overlap with this PR's diff (lane-decisions.ts, claude-deferred-tools.test.ts).
The red CI on this PR is fixed. Both failures are master-level (inherited) failures, not introduced by this PR's diff — I verified that before touching anything. What was red
Why it's not the PR's fault Fix (owner policy 2026-10-24, CI-failure coordination)
The merge was clean (zero file overlap with the PR's diff). Verified locally on the merged head
Pushed the final head 七问(中文结构化结论)
收工判定:修复已推送(final head |
…the tool CC exposes (#6958, PR#6938 review) CC 2.1.x keeps MCP tools out of tools[] until ToolSearch loads them and announces them in the request messages instead ("deferred tools are now available via ToolSearch … mcp__bili__compress"). observeDeclaredTools reads tools[] only, so the #4344 dialect was always false for CC and the nudge advertised the bare `compress` — which CC answers "No such tool available" — so workers WITH the tool never folded (field sample: 14 hard fails, 13 never folded, sessions pinned at 133K–244K tokens). resolveLaneDecisions now treats "declared in tools[] OR announced deferred" as "the host has this tool" for both the dialect and compress reachability; the announcement is observed from this request's messages (single site, no caller changes — extractDeferredBiliToolNames). Deliberately NOT the #6960 variant: its claudeCodeWithoutTool gate (no compress anywhere → surface off) would also starve the #4372 zombie probe on headerless rounds. PR #6960 stays unmerged; this supersedes it on the release branch. Tests: tests/claude-deferred-tools.test.ts (CC field repro — dialect flips on the announcement; deferred-only reachability on a host-scoped profile with control; bare compress still wins; extractor over both content shapes). 153 regression tests across the six lane-decision/self-heal files pass unchanged.
…erred-tools already on master) Resolving the merge conflict against master (6a641f3): - master 5d852d2 (ranxianglei#6958, PR#6938 review) already ships the deferred-tools observation — refined (exported extractDeferredBiliToolNames, mcp__bili__-only filter) — in src/server/lane-decisions.ts + tests/claude-deferred-tools.test.ts. - This PR's unique claudeCodeWithoutTool gate was DELIBERATELY excluded in ranxianglei#6958 (master test comment: it would starve the ranxianglei#4372 zombie probe on headerless rounds; 'that trade needs its own discussion'). - Taking master's version for both conflicting files makes this branch byte-identical to master (empty diff). The PR has no unique changes left.
The merge conflict is resolved. Key finding: this PR is fully superseded by #6938/#6958, which are already on master. What happened The two implementations differ, and master's is the reviewed one
The PR's unique gate was deliberately excluded in #6958
So the owner/reviewers already decided: merge the observation (master's refined version), leave out this PR's gate. That's a documented decision, not one for me to re-make. Resolution Recommendation 七问(中文结构化结论)
收工判定:冲突已解(PR 现 mergeable,但 diff 为空、 |
[ework] CI fix verified green ✓ |
2 similar comments
[ework] CI fix verified green ✓ |
[ework] CI fix verified green ✓ |
Fixes #6958
Problem
Claude Code keeps
mcp__bili__compressout oftools[]until the model loads it with ToolSearch, and lists it by name in a message instead. bili readstools[]only, so while the tool is deferred it tells the model to call barecompress, which fails withNo such tool available: compress. Claude Code agents whose allow-list holds no bili tool are still nudged, because the anonymous profile keeps the compress surface on.Fix (host side, no kernel change)
In
src/server/lane-decisions.ts:observeDeferredTools(parsed)reads the names after Claude Code's deferred-tools announcement in the messages.mcpCompressListedis true whenmcp__bili__compressis declared intools[]or listed as deferred.mcpDialectnow follows it, so the prompt namesmcp__bili__compresswhile the tool is deferred.cc_version=) with no compress tool declared or listed is not compress-reachable, so it gets no surface and no nudge. Other hosts keep today's behaviour.Both compression modes
The change reads only the request body. In plugin mode it decides the prompt's tool name and whether the surface is on. Proxy mode never sets
mcpDialectand is not a Claude Code plugin lane, so its path is unchanged.Tests
tests/claude-deferred-tools.test.ts(new) builds requests in the shape Claude Code 2.1.325 sends: deferred tool → MCP name; loaded tool → MCP name; no bili tool anywhere → surface off; a non-Claude-Code lane and a barecompressdeclaration → unchanged; an announcement in a string message body → read. On master 3 of 5 fail; with the fix 5 pass.tests/lane-decisions*.test.tsandtests/*mcp*.test.ts: 205 pass.tsc --noEmitis clean.compressand its call failed; with the fix it was toldmcp__bili__compressand its fold succeeded. A subagent limited toRead,Bashloggedsurface=off(top-level=[Read,Bash])and got no nudge.Review tier
This changes when the compress surface is on for one host's lane (a lane decision), so per §7.4 it stays with a human reviewer. No config, persistence-format, wire-shape or kernel change.
🤖 Generated with Claude Code