# 用户名中的大写字母导致编辑器中可达提及检查失效

**URL:** <https://meta.discourse.org/t/uppercase-letters-in-username-break-reachable-mention-check-in-composer/401292>\
**Category:** Bug\
**Tags:** mentions\
**Created:** [2026年四月22日 19:47 UTC](https://meta.discourse.org/t/uppercase-letters-in-username-break-reachable-mention-check-in-composer/401292 "2026-04-22T19:47:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2026年五月13日 16:25 UTC](https://meta.discourse.org/t/uppercase-letters-in-username-break-reachable-mention-check-in-composer/401292/6 "2026-05-13T16:25:07Z")

</div>

看来我的“修复”暴露了 AI 代理的这个问题🤔

> <https://github.com/discourse/discourse/pull/39986>
>
> Mentioning an AI bot (e.g. \`@Forum\_Research\_Assis\`) in a topic the bot's User re…cord can't see — like a category restricted to a group the bot isn't part of — surfaced the "this user cannot see this mention" warning popup in the composer. The warning is misleading: AI bots reply via \`PostCreator.create!(... skip\_guardian: true)\` (\`playground.rb\`), so they respond regardless of whether their User can \`Guardian#can\_see?\` the topic.
> 
> The previous case-insensitive fix (9a4cca29) exposed this latent behavior. Pre-fix, mixed-case names hit a case-sensitive hash miss in \`ComposerController#mentions\` and silently returned an empty \`user\_reasons\`. Post-fix, the lookup hits correctly and the reachability check — which was always there — now fires for AI bot users that genuinely can't see the topic.
> 
> Adds a \`:composer\_mention\_user\_reason\` plugin modifier, applied after the standard reason is computed in \`user\_reason\`, so plugins can clear or transform it. The AI plugin registers against the modifier and returns \`nil\` for any user in \`DiscourseAi::AiBot::EntryPoint.all\_bot\_ids\` (covering both AI agent users and chat-bot-enabled LLM model users).
> 
> discobot and the system user are intentionally unaffected: discobot's \`PostCreator.create!\` does not skip the guardian, so the reachability warning remains accurate for it.
> 
> https://meta.discourse.org/t/401292

---

_[View the full topic](https://meta.discourse.org/t/uppercase-letters-in-username-break-reachable-mention-check-in-composer/401292)._
