What the reporter saw: a Codex mixed group (ChatGPT first, DeepSeek after)
answered 400 "The `reasoning_text` in the thinking mode must be passed back
to the API." once the turn fell to DeepSeek.
Cause, checked against the real api.deepseek.com/v1/responses on 2026-10-11
with the owner's key: DeepSeek refuses a history where
- a reasoning item is sealed only (ChatGPT's encrypted_content, no summary),
- a function_call/custom_tool_call has no reasoning item in its step (an
assistant turn ChatGPT answered without one, or a second step), or
- a reasoning item's reasoning_text is empty.
It accepts reasoning_text " " (with or without encrypted_content and id).
withReasoningText only filled the third case.
Change:
- withReasoningText (passthrough) walks the input by step: a reasoning item
with no text gets its summary, else noReasoning (" "), keeping its other
fields (encrypted_content, id); a tool call with no reasoning item since
the last output or user message gets one with noReasoning before it.
- buildResponses (translated, e.g. an Anthropic agent onto DeepSeek's
Responses) does the same for a tool call with no thinking before it.
- Only where replaysReasoning says so (DeepSeek); gpt-5.4 on a relay gets
no reasoning_text.
- gateway-routing.md describes the Responses replay.
Run:
- The reporter's 400 reproduced on the real API, directly and through the
old binary (direct model and group/codex-different); the new binary
answers 200 completed for each case, whole and streamed.
- New TestDeepSeekGroupMemberAfterChatGPT (8 subcases) and
TestTranslatedDeepSeekCallWithoutReasoning fail on the old code, and
TestDeepSeekReasoningPassedThrough's empty item; all pass now. The fake
now refuses what the real API refuses.
- go test ./internal/gateway, gofmt, GOOS=linux/windows go vet -tags nogui.
Not done: DeepSeek's Anthropic endpoint has the same rule (a tool_use with
no thinking is refused, checked live); not changed here. Kimi and GLM
thinking were not checked: no key, and magpie has no replay rule for them.