fix(llm-drivers): treat deepseek-v4-pro as thinking-with-tools so reasoning_content is echoed#6098
Conversation
…soning_content is echoed deepseek-v4-pro returns 400 "The reasoning_content in the thinking mode must be passed back to the API." on multi-turn tool-call conversations — the same echo requirement as V4 Flash — but it was excluded from is_deepseek_v4_thinking_with_tools on the librefang#4842 "works out-of-the-box" assumption. Production proved that wrong: a delegated agent on deepseek-v4-pro failed every turn once its history held a tool-call thinking turn. Match V4 Pro too so the Echo reasoning-echo policy applies and the thinking text round-trips intact.
|
Moving to draft — honesty note on the evidence. This change is a defensible contract-alignment ( But I can't currently confirm it fixes a problem that manifests in normal use. The incident that prompted it was an agent on Holding as draft until I can confirm whether |
|
Confirmed live — promoting out of draft. Deployed this fix to a host running a So |
|
Reviewed — the change is correct, minimal, and well-tested. Two non-blocking notes. 1. Fix targets the fallback, not the catalog — confirm the policy actually reaches the wire. 2. Breadth check — no parallel site needs the same change. Nit: the CHANGELOG bullet carries only |
houko
left a comment
There was a problem hiding this comment.
Approved. Correct, minimal, well-tested fix; the two notes on my earlier comment are non-blocking.
Summary
Fixes #6097.
deepseek-v4-proagents 400 on every multi-turn tool-call conversation with "The reasoning_content in the thinking mode must be passed back to the API."is_deepseek_v4_thinking_with_toolsonly matcheddeepseek-v4-flash; V4 Pro was excluded on the #4842 assumption that it "works out-of-the-box". Production disproves that — V4 Pro has the same echo requirement, so withoutReasoningEchoPolicy::Echoitsreasoning_contentis dropped and DeepSeek rejects the next request. A delegated agent ondeepseek-v4-protherefore died on its first tool-call follow-up turn (soagent_send/ shared-queue tasks to it never executed).Change
is_deepseek_v4_thinking_with_toolsnow matchesdeepseek-v4-proas well asdeepseek-v4-flash(substring match keeps date-stamped variants working).deepseek-v4-profrom thedoes_not_match_otherstest to thematchestest (plusDeepSeek-V4-Proand a date-stamped variant).Verification
cargo test -p librefang-llm-drivers --lib is_deepseek_v4→ 2 passed, 0 failed.