fix(feishu): strip bot mention in group context so slash commands are recognized#36016
Conversation
… recognized In group chats, @bot /model was normalized to <at user_id="...">Bot</at> /model, which hasControlCommand() did not recognize as a slash command. The bot mention is now stripped in both p2p and group contexts; the mentionedBot flag already captures whether the bot was addressed. Closes openclaw#35994 Made-with: Cursor
Greptile SummaryThis PR fixes a bug where slash commands ( Change summary:
The change is minimal, backward-compatible, and well-covered by the updated tests. No issues found. Confidence Score: 5/5
Last reviewed commit: 5e9deee |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e9deee2cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| event.message.mentions, | ||
| event.message.chat_type === "p2p" ? botOpenId : undefined, | ||
| ); | ||
| const content = normalizeMentions(rawContent, event.message.mentions, botOpenId); |
There was a problem hiding this comment.
Gate bot-mention stripping on confirmed bot mention
parseFeishuMessageEvent now strips mentions using only botOpenId (normalizeMentions(..., botOpenId)), but checkBotMentioned explicitly guards against Feishu WS open_id remapping by requiring matching botName in multi-app groups. In that remapping scenario, mentionedBot is correctly false while this line still removes the mention text, so a message like @OtherBot /reset can be transformed into /reset and handled as our command when mention-gating is disabled (or at least loses intended context). The strip should be conditioned on a confirmed self-mention, not open_id alone.
Useful? React with 👍 / 👎.
Summary
/model,/reset,/new) in Feishu group chats are not intercepted by the Gateway command parser. Commands are passed to the agent as regular messages.@Bot /commandis unable to use system commands, forcing manual workarounds or DM-only command usage.parseFeishuMessageEventnow strips the bot's own mention in both p2p and group contexts (previously p2p only). ThementionedBotboolean already captures whether the bot was addressed, so the mention tag incontentonly served to break command detection.<at>tags. Mention-forward detection,requireMentiongating, and agent routing are unaffected.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
@Bot /model,@Bot /reset,@Bot /newnow work in Feishu group chats (previously silently passed to agent as text).Security Impact (required)
Repro + Verification
Environment
Steps
commands.text: true@Bot /modelin the groupExpected
Actual
Evidence
Human Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
parseFeishuMessageEventto restoreevent.message.chat_type === "p2p" ? botOpenId : undefinedextensions/feishu/src/bot.tsRisks and Mitigations
mentionedBotflag andhasAnyMentionfield already provide this information to downstream consumers. The mention tag was redundant noise in the agent body.