A group turn served on DeepSeek hands Codex a reasoning item with both
content (reasoning_text) and encrypted_content. Codex sends it back on
every later turn, and the /backend-api/codex handler keeps reasoning for a
group (codexInput(body, true)). Routed next to a Codex account or a relay
in front of OpenAI, the request was turned away with 400 "Invalid
'input[n].content': array too long. Expected an array with maximum length
0 ...", which neither the foreign-seal retry nor #1044's bare-reasoning
retry matched, so every later turn failed the same way.
In passthrough, for an upstream that isn't sent reasoning text back
(not replaysReasoning, so DeepSeek still gets it):
- a Codex account, openai.com or Azure is never sent a reasoning item with
content parts (withoutReasoningText), as codexInput already leaves it out
for Codex's own models; its seal is the other vendor's, so the item goes;
- any other upstream that answers 400 naming input[n].content "array too
long", where item n is reasoning with content, is asked once more without
such items, and the provider's model is marked unfit for them
(reasoningTextRefused), so later turns go without them the first time,
as #1044 does for bare reasoning.
The destination's own sealed reasoning, messages and tool calls stay.
Verified:
- TestReasoningTextLeftOutWhereRefused (group to a strict relay, the
issue's literal item) and TestReasoningTextNotSentToCodexAccount (group
to a Codex account) fail without the change with 400 "AgentRouter:/Codex:
Invalid 'input[1].content': array too long ..."; the relay is asked twice
then once, the account once. TestReasoningTextKeptWhereTaken keeps the
item for an upstream that takes it.
- Real ChatGPT backend (the owner's Pro account, gpt-5.5, store false): the
issue's item answers 400 "Invalid 'input[1].content': array too long.
Expected an array with maximum length 0, but got an array with length 1
instead." param input[1].content, code array_above_max_length; the test
fixture uses those bytes. The same request without the item completes.
Not tried against AgentRouter itself.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway, go test -tags nogui -count=1 ./internal/gateway
under a temp HOME: all pass.