issennknight on Discord (#general): an agent asked for deepseek-v4.1-flash,
which goes out as deepseek-v4.1-flash-1017 (settings' ModelIDs). The vendor's
reply said -1017, magpie passed it back, and the agent warned that the model
didn't match.
Before, only MemberModel (#822) or X-Magpie-Response-Model: member rewrote a
reply's model, and only to the group member's id. Now the default is
nameAsked. When magpie sent the request under another name than the agent
asked for (a model's own id, a routing group, a provider/model id), the
reply names the asked model. That covers Chat and Anthropic `model`,
Responses `response.model` (created, in_progress, completed), Anthropic
`message.model` (message_start) and Gemini `modelVersion`, streamed and
whole, translated paths and plugins included: it all goes through serve's
one memberWriter. A vendor that sent back the wire name as asked keeps its
own name, a dated -20261017 too. Usage rows, recent calls and the Routing
page still record served = the vendor's name: the writer sits outside
captureResponseWriter. Claude Code, Claude Desktop and Codex get the asked
name (or the vendor's), never the member's id, as before.
Streams are rewritten one complete line at a time (memberLines). A run
with no "model" in it is written through as the same slice. Only a JSON
reply that has a target at decide time is held whole, which is what
MemberModel already did.
A JSON body that doesn't parse (a reply cut short) goes on as it came.
A request to a remote magpie now sends X-Magpie-Response-Model: vendor
(passOnCaller). That magpie names the vendor's model, as before, so this
one still records what served the call (TestRemoteMagpieGroupNotSwapped
went red without it).
Existing tests that held a native reply byte for byte now expect only
its model renamed to the asked id (namedAs in member_test.go):
passthrough_severed, stream_accounting, refusal, refusal_thinking,
thinking_signature and vertex. The archive keeps the reply as the
vendor sent it, under the vendor's name (archive_test).
Also dropped: the openai-model header code. serve never relays that header,
so the test for it could not pass.
Run (mote, at this head rebased on origin/main 15066f84f):
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok
except internal/gui: TestSettingsSaveKeepsWhatItDoesNotSend (#4514,
SearchAll from b09349d17) and TestColdTurnsTaken (#4510). Both are filed,
and neither touches this change. Three other sessions' suites ran on
mote at the same time.
The first full run (base 80bcef18f) had internal/gateway red in 10
tests: the byte-for-byte tests above, the remote-magpie served test and
the truncated JSON body. Each one was fixed as described.
- Rebased on 544b91ca8 (no gateway files changed in between): go build ./...,
go vet, then go test ./internal/gateway ./internal/settings
./internal/provider: all ok.
- go vet -tags nogui ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: clean (cgo warnings only); gofmt -l clean.
- go test -race -count=3 on the member and served tests: ok (122s).
- the 10 formerly red tests with TestReplyNames, TestGeminiReplyNames,
TestMemberLine, TestMemberWriter and Masked, after the rebase: ok.
Red on the old code (the new tests over a git archive of the base):
- TestReplyNamesAskedModel: 36 subtests fail (own id, group and provider
id, x 6 protocol paths, x streamed or not), e.g. `the reply names
"deepseek-v4.1-flash-1017", want "deepseek-v4.1-flash"`.
- TestGeminiReplyNamesAskedModel: both subtests fail (modelVersion -1017).
Broken by hand: dropping `|| m.wire == m.asked` from target() fails
"as asked, dated" in 12 subtests.
Real use: Codex 0.165.0 (codex exec --json) under a sandbox HOME and
CODEX_HOME on mote. A fake Responses vendor always answered
deepseek-v4.1-flash-1017, and a tee between Codex and `magpie serve` logged
what Codex got. providers.json had d with deepseek-v4.1-flash and group
fast; settings.json had modelIDs d/deepseek-v4.1-flash ->
deepseek-v4.1-flash-1017.
- old build: the vendor was asked for -1017; Codex got "model":
"deepseek-v4.1-flash-1017" in response.created, in_progress and completed,
both for -m deepseek-v4.1-flash and for -m group/fast.
- new build: the vendor was still asked for -1017; Codex got
"deepseek-v4.1-flash" and "group/fast"; the usage rows still say served
deepseek-v4.1-flash-1017. Codex answered "pong" both times. Codex 0.165
itself shows no warning for a body model either way (its "model
rerouted" reads the openai-model header), so the agent behind the
report's warning was not the one run.
Not tried: the reporter's own agent (not named) and Claude Code; the
Responses WebSocket path (responses_ws.go's own frames); a compressed
reply, which still goes through as it is; Antigravity's effort-variant
wire, where the wire differs from the asked name on purpose.