Skip to content

deepseek-v4-pro hits 400 "reasoning_content must be passed back" — not recognised as thinking-with-tools #6097

Description

@DaBlitzStein

Summary

deepseek-v4-pro agents fail every multi-turn tool-call conversation with:

400 {"error":{"message":"The reasoning_content in the thinking mode must be passed back to the API.","type":"invalid_request_error"}}

Root cause

is_deepseek_v4_thinking_with_tools (crates/librefang-llm-drivers/src/drivers/openai.rs) only matches deepseek-v4-flash. deepseek-v4-pro was deliberately excluded with the comment "V4 Pro is reported as working out-of-the-box (#4842 workaround section) — must not be lumped in with V4 Flash" and an explicit assert!(!...) test.

Production proves that assumption wrong (or DeepSeek changed the contract): deepseek-v4-pro has the same echo requirement as V4 Flash — once a tool-call thinking turn is in the history, the next request must echo its reasoning_content, or DeepSeek returns 400. Because V4 Pro isn't matched, it never gets ReasoningEchoPolicy::Echo, so the content is dropped and every subsequent turn 400s.

Impact

A delegated agent running deepseek-v4-pro dies on its first tool-call follow-up turn: agent_send (blocking and async) and shared-queue tasks to it never complete. A sibling agent on the same model only avoided it by keeping a long enough history window that it never trimmed off the thinking turn.

Fix

Match deepseek-v4-pro in is_deepseek_v4_thinking_with_tools (alongside Flash) so the Echo policy applies. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    has-prA pull request has been linked to this issueneeds-triageAuto-applied when the issue title/body matched no area label — needs maintainer review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions