Skip to content

fix(feishu): strip only leading bot self-mention so multi-bot groups respond - #72661

Closed
Bojun-Vvibe wants to merge 2 commits into
openclaw:mainfrom
Bojun-Vvibe:fix/feishu-bot-strip-leading-at-72504
Closed

Bojun-Vvibe wants to merge 2 commits into
openclaw:mainfrom
Bojun-Vvibe:fix/feishu-bot-strip-leading-at-72504

Conversation

@Bojun-Vvibe

Copy link
Copy Markdown

Fixes #72504. Refs #35994.

Problem

In Feishu group chats where a user @-mentions multiple bots together — e.g. @BotA @BotB please coordinate — every bot returns NO_REPLY. Root cause is normalizeMentions() in extensions/feishu/src/bot-content.ts: it strips EVERY occurrence of the receiving bot's own <at> tag from the message body. After stripping, each bot only sees its peer's <at> tag, so its LLM concludes it was not addressed.

Fix

Narrow the strip to ONLY the leading addressing prefix (optional whitespace → bot's mention key → whitespace or end-of-text). This preserves the #35994 slash-command UX (@Bot /help → /help) while keeping mid-sentence self-mentions visible to the LLM so multi-bot routing decisions stay correct.

The bot-mentioned detection itself (checkBotMentioned in bot-content.ts) is unchanged and continues to read event.message.mentions[] directly — so this fix only affects what the LLM sees as the prompt body, not whether the bot is woken up.

Tests

All 11 existing bot.stripBotMention.test.ts cases pass unchanged (every leading-prefix scenario continues to strip identically). Two new tests cover the regression:

  1. Mid-sentence self-mention in a multi-bot group is preserved (Hey @BotA @BotB ...).
  2. Leading prefix is stripped while a separate inline self-mention in the same message is kept (@Bot1 ask @Bot1 to summarize → ask <at>Bot</at> to summarize).

Full file: 13/13 pass. pnpm tsgo:test clean.

Diff

+53 / -6 across 2 production files + 1 test file (62 lines incl. CHANGELOG entry).

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S labels Apr 27, 2026
@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR narrows normalizeMentions() in extensions/feishu/src/bot-content.ts to strip only the leading addressing prefix of the receiving bot's own <at> mention, rather than all occurrences globally. The change correctly fixes the multi-bot NO_REPLY regression (#72504) while preserving the existing slash-command UX (#35994), and is supported by two new targeted regression tests.

Confidence Score: 5/5

Safe to merge — the fix is narrowly scoped, all 13 tests pass, and the logic is sound across all relevant scenarios.

The new leading-strip logic correctly detects the bot's own key at the start of the text and removes only that occurrence, while the existing per-mention loop converts remaining occurrences to proper tags. The detection regex and replacement regex are consistent and handle edge cases. All original 11 tests still pass unchanged and the 2 new regression tests cover the bug directly. No security or data-integrity concerns.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(feishu): strip only leading bot self..." | Re-trigger Greptile

@Bojun-Vvibe
Bojun-Vvibe force-pushed the fix/feishu-bot-strip-leading-at-72504 branch 3 times, most recently from 9367941 to 25f25c0 Compare April 27, 2026 07:43
…respond

normalizeMentions previously stripped EVERY occurrence of the bot's own
<at> tag from the message body. In group chats where a user @-mentions
multiple bots together ("@bota @botb please coordinate"), each bot then
saw only its peer's <at> tag, concluded it was not addressed, and
returned NO_REPLY — a silent failure for the user.

Narrow the strip to ONLY the leading addressing prefix (optional
whitespace, then the bot's mention key, then whitespace or end-of-text).
This preserves the openclaw#35994 slash-command UX (`@Bot /help` -> `/help`)
while keeping any mid-sentence self-mention visible to the LLM so
multi-bot routing decisions stay correct.

Fixes openclaw#72504. Refs openclaw#35994.

Tests:
- All 11 existing strip-bot-mention tests still pass (leading-prefix
  cases unchanged).
- Two new tests cover the regression scenarios:
  - mid-sentence self-mention in a multi-bot group is preserved
  - leading prefix is stripped while a separate inline self-mention
    in the same message is kept
@Bojun-Vvibe
Bojun-Vvibe force-pushed the fix/feishu-bot-strip-leading-at-72504 branch from 25f25c0 to 1f668d2 Compare April 27, 2026 07:58
@clawsweeper

clawsweeper Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep this PR open, but it is not merge-ready: the branch addresses the Feishu multi-bot mention bug, but the diff regresses the existing compact Feishu slash-command path and still lacks real Feishu behavior proof.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes for the PR-introduced regression from source inspection: compact @Bot/model bypasses the PR's whitespace-only leading-strip check, while current command execution reads CommandBody rather than the normalized probe body. The reported multi-bot Feishu bug is source-plausible but still lacks real Feishu after-fix proof.

Is this the best way to solve the issue?

No as written. Preserving inline self-mentions is the right direction, but the implementation must also preserve slash-clean command bodies for compact mention commands and include real Feishu proof before merge.

Security review:

Security review cleared: The diff is limited to Feishu text normalization and tests, with no new dependency, secret, install, CI, or code-execution surface.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-27T06:48:44Z, is older than 30 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • Lanfei: The related merged PR fix(feishu): normalize all mentions in inbound agent context #30252 authored by Lanfei introduced Feishu mention normalization and the bot/self-reference tag behavior that this PR changes. (role: introduced mention-normalization behavior; confidence: high; commits: 9083a3f2e308; files: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.stripBotMention.test.ts)
  • liuxiaopai-ai: Commit 174eeea from the related merged PR added the group mention-prefixed slash-command probe test and runtime normalization that this PR must preserve. (role: introduced compact group slash-command probe behavior; confidence: high; commits: 174eeea76ce2; files: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.test.ts)
  • Sid-Qin: The related merged PR fix(feishu): strip bot mention in group context so slash commands are recognized #36016 moved Feishu group handling toward stripping the bot mention for slash commands, making it relevant to this compatibility boundary. (role: adjacent group mention-strip contributor; confidence: medium; files: extensions/feishu/src/bot.ts, extensions/feishu/src/bot.stripBotMention.test.ts)
  • Peter Steinberger: The shallow current checkout blame attributes the current bot-content.ts and bot.ts lines to commit 73a81d1, so this is only a weak recent-area routing signal. (role: recent current-main line owner signal; confidence: low; commits: 73a81d1d6ade; files: extensions/feishu/src/bot-content.ts, extensions/feishu/src/bot.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 340fca0a453c.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 4, 2026
@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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

Labels

channel: feishu Channel integration: feishu merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu: bot strips its own <at> mention causing NO_REPLY in multi-bot groups

1 participant