Skip to content

fix(minimax-bot): 紧贴中文的点名能点到了,模型写的字段和群里的回复也伪造不了上下文块 - #91

Merged
MyPrototypeWhat merged 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/minimax-bot-mention-and-marks
Oct 28, 2026
Merged

MyPrototypeWhat merged 1 commit into
MiniMax-AI:mainfrom
Apageoflove:fix/minimax-bot-mention-and-marks

Conversation

@Apageoflove

@Apageoflove Apageoflove commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

群里点名原本有个坑:@ 前面只要是任何语言的字母,那个点名就不算数。判断用的是是不是词字符,而汉字也算词字符,中文词与词之间本来就没有空格,于是请@某人、好的@某人、麻烦@某人 看一下这几种最常见的写法全都点不到人。管理员只能自己先答一遍,再在回话里重新点一次名,那位才被叫上,同一件事于是多绕一圈、多跑几轮模型。现在只有 ASCII 的字母、数字和下划线挡在 @ 前面才算数,那才是邮箱本地部分的样子。英文一个字节都没改:邮箱地址那种写法、以及字母紧贴在 @ 前面的,都照样不算点名;@alice、@alice. 和 @alice Smith 照样算,名字后面接着别的词(@alicex)照样不算。我把英文的四十种写法在上游和改后各跑一遍,一处都没差,变的只有前面那个字不是 ASCII 的那八种。

真模型里对着量了一次,两版在同一群里发同一句 请@设计师,群里是 Chief、设计师、写手、审核四个 Bot。上游 0.7.12 是 Chief 先说、设计师靠接力才轮到,群里过了 5 个回合,宿主日志里 4 次模型调用;改好后设计师直接接话,1 次调用。同一句里点两个人也一样:上游只点到了前面有空格的 @审核,紧贴中文的 @写手 根本没点着;改好后两个都被点到。

另一处是协议标记。群里常驻简报和记忆块都带标记,名字、角色、群公告、Bot 的指令、记忆条目都是模型(或你)能写的,它们会被读进这些块里;群里别人的回复和用户消息也会跟着进下一个 Bot 的提示词。标记写在里面就能把块提前关掉,或者在下一个 Bot 的提示词里另开一个块,后面的文字看上去就像插件自己说的。这些标记现在和回复里的一样处理:去掉标记本身,周围的字不动。上游上我按注入点乘拼写跑了六十六种组合,英文中文各半,六十二种是漏的;改完六十六种全过。真模型里也照着量了:用户那句里的标记、Bot 指令里的、角色里的、Bot 自己回话里抄的,四种进到下一个 Bot 的提示词里,上游原样留着,改好后一个不留。

本地跑过上游 npm run check 的两半,scripts/validate.mjs 对本插件报 minimax-bot: OK 和 repository: OK,根目录 87/87 条测试;插件自带套件 279 过、0 挂,比上游 main 多 13 条。新加的 13 条用例搬到没改过的上游代码上跑,8 条红、5 条绿,那 5 条钉的是英文旧行为,前后都过,正好说明英文没被顺手改掉。正常内容下的提示词也逐字节比过:简报、记忆块、群上下文、拼起来的整段,四样都和上游一字不差。宿主自己往提示词里塞的标签(agent-context、media-output-reminder 之类)不在插件的协议标记范围内,Bot 原样抄进回话后会跟着群历史走进下一个 Bot 的提示词,这一条没管,要不要一起处理需要确认,我另开一条报上游。


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@MyPrototypeWhat MyPrototypeWhat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this. Approving. I checked out 8742823 and compared it against main. Nothing here can harm MiniMax Code, credentials, other plugins' data or user data, and all changes stay inside plugins/minimax-ai/minimax-bot/.

Verified

  • npm run check at the repo root passes.
  • Plugin tests: 279 run, 275 pass. The 4 failures also fail on main (one reactions test, three emoji picker tests). All 13 new tests pass.
  • The version is 0.7.13 in plugin.json, package.json, the MCP serverInfo and the README changelog.
  • a@b.com, mail@alice.com, 1@alice, _@alice and @alicex are not mentions.
  • 请@alice, (@alice), ,@alice, x.@alice, -@alice and a leading @alice are mentions. English behavior is unchanged.
  • Names, roles, the group name and notice, instructions, the roster, catch-up lines, the handover from and memory text are cleaned before they go inside block markers. Ordinary text like <div> or a<b is left alone.

Optional

  • A Chinese name followed directly by more Chinese still doesn't resolve: @某人帮忙 and 请@某人看 reach nobody, because the next CJK character counts as a word character. You could note this in the README or drop the trailing boundary check for CJK names.
  • Any non-ASCII letter before @ now starts a mention, so josé@alice… would ping alice. Rare, but worth knowing.
  • helper.brief in engine.mjs (around line 1778) still inserts bot.name and bot.role raw inside <minimax-bot-helper>. Wrapping them in clean() would close that path.
  • neutralizeMarks misses a zero-width character inside the tag (<\u200b/minimax-bot-context>) and attributes over 40 characters. Both predate this PR.
  • Consider neutralizing generic system-style tags like <system-reminder> too, so chat text can't pose as a system note to the model.

None of this blocks the merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants