jue (Codex app, GPT-6.1 Sol) set a DeepSeek model for Codex on the
Agents page, went back to GPT, and the next turn sometimes failed with
"[ArrayParam] [input[8].content] [array_above_max_length] Invalid
'input[8].content': array too long. Expected an array with maximum
length 0, but got an array with length 1 instead."
Cause: when the model changes (or the thread passes its auto-compact
limit) Codex compacts the thread before the turn, and shows a failed
compaction as the turn's error. Codex's /responses/compact for one of
its own models went to the ChatGPT backend (Codex's sign-in, its sk-
key, or a magpie Codex account through compactOn) with its input as
sent. A reasoning item from DeepSeek's Responses API carries its
reasoning_text in content, which OpenAI accepts only empty, so the
whole compaction was refused. A turn on the same routes already went
through codexInput(body, false), which drops such items; the
compaction didn't. "Sometimes" is when Codex compacts first.
Fix: codexBackend's own-model branch runs codexInput(body, false) on
/responses/compact too, before any of the three routes. OpenAI's own
sealed reasoning (encrypted_content, no text) stays; a summary magpie
made goes as its text, as from a turn. DeepSeek still gets its
reasoning text (withReasoningText). Siblings read: the translated
Responses path sends back only sealed reasoning (sealedReasoning);
passthrough strips reasoning text for openai.com, Azure and Codex
accounts and retries on the refusal elsewhere (#1411). Not covered: a
full restore that drops openai_base_url leaves magpie off Codex's path.
Codex's base_instructions and prompts are untouched.
Test: TestForeignReasoningNeverReachesOpenAI sends the reported thread
(input[8] a DeepSeek reasoning item with one reasoning_text, input[3]
OpenAI's sealed reasoning) on seven routes: turn and compaction on
Codex's sign-in, its API key and a magpie account, and /v1/responses
with codex/gpt-6.1-sol. The fake OpenAI refuses a reasoning item with
text with the reported 400 byte for byte. On the old code the three
compaction routes are red with that 400 and the four turns green;
with the fix all seven are green. Broken by hand a second way
(codexInput(body, true) on the compact branch): the same three red.
Run at 592899467 + this change, GOMODCACHE=/Users/yetone/go/pkg/mod,
sandbox HOME and GOCACHE in the worktree:
- gofmt -l on the changed Go files: empty.
- go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...: all clean.
- set -o pipefail; go test -timeout 45m ./...: exit 1 at load from
other sessions' suites. 61 packages ok. internal/agent, gateway and
library hit the 45m timeout (#2869's kind).
TestSetAnswersWhileDevinAndProvidersHang (internal/gui, 10.6s set,
#1375) and TestTaggedReposSlowRead (internal/plugin, #1889) failed
their timing bars.
- Rerun alone, go test -timeout 45m -p 2 ./internal/gateway
./internal/agent ./internal/library ./internal/gui ./internal/plugin:
all five ok (gateway 1011s, agent 1235s, library 632s, gui 184s,
plugin 452s).
- Rebased on c922225f1 (5 commits, gateway.go among them): go vet
./internal/gateway for darwin, linux -tags nogui and windows clean;
go test -timeout 45m ./internal/gateway ok (1253s).