Files
magpie/docs
yetone d54b7acf43 gateway: Claude Code's dashed advisor id goes upstream as the provider names it
Refeccd (Discord, v0.1.4366): Claude Code with Opus 5.5 as the model and
Fable 5.2 as the advisor, both on one provider; the advisor's turns came
from Opus and Routing showed no Fable request.

Claude Code 2.1.316 (real binary, sandbox HOME, a fake upstream) never
sends a request of its own for the advisor: it is the server tool
{"type":"advisor_20260301","model":"relay/claude-fable-5-2"} inside the
main request, with settings.json's advisorModel as written. magpie writes
a dotted Claude id dashed (ClaudeSpelled), and the gateway took the main
model back to the served id (validateModel) but not the advisor's. On a
provider listing claude-opus-5.5 and claude-fable-5.2 the request went
upstream as model claude-opus-5.5 with advisor claude-fable-5-2, a name
the relay doesn't know.

advisorID now takes the advisor's model to the served id as a request's
own model is (ClaudeUndashed, then unflat and CanonicalRef), and drops
[2m] beside [1m]. Every reader of it goes through it: advisorModel
(passthrough name), advisorKeyModel (key limits), advisorAsked
(advisedHere, advisedInBridge) and readAnthropic's Request.Advisor
(magpie-run advice).

Run (on mica):
- go test -count=1 -timeout 45m ./internal/gateway/: ok at 38babcb13
  (this change on efcf8d9c0), and before at d67ccbd3c and 8e1534f5f
- rebased since onto a922e3864, which adds only internal/library,
  internal/agent/dsh.go and internal/provider/agy_move.go: at this head,
  go test -run Advis ./internal/gateway/ ok, and GOOS=linux and
  GOOS=windows go vet ./internal/gateway/ ./internal/provider/ ok
- gofmt -l internal/gateway: clean
- GOOS=linux and GOOS=windows go vet ./internal/gateway/: ok

Broken by hand: advisorID returning the trimmed id as before makes
TestAdvisorModelAsTheUpstreamNamesIt's new "a dotted id as Claude Code
names it" case red: advisor sent as ["claude-fable-5-2"], want
"claude-fable-5.2", the reporter's shape.

Not tried: the reporter's own relay. magpie still doesn't read
usage.iterations' advisor_message entries, so a passthrough advisor run
at the vendor shows no Fable row in Routing; that is by design of the
server tool, not changed here (#6977).
2026-11-17 21:48:13 +08:00
..