Skip to content

fix: scrub MiniMax reasoning markers - #59500

Closed
shashwatgokhe wants to merge 1 commit into
NousResearch:mainfrom
shashwatgokhe:fix/minimax-mm-think-tags
Closed

fix: scrub MiniMax reasoning markers#59500
shashwatgokhe wants to merge 1 commit into
NousResearch:mainfrom
shashwatgokhe:fix/minimax-mm-think-tags

Conversation

@shashwatgokhe

Copy link
Copy Markdown
Contributor

Summary

Fixes #59461.

MiniMax M3 can emit provider reasoning in <mm:think>...</mm:think> blocks. The existing scrubbers already handled tags like <think>, <thinking>, <reasoning>, and <thought>, but not the MiniMax namespaced form, so those markers could leak into streamed gateway output, the CLI stream, and stored final assistant text.

This adds <mm:think> to the same scrub paths and covers all three surfaces with regression tests.

Tests

  • PYTHONPATH=. $HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_stream_consumer.py::TestFilterAndAccumulate::test_minimax_mm_think_tag_variant tests/cli/test_stream_delta_think_tag.py::TestRealReasoningBlock::test_minimax_mm_think_tag_suppressed tests/run_agent/test_run_agent.py::TestStripThinkBlocks::test_minimax_mm_think_block_removed -q before the fix, expected failure: 3 failed
  • PYTHONPATH=. $HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_stream_consumer.py::TestFilterAndAccumulate::test_minimax_mm_think_tag_variant tests/cli/test_stream_delta_think_tag.py::TestRealReasoningBlock::test_minimax_mm_think_tag_suppressed tests/run_agent/test_run_agent.py::TestStripThinkBlocks::test_minimax_mm_think_block_removed -q after the fix: 3 passed
  • PYTHONPATH=. $HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_stream_consumer.py::TestFilterAndAccumulate tests/gateway/test_stream_consumer.py::TestFilterAndAccumulateIntegration tests/cli/test_stream_delta_think_tag.py tests/run_agent/test_run_agent.py::TestStripThinkBlocks -q: 70 passed
  • PYTHONPATH=. $HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_stream_consumer.py tests/cli/test_stream_delta_think_tag.py -q: 138 passed
  • PYTHONPATH=. $HOME/.hermes/hermes-agent/venv/bin/python -m ruff check gateway/stream_consumer.py cli.py agent/agent_runtime_helpers.py tests/gateway/test_stream_consumer.py tests/cli/test_stream_delta_think_tag.py tests/run_agent/test_run_agent.py: All checks passed

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery provider/minimax MiniMax (Anthropic transport) P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 6, 2026
@teknium1

teknium1 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix. Closing this on a standing design line (same reason as #43836 and #43932, and the routing-based attempt in #59487): Hermes does not add scrubbing/parsing layers to strip a model's bespoke raw reasoning delimiters.

The <mm:think> markers reaching user-visible content is the provider/model emitting reasoning in a broken shape — the provider should be returning it in a separate field, not inline. Extending the shared think-block filters to chase each model's custom markers (<mm:think>, the Chinese 思考/反思/推理/推敲 variants, and whatever the next model emits) is an open-ended surface, and it masks the real issue instead of surfacing it. Some of these markers are also ordinary-word-shaped, not XML sentinels, so stripping them risks corrupting legitimate answers.

If you want reasoning split out of the visible channel for MiniMax-M3 today, point it at the OpenAI-compatible endpoint explicitly (MINIMAX_BASE_URL=https://api.minimax.io/v1 or model.base_url) — the MiniMax profile already sends reasoning_split: True on that route, so reasoning comes back in a separate field rather than inline.

Appreciate the work. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists provider/minimax MiniMax (Anthropic transport) sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: reasoning stream markers leak verbatim into Telegram, Windows desktop, and Linux desktop on v0.18.0

3 participants