fix(agent): add Chinese reasoning tags to think-block filter for MiniMax M3 - #43836
fix(agent): add Chinese reasoning tags to think-block filter for MiniMax M3#43836liuhao1024 wants to merge 1 commit into
Conversation
…Max M3 MiniMax M3 emits Chinese-language reasoning tags ( 思考, 反思, 推理, 推敲) instead of the English <think> family. The three filter sites — GatewayStreamConsumer streaming state machine, CLI _stream_delta, and strip_think_blocks() post-processing — only handled English tags, causing raw Chinese reasoning to leak into user-visible output on Telegram/Discord/CLI. Add the four Chinese tag pairs to all three filter sites and add corresponding unterminated-block and stray-orphan regexes in strip_think_blocks(). Fixes NousResearch#43827 Related: NousResearch#17924 (English tags), NousResearch#27288 (mixed-case tags)
|
Thanks for this, and for the detailed analysis in the linked issue. We're going to close it though — it runs against a standing design line: Hermes does not add parsing/scrubbing layers to strip a given model's bespoke raw reasoning delimiters. The existing English Concretely for MiniMax-M3: our provider plugin already sends There's also a correctness hazard specific to this fix: Not a knock on the work — the leak you saw is real to you. But the right fix lives in reasoning routing, not in a new raw-reasoning parser. Closing. |
Problem
MiniMax M3 emits Chinese-language reasoning tags (
思考,反思,推理,推敲) instead of the English<think>family. The three filter sites that strip reasoning content only handle English tags, causing raw Chinese reasoning to leak into user-visible output on Telegram, Discord, and CLI.Observed symptom: users see fragments like
思考\n...raw reasoning...in the middle of assistant responses.Solution
Add the four Chinese reasoning tag pairs to all three filter sites:
gateway/stream_consumer.py_OPEN_THINK_TAGS/_CLOSE_THINK_TAGScli.py_stream_deltalocal_OPEN_TAGS/_CLOSE_TAGSagent/agent_runtime_helpers.pystrip_think_blocks()Testing
test_stream_consumer_chinese_think_tags.py)Related Issues