Skip to content

fix(agent): add MiMo to reasoning_content echo-back providers in _needs_thinking_reasoning_pad#24638

Closed
wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:fix/cx14-issue-24443-mimo-reasoning-content
Closed

fix(agent): add MiMo to reasoning_content echo-back providers in _needs_thinking_reasoning_pad#24638
wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:fix/cx14-issue-24443-mimo-reasoning-content

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

Problem

Multi-turn MiMo (Xiaomi) reasoning-model conversations fail with HTTP 400:

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

Hermes already handles this requirement for DeepSeek and Kimi, but MiMo (api.xiaomimimo.com, model names containing mimo) was absent from the predicate, so _copy_reasoning_content_for_api never injected the required reasoning_content placeholder on replayed assistant turns.

Root cause

_needs_thinking_reasoning_pad() at line ~10101 only ORs DeepSeek and Kimi:

def _needs_thinking_reasoning_pad(self) -> bool:
    return (
        self._needs_deepseek_tool_reasoning()
        or self._needs_kimi_tool_reasoning()
    )

MiMo was never included.

Fix

Add _needs_mimo_tool_reasoning() and include it in the combined predicate.

flowchart TD
    A[_needs_thinking_reasoning_pad] --> B[_needs_deepseek_tool_reasoning]
    A --> C[_needs_kimi_tool_reasoning]
    A --> D[_needs_mimo_tool_reasoning]
    D --> E{base_url matches xiaomimimo.com?}
    E -- yes --> TRUE[return True]
    D --> F{"'mimo' in model.lower()?"}
    F -- yes --> TRUE
    E -- no --> F
    F -- no --> FALSE[return False]
Loading

Detection mirrors the DeepSeek/Kimi pattern: match on base URL hostname OR model name substring, covering both direct API access and custom-provider setups.

Tests

New tests/run_agent/test_mimo_reasoning_content_echo.py — 8 cases:

  • Base URL api.xiaomimimo.com detected
  • mimo-7b-thinking model name detected
  • MiMo-VL-7B-RL (mixed-case) detected
  • Unrelated provider not detected
  • DeepSeek not detected as MiMo
  • MiMo URL triggers _needs_thinking_reasoning_pad
  • MiMo model name triggers _needs_thinking_reasoning_pad
  • Unrelated provider skips pad

All 8 pass.

Closes #24443

…ds_thinking_reasoning_pad

MiMo (Xiaomi, api.xiaomimimo.com) requires reasoning_content to be echoed
back on every assistant tool-call turn, the same contract as DeepSeek and
Kimi. Without it the API rejects subsequent requests with HTTP 400:

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

Add _needs_mimo_tool_reasoning() and include it in the combined predicate.
Detection: base_url matches xiaomimimo.com OR 'mimo' in model name (covers
MiMo-VL-7B-RL and similar variants).

Closes NousResearch#24443
Copilot AI review requested due to automatic review settings May 12, 2026 23:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists 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 — earliest open fix for MiMo reasoning_content echo-back (#24443). Competes with #24605 and #24603.

@wesleysimplicio

Copy link
Copy Markdown
Contributor Author

Closing as duplicate/superseded by #24662 to keep one canonical PR per fix topic and avoid review split.

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 P2 Medium — degraded but workaround exists provider/xiaomi Xiaomi MiLM type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MiMo reasoning models may fail in Hermes because reasoning_content is not preserved in chat history

3 participants