A gateway key held to some models (#882) could reach any other model
through Claude Code's advisor tool, which names a second model inside the
request:
- served advisor (advisor_serve.go, db9a5ec7c): advise() asked the advisor
model under magpieChose, which drops the key's models list because magpie
picked the model from its settings. Here the caller named it, so it is
now asked as the caller and the key's models and limits hold it; a
refused model comes back as an advisor_tool_result_error.
- native advisor (advisor.go, pre-existing): any same-provider Claude
model passed upstream as the advisor for a held key. advisorTools now
takes keyAllows(r, p) and leaves out an advisor whose model the key may
not use (by magpie's id, the bare Claude id, and with [1m]).
Run (on mote; load ~36, mica out of disk):
- go test ./internal/gateway -run 'Advisor|Advised|KeyModels|Key' ok
- broken by hand (magpieChose back, nil allowed): both new tests red
(advisor asked 1 time; advisor sent upstream for 3 of 3 refused cases)
- go vet darwin, GOOS=windows, linux nogui: ok; gofmt clean
Not run: the full suite.