Skip to content

fix: add Xiaomi MiMo to reasoning_content echo-back check#25101

Closed
kennethlaw325 wants to merge 1 commit into
NousResearch:mainfrom
kennethlaw325:fix/xiaomi-mimo-reasoning-content
Closed

fix: add Xiaomi MiMo to reasoning_content echo-back check#25101
kennethlaw325 wants to merge 1 commit into
NousResearch:mainfrom
kennethlaw325:fix/xiaomi-mimo-reasoning-content

Conversation

@kennethlaw325

Copy link
Copy Markdown

Summary

Xiaomi MiMo thinking mode requires reasoning_content on every assistant message when replaying conversation history. Without it, the API returns HTTP 400:

"The reasoning_content in the thinking mode must be passed back to the API."

This is the same requirement as DeepSeek V4 thinking (#15250) and Kimi/Moonshot thinking (#17400), but Xiaomi MiMo was not included in the _needs_thinking_reasoning_pad() check.

Changes

  • Add _needs_xiaomi_tool_reasoning() method that checks for provider == "xiaomi" or xiaomimimo.com base URL
  • Include Xiaomi in _needs_thinking_reasoning_pad() alongside DeepSeek and Kimi

Test Plan

  • Verified fix resolves HTTP 400 on Xiaomi MiMo gateway with conversation history containing reasoning_content
  • Gateway successfully processes messages after restart with patched code

Reproduction

  1. Use Xiaomi MiMo (mimo-v2.5-pro) as the provider
  2. Have a conversation where the model returns reasoning_content (thinking mode)
  3. On the next turn, the API call fails with HTTP 400 because reasoning_content is stripped during message serialization

Xiaomi MiMo thinking mode requires reasoning_content on every
assistant message when replaying conversation history. Without it,
the API returns HTTP 400: 'The reasoning_content in the thinking
mode must be passed back to the API.'

Add _needs_xiaomi_tool_reasoning() method and include it in
_needs_thinking_reasoning_pad() alongside DeepSeek and Kimi checks.

Refs: NousResearch#15250, NousResearch#17400
@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 labels May 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #24465 (earliest open PR for Xiaomi MiMo reasoning_content echo-back). At least 8 competing PRs exist: #24465, #24603, #24737, #24784, #24810, #25062.

@teknium1

Copy link
Copy Markdown
Contributor

This appears to be implemented on current main, so I’m closing this as covered by the merged Xiaomi MiMo reasoning_content echo-back fix.

Evidence from this automated hermes-sweeper review:

  • run_agent.py:4809 now has _needs_thinking_reasoning_pad() covering DeepSeek, Kimi/Moonshot, and Xiaomi MiMo.
  • run_agent.py:4828 calls self._needs_mimo_tool_reasoning() as part of that provider check.
  • run_agent.py:4871 implements MiMo detection for provider == "xiaomi", models containing mimo, and api.xiaomimimo.com / xiaomimimo.com base URLs.
  • agent/agent_runtime_helpers.py:2136 pads missing assistant reasoning_content when the active provider requires echo-back, which addresses the HTTP 400 described here.
  • The implementation is present in commit efa97af7e25f0cbef92ed15bbcb47e4788c83058 (fix(agent): add Xiaomi MiMo to reasoning_content echo-back providers), contained in v2026.5.16.

Thanks for the report and patch; the maintainer note about the duplicate Xiaomi MiMo PRs was also taken into account.

@teknium1 teknium1 closed this Jun 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 12, 2026
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 P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants