Skip to content

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

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

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

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

Problem

Multi-turn conversations with Xiaomi MiMo thinking models fail with HTTP 400:

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

Hermes does not echo reasoning_content back on subsequent assistant turns for MiMo, even though the same requirement is already handled for DeepSeek and Kimi.

Root cause

_needs_thinking_reasoning_pad() at run_agent.py:10095 only covered two providers:

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

MiMo (xiaomimimo.com, model names containing mimo) has the identical contract but was absent from this check, so _copy_reasoning_content_for_api never injected the required reasoning_content placeholder on assistant turns during history replay.

Fix

Add _needs_mimo_tool_reasoning() detecting xiaomimimo.com base URLs or model names containing "mimo", and include it in _needs_thinking_reasoning_pad():

def _needs_mimo_tool_reasoning(self) -> bool:
    model = (self.model or "").lower()
    return (
        base_url_host_matches(self.base_url, "xiaomimimo.com")
        or "mimo" in model
    )

def _needs_thinking_reasoning_pad(self) -> bool:
    return (
        self._needs_deepseek_tool_reasoning()
        or self._needs_kimi_tool_reasoning()
        or self._needs_mimo_tool_reasoning()   # ← new
    )

Tests

tests/run_agent/test_mimo_reasoning_content.py (new file):

Test Assertion
test_mimo_url_triggers_pad xiaomimimo.com base URL → both methods return True
test_mimo_model_name_triggers_pad model "mimo-v2.5-pro"_needs_mimo_tool_reasoning() returns True
test_non_mimo_unaffected openai.com + gpt-4o → both methods return False

Stash-verify: FAILED (AttributeError: 'AIAgent' object has no attribute '_needs_mimo_tool_reasoning') before fix, 3 passed after.

Visual

graph 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{xiaomimimo.com in base_url?}
    D --> F{mimo in model name?}
Loading

Closes #24443

…ds_thinking_reasoning_pad

Multi-turn MiMo (Xiaomi) conversations failed with HTTP 400
"The reasoning_content in the thinking mode must be passed back to the API"
because _needs_thinking_reasoning_pad() only covered DeepSeek and Kimi.

Add _needs_mimo_tool_reasoning() that matches xiaomimimo.com base URLs or
model names containing "mimo", and include it in the predicate.

Closes NousResearch#24443

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 00:14

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 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 MiMo reasoning_content echo-back). Also competes with #24638, #24605, #24603. All fix #24443.

@wesleysimplicio

Copy link
Copy Markdown
Contributor Author

Closing in favor of #24465 (earliest open) per @alt-glitch's note — same MiMo reasoning_content echo-back fix for #24443.

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 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