Codex Desktop automation + DeepSeek Responses: intermittent 400 'reasoning_text must be passed back' on tool-call continuations
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Description
Codex Desktop automations (heartbeat/cron) with a DeepSeek Responses provider intermittently fail mid-turn with:
The `reasoning_text` in the thinking mode must be passed back to the API.
{"type": "invalid_request_error"}
Failure happens during tool-call continuations inside an automation run (e.g. an automation that executes a script then reports back). The same conversation works most of the time; the 400 appears intermittently on a later continuation request. Interactive turns in the same session succeed — only automation turns hit it.
Environment
- macOS 27.0, Apple Silicon
- Codex Desktop
26.825.51511, bundled app-server0.151.0-alpha.7.2 model_provider = "deepseek",base_url = "https://api.deepseek.com",wire_api = "responses",model = "deepseek-v4-flash"
Evidence
Captured at the proxy (request body before forwarding). Reasoning items sent by Codex look like:
{
"type": "reasoning",
"content": [{"type": "text", "text": "..."}],
"encrypted_content": "...(38 bytes)",
"summary": []
}
summaryis empty; the plaintext thinking lives incontent[0].text.encrypted_contentis present but tiny (38 bytes, not the real content).- On the failing continuation, a reasoning item arrives without usable plaintext (
contentempty/missing), and DeepSeek's stateless Responses endpoint rejects withreasoning_text must be passed back.
DeepSeek's thinking-mode contract requires the prior reasoning to be replayed in plaintext; it does not accept OpenAI-style encrypted reasoning blobs.
Expected behavior
- Codex should replay the prior reasoning in a form DeepSeek accepts (plaintext in every reasoning item it sends), including on automation tool-call continuations.
- Related: #24500 covers the same DeepSeek contract on the chat-completions path (
reasoning_content); this is the Responses/app-server variant (reasoning_text).
Workaround verified locally
A localhost proxy that scans request input for reasoning items lacking plaintext content[0].text and injects a placeholder text part ("(thinking unavailable)") makes the automation run complete without this 400. This confirms the failure is a missing-plaintext-reasoning serialization issue in Codex, not the scheduler or provider auth.
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 by tracing the Responses/app-server serialization path for reasoning items during automation tool-call continuations, using the provided DeepSeek configuration and automation reproduction. Inspect the outgoing request input for missing plaintext reasoning content; done means every continuation sends DeepSeek-acceptable plaintext reasoning and the intermittent 400 no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100