fix(agent): scope DeepSeek and MiMo reasoning echo to host, not model name - #27886
EloquentBrush0x wants to merge 1 commit into
Conversation
… name `_needs_deepseek_tool_reasoning` matched on `"deepseek" in model` and `_needs_mimo_tool_reasoning` matched on `"mimo" in model`. Both checks fire for any re-exported model whose name contains the substring — including OpenRouter routes like `deepseek/deepseek-v3` — causing Hermes to inject `reasoning_content` into every assistant message. OpenRouter (and other aggregators) reject that field with HTTP 400 on replay. Fix mirrors commit 532b209 which applied the same correction to `_needs_kimi_tool_reasoning`: remove the model-name substring check and rely only on provider identity and base-URL host matching, both of which scope detection to requests that actually target the official API. Official DeepSeek (`provider == "deepseek"` or `api.deepseek.com` host) and official MiMo (`provider == "xiaomi"` or `xiaomimimo.com` host) continue to receive the echo; aggregator re-exports do not.
|
Thanks for the focused fix — the premise checks out on current main. Problems
Suggested changes
The patch itself is aligned with the existing Kimi host-driven behavior at |
Salvages the Xiaomi MiMo thinking/replay fixes from #27886/#25379/#26802/#27363 into one provider cluster, with MiMo reasoning replay enabled for native Xiaomi endpoints plus Nous/OpenRouter Xiaomi slugs. Co-authored-by: EloquentBrush0x <283442588+EloquentBrush0x@users.noreply.github.com> Co-authored-by: Peterson <pppan2003@gmail.com> Co-authored-by: Zhao Zhuoran <zhao.zr11@protonmail.com> Co-authored-by: zccyman <zccyman@users.noreply.github.com>
|
Thanks for the careful write-up and the kimi-parity reasoning — the analysis is solid and the fix is clean. But before changing provider behavior I re-verified the premise live against OpenRouter today, and the HTTP 400 is not reproducible. Current
I also tried every echo shape on The quoted error — "The reasoning_content in the thinking mode must be passed back to the API" — is DeepSeek's own native endpoint complaining that reasoning is missing, which is the opposite of an aggregator rejecting an extra field. So the substring firing on There's also a small regression risk in the change itself: dropping the substring would silently stop the echo for a legitimate custom-provider setup that points a Closing as cannot-reproduce. If you can share a request that actually 400s on a current aggregator route (full request body + the responding host), reopen and we'll dig in — the kimi precedent means we'd happily bring deepseek/mimo to parity once there's a reproduction. Appreciate the contribution. |
Salvages the Xiaomi MiMo thinking/replay fixes from NousResearch#27886/NousResearch#25379/NousResearch#26802/NousResearch#27363 into one provider cluster, with MiMo reasoning replay enabled for native Xiaomi endpoints plus Nous/OpenRouter Xiaomi slugs. Co-authored-by: EloquentBrush0x <283442588+EloquentBrush0x@users.noreply.github.com> Co-authored-by: Peterson <pppan2003@gmail.com> Co-authored-by: Zhao Zhuoran <zhao.zr11@protonmail.com> Co-authored-by: zccyman <zccyman@users.noreply.github.com>
Problem
_needs_deepseek_tool_reasoningtriggered on"deepseek" in modeland_needs_mimo_tool_reasoningtriggered on"mimo" in model. Both substring checks fire for any re-exported model whose name contains the substring — including OpenRouter routes likedeepseek/deepseek-v3orxiaomi/mimo-v2.5-pro.When triggered, Hermes injects
reasoning_contentinto every assistant message before sending it to the API. OpenRouter (and other aggregators) do not understand this field and reject the request:This breaks every tool-call turn for users running DeepSeek or MiMo models through OpenRouter or any other aggregator.
Root Cause
Fix
Remove the model-name substring checks. Provider identity and base-URL host matching already cover all official API paths:
Same fix applied to
_needs_mimo_tool_reasoning.Parity
Commit
532b209f0applied the identical correction to_needs_kimi_tool_reasoningwith the explicit note:DeepSeek and MiMo were left behind. This PR brings them to the same standard.
Tests
test_model_substringreplaced withtest_openrouter_deepseek_model_not_detected— asserts the bug case now returnsFalse36/36)Checklist
_needs_kimi_tool_reasoning(commit532b209f0)36/36)