#17863: Fix Feishu card button callback parameters dropped (missing handler)
channel: feishu
stale
size: S
trusted-contributor
Cluster:
Feishu Messaging Fixes
## Description
Feishu card interactions (button clicks) trigger a `card.action.trigger` event, which was previously ignored by the bot monitor. This meant button clicks had no effect and parameters were lost.
## Fix
- Registered handler for `card.action.trigger`.
- Added adapter (`src/feishu/card-action.ts`) to convert card actions into synthetic message events so they can be processed by the agent (supporting `value` as text or JSON).
## Tests
Added `extensions/feishu/src/bot.card-action.test.ts` verifying:
- Card action with `text` payload is converted to message
- Card action with JSON object payload is converted to message
## AI Transparency
- **Assisted by**: OpenClaw Agent (Claude 3.5 Sonnet / Opus)
- **Testing level**: Fully tested with new unit tests (`extensions/feishu/src/bot.card-action.test.ts`)
- **Prompt strategy**: Self-correction loop based on codebase analysis
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds a handler for Feishu card button click events (`card.action.trigger`), which were previously silently ignored. The new `card-action.ts` adapter converts card action payloads into synthetic `FeishuMessageEvent` objects so they can be processed through the existing message pipeline. The monitor registers the new event handler following the same pattern as existing handlers.
- **Critical bug**: The synthetic `message_id` is built from `event.token`, which is the app's verification token (shared across all events), not a unique event identifier. This will cause the dedup module (`tryRecordMessage`) to silently drop all card actions after the first one within a 30-minute window.
- Tests cover text and JSON payload conversion but don't exercise the dedup interaction, so they don't catch the token reuse issue.
- The overall adapter pattern (converting card actions into synthetic messages) is a clean approach that reuses the existing message handling pipeline effectively.
<h3>Confidence Score: 2/5</h3>
- This PR has a bug that will cause card button clicks to stop working after the first click — should be fixed before merge.
- The dedup bug with `event.token` being the app verification token (not a unique event ID) means only the first card button click will be processed; all subsequent clicks within 30 minutes will be silently dropped. This effectively renders the feature broken after one use per app.
- `extensions/feishu/src/card-action.ts` line 59 — the `message_id` generation using `event.token` needs to use a unique identifier instead.
<sub>Last reviewed commit: d85762b</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#22598: feat(feishu): support card action callback handler
by yingyixu · 2026-02-21
84.0%
#9756: fix(feishu): prevent message redelivery during long AI generation
by cszhouwei · 2026-02-05
76.5%
#22675: feishu: move message dedup to just before dispatch
by zijiegeng · 2026-02-21
76.3%
#16123: Feishu card default
by QiuYi111 · 2026-02-14
75.4%
#13917: fix(feishu): card rendering for tables, blockquotes, images, and ou...
by yaoting · 2026-02-11
74.3%
#16716: feat(feishu): add reaction event support (created/deleted)
by schumilin · 2026-02-15
73.8%
#19027: fix(feishu): keep chunked messages in topic/thread context
by qiangu · 2026-02-17
73.4%
#10309: fix: use group ID for peer.id in Feishu group messages
by ParsifalC · 2026-02-06
72.6%
#13211: feat(feishu): skip reply-to in DM conversations
by Vincentwei1021 · 2026-02-10
72.6%
#21484: fix(feishu): scope message deduplication by accountId to support mu...
by guanyu-zhang · 2026-02-20
72.5%