JackChou: "claude code 使用 advisor 返回找不到对应工具". Claude Code 2.1.300
(its request read from a fake ANTHROPIC_BASE_URL in a sandbox HOME, with
--advisor and a fake key) declares the advisor as the server tool
{"type":"advisor_20260301","name":"advisor","model":…,"defer_loading":true}
and also puts it in the conversation: a {role:"system"} message whose text
ends in "# Advisor Tool … call advisor BEFORE substantive work", and a
{"type":"tool_addition","tool":{"type":"tool_reference","name":"advisor"}}
block.
79f64f028 left the server tool out where the upstream can't run it (a
vendor's model, another provider's advisor) and every translation drops
server tools, but both left the instructions and the tool_addition in place.
The model was told to call advisor() and given no such tool, so it called it
as one of the agent's tools and Claude Code answered "No such tool
available: advisor"; on Messages the tool_addition also named a tool the
request no longer declared.
Where magpie leaves the advisor out, withoutAdvisor (passthrough) drops the
tool_addition/tool_removal/tool_reference naming it, and a message left
empty, and replaces the instructions (up to the end of their reminder or
text) with Claude Code's own "The advisor tool is no longer available;
disregard the earlier advisor instructions." parseAnthropic does the same to
the text on a translation. An advisor that is kept goes as before.
Run: TestAdvisorModelAsTheUpstreamNamesIt (now on the literal 2.1.300 turn
in testdata/claude-code-advisor-turn.json, environment text cut short) and
the new TestAdvisorLeftOutOnTranslation (chat, responses, gemini). Broken by
hand (withoutAdvisor given no names, parseAnthropic not rewriting): both
red, the two left-out passthrough cases and all three translations; green
restored. go test -tags nogui -p 1 -run
'Advisor|Deferred|BillingLine|Shape|Anthropic|ToolSearch|TurnSystem|Passthrough'
./internal/gateway ok. gofmt -l clean; go vet -tags nogui ./internal/gateway
for GOOS darwin, linux, windows.
Not tried: a running magpie with real Claude Code end to end, and a real
vendor upstream; the reporter's provider and model aren't known, so whether
theirs was the passthrough or a translated route is inferred.
Full suite: SUITE_LINE
2 lines
2.6 KiB
JSON
2 lines
2.6 KiB
JSON
{"model":"MODEL","max_tokens":64,"stream":true,"messages":[{"role":"user","content":[{"type":"text","text":"hi"}]},{"role":"system","content":[{"type":"text","text":"# Environment\nYou have been invoked in the following environment: \n - Platform: darwin\n\nToday's date is 2026-10-15.\n\n# Advisor Tool\n\nYou have access to an `advisor` tool backed by a stronger reviewer model. It takes NO parameters -- when you call advisor(), your entire conversation history is automatically forwarded. They see the task, every tool call you've made, every result you've seen.\n\nCall advisor BEFORE substantive work -- before writing, before committing to an interpretation, before building on an assumption. If the task requires orientation first (finding files, fetching a source, seeing what's there), do that, then call advisor. Orientation is not substantive work. Writing, editing, and declaring an answer are.\n\nAlso call advisor:\n- When you believe the task is complete. BEFORE this call, make your deliverable durable: write the file, save the result, commit the change. The advisor call takes time; if the session ends during it, a durable result persists and an unwritten one doesn't.\n- When stuck -- errors recurring, approach not converging, results that don't fit.\n- When considering a change of approach.\n\nOn tasks longer than a few steps, call advisor at least once before committing to an approach and once before declaring done. On short reactive tasks where the next action is dictated by tool output you just read, you don't need to keep calling -- the advisor adds most of its value on the first call, before the approach crystallizes.\n\nGive the advice serious weight. If you follow a step and it fails empirically, or you have primary-source evidence that contradicts a specific claim (the file says X, the paper states Y), adapt. A passing self-test is not evidence the advice is wrong -- it's evidence your test doesn't check what the advice is checking.\n\nIf you've already retrieved data pointing one way and the advisor points another: don't silently switch. Surface the conflict in one more advisor call -- \"I found X, you suggest Y, which constraint breaks the tie?\" The advisor saw your evidence but may have underweighted it; a reconcile call is cheaper than committing to the wrong branch."},{"type":"tool_addition","tool":{"type":"tool_reference","name":"advisor"},"cache_control":{"type":"ephemeral"}}],"output_config":{"effort":"medium"}}],"tools":[{"name":"Read","description":"read a file","input_schema":{"type":"object","properties":{"path":{"type":"string"}}}},{"type":"advisor_20260301","name":"advisor","model":"ADVISOR","defer_loading":true}]}
|