Skip to content

Commit abe717c

Browse files
committed
fix(feishu): allow card-action callbacks to bypass requireMention in groups
Structured card action callbacks (e.g., execute_confirmed) were silently dropped in group chats with requireMention=true because the synthetic message built from the card action has no mentions array. Since clicking a button on a bot-sent card is already direct bot engagement, the requireMention check should not apply. Fixes #85450
1 parent 84db594 commit abe717c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎extensions/feishu/src/bot.broadcast.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,24 @@ describe("broadcast dispatch", () => {
368368
expect(mockGetChatInfo).not.toHaveBeenCalled();
369369
});
370370

371+
it("allows card-action synthetic messages to bypass requireMention in groups", async () => {
372+
const cfg = createBroadcastConfig();
373+
const event = createBroadcastEvent({
374+
messageId: "card-action-test-token",
375+
text: "execute_confirmed",
376+
});
377+
378+
await handleFeishuMessage({
379+
cfg,
380+
event,
381+
botOpenId: "ou_known_bot",
382+
runtime: createRuntimeEnv(),
383+
});
384+
385+
expect(mockDispatchReplyFromConfig).toHaveBeenCalledTimes(2);
386+
expect(mockCreateFeishuReplyDispatcher).toHaveBeenCalledTimes(1);
387+
});
388+
371389
it("skips broadcast dispatch when bot identity is unknown (requireMention=true)", async () => {
372390
const cfg = createBroadcastConfig();
373391
const event = createBroadcastEvent({

‎extensions/feishu/src/bot.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,12 @@ export async function handleFeishuMessage(params: {
660660
groupPolicy,
661661
}));
662662

663+
// Card action callbacks are direct responses to bot-initiated interactions;
664+
// they should bypass requireMention since the user already engaged with the bot.
665+
if (event.message.message_id?.startsWith("card-action-")) {
666+
requireMention = false;
667+
}
668+
663669
const groupSenderActivationIngress = await resolveFeishuGroupSenderActivationIngressAccess({
664670
cfg,
665671
accountId: account.accountId,

0 commit comments

Comments
 (0)