pi-ai, DeepSeek Harness's client, sends thinking {type, budget_tokens,
display: "summarized"} for every model it lets reason (and adaptive with
display for some). magpie passed display through to non-Claude models on
an Anthropic route, and Alibaba Cloud's Anthropic endpoint (Bailian and
its Coding Plan) answered a Qwen request with 400. The reporter saw it
around compaction, which dsh can move to another model.
withoutForeignDisplay drops thinking.display when the body's model is
not a Claude (claudeVersionOf, or "claude" in the name). It runs in
forwardOnce's Anthropic block after adaptiveThinking, so Anthropic's API,
the Claude subscription and relays serving Claude models keep display
"summarized" (#1485). The provider's own fields go on afterwards, so a
display the user forces there ("!thinking") is still sent.
Run (mote, at this commit on 28236ad2d):
- TestDisplayGoesToClaudeOnly: red on the old code (the call taken out):
Qwen, GLM and Kimi each got the fake vendor's 400. Green with the fix;
the Claude cases (sonnet-4-5 enabled, opus-4-7 adaptive, Responses
summary auto to opus-5-5) keep display "summarized".
- gofmt -l: clean. go vet ./internal/gateway on darwin, linux, windows: ok.
- go test -timeout 45m ./...: every package ok (101), EXIT=0
(gateway 964s, agent 359s, provider 230s).
Not tried: a real Alibaba Cloud account; Aliyun's real error wording is
unknown, so the fake's 400 text is a stand-in and refuseShapes was not
taught it. The reporter's dsh and magpie versions are unknown. A relay
serving Claude under a name with no "claude" and no Claude line match
loses display; it can force it back in the provider's own fields.