codex_app__automation_update parameters schema rejected by Kimi/Moonshot (HTTP 400, $ref sibling of type) — same failure class as #39848
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
Codex Desktop fails on every request before the model responds when using Kimi For Coding (k3) as the provider through CC Switch local routing. Moonshot's strict JSON Schema validator rejects the bundled codex_app__automation_update tool schema with HTTP 400.
Environment
- Product: Codex Desktop (bundled inside ChatGPT.app), macOS
- Codex app build:
26.820.60940; Codex CLI:0.131.0 - Provider: Kimi For Coding,
https://api.kimi.com/coding/v1, modelk3 - Path: Codex → CC Switch local proxy (
127.0.0.1:15721, Responses → Chat Completions) → Moonshot
Error
CC Switch local proxy failed while handling Codex endpoint /responses.
Provider: Kimi For Coding; model: k3; upstream_status: HTTP 400;
cause: tools.function.parameters is not a valid moonshot flavored json schema,
details: <At path '$defs.__schema20': when using $ref, type should be defined in the referenced schema instead of the parent schema>
Root cause
The codex_app__automation_update tool (from the codex_app MCP namespace, always eager-loaded) is emitted with a parameters schema that violates Moonshot's validator in two ways:
- top-level
$defs+oneOfwith notype: "object", and $refused as a sibling oftype— the validator requirestypeto be defined inside the referenced schema, not at the referencing node (the error points at$defs.__schema20).
This is the same failure class already tracked in #30132 (Azure), #36441 (DeepSeek via CC Switch), #37786 (DeepSeek), #39848 — now reproduced on Moonshot/Kimi. OpenAI's own Responses backend tolerates the schema, so official models are unaffected; only strict OpenAI-compatible providers break.
Local workaround (validated)
Because the tool is always eager-loaded and cannot be disabled from settings, I run a small local normalization proxy between Codex and CC Switch that rewrites the tools schema before forwarding:
- injects top-level
type: "object"when missing, - moves
typeout of$refsiblings into the referenced schema (following the chain), - rewrites relative
$refs to#/$defs/.
After normalization Moonshot accepts the request (HTTP 200). Same approach as cc-switch#5447 and the suggested fix in #37786.
Request
Please normalize the emitted automation_update schema — top-level type: "object" and no $ref/type siblings — so strict OpenAI-compatible providers (Moonshot/Kimi, DeepSeek, Azure) stop rejecting every request. This is now the 5th report of this failure class; a fix would unblock all of them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the emitted codex_app__automation_update schema and the Codex /responses path described in the report, then trace where MCP tool schemas are normalized before provider requests. Verify the result against strict OpenAI-compatible providers or the reported Moonshot case; done means a top-level object type is present and no $ref has a sibling type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100