fix(agent): add Xiaomi MiMo to reasoning_content echo-back providers (#25358)#25484
Merged
Conversation
Xiaomi MiMo emits reasoning via OpenAI's reasoning_content field and requires reasoning_content on every assistant tool-call message when replaying history. Without echo-back, subsequent API calls fail with HTTP 400 — same shape as DeepSeek and Kimi/Moonshot thinking modes. Adds _needs_mimo_tool_reasoning() detection (provider == 'xiaomi', 'mimo' in model, or xiaomimimo.com base url) and wires it into the _needs_thinking_reasoning_pad() check. Salvage of #25358 by @ephron-ren (manually re-applied — original branch was severely stale against current main).
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1365 |
invalid-argument-type |
1028 |
unresolved-attribute |
934 |
invalid-assignment |
463 |
unsupported-operator |
135 |
invalid-parameter-default |
119 |
not-subscriptable |
88 |
invalid-method-override |
86 |
invalid-return-type |
38 |
no-matching-overload |
32 |
call-non-callable |
28 |
unresolved-reference |
20 |
unused-type-ignore-comment |
14 |
invalid-type-form |
14 |
not-iterable |
6 |
| +6 more rules |
First entries
tests/cli/test_cli_shift_enter_newline.py:12: [unresolved-import] unresolved-import: Cannot resolve imported module `prompt_toolkit.input.vt100_parser`
skills/creative/comfyui/tests/test_check_deps.py:5: [unresolved-import] unresolved-import: Cannot resolve imported module `check_deps`
tests/tools/test_vercel_sandbox_environment.py:205: [unresolved-attribute] unresolved-attribute: Unresolved attribute `WriteFile` on type `ModuleType`
gateway/platforms/matrix.py:578: [unresolved-import] unresolved-import: Cannot resolve imported module `mautrix.client.state_store`
environments/tool_call_parsers/llama_parser.py:16: [unresolved-import] unresolved-import: Cannot resolve imported module `openai.types.chat.chat_completion_message_tool_call`
agent/codex_responses_adapter.py:624: [invalid-argument-type] invalid-argument-type: Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["detail"]`
tests/honcho_plugin/test_session.py:1621: [invalid-argument-type] invalid-argument-type: Argument is incorrect: Expected `dict[str, str]`, found `str | bool`
tests/acp/test_tools.py:3: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
tests/agent/test_auxiliary_config_bridge.py:280: [not-subscriptable] not-subscriptable: Cannot subscript object of type `int` with no `__getitem__` method
skills/creative/comfyui/tests/test_run_workflow.py:10: [unresolved-import] unresolved-import: Cannot resolve imported module `extract_schema`
hermes_cli/web_server.py:65: [unresolved-import] unresolved-import: Cannot resolve imported module `fastapi`
tests/tools/test_rl_training_tool.py:23: [invalid-argument-type] invalid-argument-type: Argument is incorrect: Expected `Popen[Unknown] | None`, found `str | dict[Unknown, Unknown]`
gateway/platforms/matrix.py:834: [unresolved-import] unresolved-import: Cannot resolve imported module `mautrix.client.dispatcher`
gateway/platforms/msgraph_webhook.py:174: [unresolved-attribute] unresolved-attribute: Attribute `json_response` is not defined on `None` in union `Unknown | None`
tests/skills/test_google_workspace_api.py:220: [unresolved-attribute] unresolved-attribute: Unresolved attribute `Credentials` on type `ModuleType`
tests/gateway/test_stream_consumer.py:7: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
tests/integration/test_modal_terminal.py:49: [invalid-argument-type] invalid-argument-type: Argument to function `module_from_spec` is incorrect: Expected `ModuleSpec`, found `ModuleSpec | None`
optional-skills/productivity/memento-flashcards/scripts/youtube_quiz.py:30: [unresolved-import] unresolved-import: Cannot resolve imported module `youtube_transcript_api`
plugins/observability/langfuse/__init__.py:490: [unresolved-attribute] unresolved-attribute: Attribute `start_as_current_observation` is not defined on `None` in union `Unknown | None`
tests/run_agent/test_stream_interrupt_retry.py:32: [invalid-argument-type] invalid-argument-type: Argument to `AIAgent.__init__` is incorrect: Expected `bool`, found `str | bool`
tests/hermes_cli/test_kanban_core_functionality.py:1317: [unresolved-attribute] unresolved-attribute: Attribute `max_runtime_seconds` is not defined on `None` in union `Task | None`
tests/hermes_cli/test_kanban_core_functionality.py:2893: [unresolved-attribute] unresolved-attribute: Attribute `skills` is not defined on `None` in union `Task | None`
tests/gateway/test_reload_skills_command.py:20: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
tests/gateway/test_matrix.py:118: [unresolved-attribute] unresolved-attribute: Unresolved attribute `Client` on type `ModuleType`
tests/run_agent/test_concurrent_interrupt.py:83: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_apply_pending_steer_to_tool_results` on type `_Stub`
... and 4355 more
✅ Fixed issues: none
Unchanged: 0 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Xiaomi MiMo emits reasoning via OpenAI's
reasoning_contentfield and requires it on every assistant tool-call message when replaying history. Without echo-back, subsequent API calls fail with HTTP 400 — same shape as DeepSeek and Kimi/Moonshot thinking modes (refs #15250, #17400).Adds
_needs_mimo_tool_reasoning()detection (provider == 'xiaomi', 'mimo' in model, or xiaomimimo.com base url) and wires it into the_needs_thinking_reasoning_pad()check.Salvage of #25358 by @ephron-ren. Manually re-applied — original branch was severely stale against current main (130k+ deletions would have inverse-reverted unrelated work).