Skip to content

fix: add Xiaomi MiMo thinking mode reasoning_content echo-back#24810

Open
QQ-sys-ops wants to merge 2 commits into
NousResearch:mainfrom
QQ-sys-ops:fix/xiaomi-mimo-reasoning-content
Open

fix: add Xiaomi MiMo thinking mode reasoning_content echo-back#24810
QQ-sys-ops wants to merge 2 commits into
NousResearch:mainfrom
QQ-sys-ops:fix/xiaomi-mimo-reasoning-content

Conversation

@QQ-sys-ops

Copy link
Copy Markdown

Summary

Xiaomi MiMo thinking mode requires reasoning_content on every assistant tool-call turn. Without it, replaying the persisted message causes HTTP 400 (The reasoning_content in the thinking mode must be passed back to the API).

This is the same pattern already fixed for DeepSeek (#15250, #17341) and Kimi/Moonshot (#17400), but Xiaomi was missed.

Changes

- Add _needs_xiaomi_tool_reasoning() method to detect Xiaomi MiMo provider/model/base_url
- Update _needs_thinking_reasoning_pad() to include Xiaomi check

Test Plan

- [x] Patch applied successfully (lint passed)
- [x] Gateway restarted with fix
- [ ] Verify no more HTTP 400 errors in ~/.hermes/logs/errors.log

Refs

Refs: #15250, #17400, #17341

Xiaomi MiMo thinking mode requires reasoning_content on every assistant
tool-call turn. Without it, replaying the persisted message causes
HTTP 400 ("The reasoning_content in the thinking mode must be passed
back to the API").

This is the same pattern already fixed for DeepSeek (NousResearch#15250, NousResearch#17341)
and Kimi/Moonshot (NousResearch#17400), but Xiaomi was missed.

Refs: NousResearch#15250, NousResearch#17400, NousResearch#17341
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent loop, run_agent.py, prompt builder provider/xiaomi Xiaomi MiLM duplicate This issue or pull request already exists labels May 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #24465 — same Xiaomi MiMo reasoning_content echo-back fix. Multiple competing PRs exist (#24465, #24603, #24737, #24784).

…MiMo /anthropic endpoint

Xiaomi MiMo's /anthropic endpoint requires thinking blocks (synthesized
from reasoning_content) to round-trip on subsequent API requests. Without
them, the generic third-party path strips all thinking blocks, causing
HTTP 400: 'The reasoning_content in the thinking mode must be passed back
to the API.'

Add _is_xiaomi_anthropic_endpoint() detection and include it in the
_preserve_unsigned_thinking check alongside Kimi and DeepSeek.

Refs: xiaomimimo.com/anthropic endpoint, same pattern as NousResearch#13848 (Kimi)
and NousResearch#16748 (DeepSeek).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants