The follow-up to 8ecab590, after the reporter merged it: the first Codex
turn through an xAI key went through and every one after it 400ed "Could
not decode the compaction blob. Ensure it is unmodified from the compact
response." — Codex hands the sealed reasoning item back with "content":
null beside its encrypted_content, which xAI's backend can't read. The
Grok subscription's plugin already drops that null (grokShaped), but the
xai preset shapes nothing, and the custom-tool refusal had only now let
a second turn reach the API. And every Claude call 400ed "Invalid request
content: Invalid message role.": Claude Code sends a system turn
mid-conversation (Anthropic made them GA), a role xAI's Messages takes
only as the top-level system.
xaiBody (api.x.ai, shaped in passthrough and on the built body in
forwardTranslated alike — a custom-tool refusal puts a Codex request on
the translated path from the next turn on) drops a reasoning item's null
content and folds each system turn into the top-level system, its text
and blocks as they came. Nothing is learned: xAI takes neither at all.
TestXAITakesCodexsSealedReasoningBack, TestXAILearnsCustomToolsThenTakesTheReplay
and TestXAIFoldsClaudesSystemTurn replay the reporter's session on a fake
api.x.ai and are red with the shaping off; the wording comes from the
report. gofmt clean, go vet and the builds (native, linux nogui, windows)
clean; go test -tags nogui ./... in a sandbox HOME: 66 packages ok, the
same 7 test failures as the clean branch head baselined the same session
(TestWriteAtomicReadOnlyHardLink, TestClaudeClientCacheAbsentUnchanged,
TestCodexFittedImagesPastTheBudget, TestMarshalRawIsEncodingJSON,
FuzzMarshalRaw, TestPluginSOCKSProxy, TestProgram). Not tried against the
real xAI API: no key here.
From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25.