Skip to content

Fix Feishu card button callback parameters dropped (missing handler)#17863

Merged
Takhoffman merged 1 commit intoopenclaw:mainfrom
Clawborn:fix/feishu-card-btn-callback
Feb 28, 2026
Merged

Fix Feishu card button callback parameters dropped (missing handler)#17863
Takhoffman merged 1 commit intoopenclaw:mainfrom
Clawborn:fix/feishu-card-btn-callback

Conversation

@Clawborn
Copy link

@Clawborn Clawborn commented Feb 16, 2026

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 Summary

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.

Confidence Score: 2/5

  • 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.

Last reviewed commit: d85762b

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +70 to +76
await handleFeishuMessage({
cfg,
event: messageEvent,
botOpenId: params.botOpenId,
runtime,
accountId,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing chatHistories parameter when calling handleFeishuMessage

handleFeishuMessage in bot.ts:472-479 accepts a chatHistories parameter that's used for group chat history tracking. The monitor registers handlers with a chatHistories Map (monitor.ts:150), but card-action.ts:70-76 omits this parameter.

While chatHistories is optional, omitting it means card actions in group chats won't have access to message history context, creating inconsistent behavior compared to regular messages.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/card-action.ts
Line: 70:76

Comment:
Missing `chatHistories` parameter when calling `handleFeishuMessage`

`handleFeishuMessage` in `bot.ts:472-479` accepts a `chatHistories` parameter that's used for group chat history tracking. The monitor registers handlers with a `chatHistories` Map (monitor.ts:150), but `card-action.ts:70-76` omits this parameter.

While `chatHistories` is optional, omitting it means card actions in group chats won't have access to message history context, creating inconsistent behavior compared to regular messages.

How can I resolve this? If you propose a fix, please make it concise.

@openclaw-barnacle openclaw-barnacle bot added channel: feishu Channel integration: feishu size: S labels Feb 16, 2026
@steipete steipete closed this Feb 16, 2026
@steipete steipete reopened this Feb 17, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

},
},
message: {
message_id: `card-action-${event.token}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.token is the app verification token, not a unique event ID

In Feishu's card action callback, token is the app-level verification token (the same value configured in account.verificationToken). It does not change between card action events. This means card-action-${event.token} produces the same message_id for every card button click from the same app.

Because handleFeishuMessage runs tryRecordMessage(messageId) (in bot.ts:491), the dedup module will accept the first card action and then reject all subsequent card actions for 30 minutes (the dedup TTL), silently dropping them.

Consider using a unique identifier instead — for example, a combination of operator ID and timestamp:

Suggested change
message_id: `card-action-${event.token}`,
message_id: `card-action-${event.operator.open_id}-${Date.now()}`,
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/card-action.ts
Line: 59:59

Comment:
**`event.token` is the app verification token, not a unique event ID**

In Feishu's card action callback, `token` is the app-level verification token (the same value configured in `account.verificationToken`). It does **not** change between card action events. This means `card-action-${event.token}` produces the **same** `message_id` for every card button click from the same app.

Because `handleFeishuMessage` runs `tryRecordMessage(messageId)` (in `bot.ts:491`), the dedup module will accept the first card action and then reject all subsequent card actions for 30 minutes (the dedup TTL), silently dropping them.

Consider using a unique identifier instead — for example, a combination of operator ID and timestamp:

```suggestion
      message_id: `card-action-${event.operator.open_id}-${Date.now()}`,
```

How can I resolve this? If you propose a fix, please make it concise.

@openclaw-barnacle
Copy link

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 stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels Feb 22, 2026
…n\nFeishu card interactions (button clicks) trigger a 'card.action.trigger' event,\nwhich was previously ignored by the bot monitor. This meant button clicks\nhad no effect and parameters were lost.\n\nFix: Registered handler for 'card.action.trigger'.\nFix: Added adapter to convert card actions into synthetic message events\nso they can be processed by the agent (supporting 'value' as text or JSON).
@Takhoffman Takhoffman force-pushed the fix/feishu-card-btn-callback branch from d85762b to b64aadf Compare February 28, 2026 05:24
@Takhoffman Takhoffman merged commit 49cf2bc into openclaw:main Feb 28, 2026
9 checks passed
@Takhoffman
Copy link
Contributor

PR #17863 - Fix Feishu card button callback parameters dropped (missing handler) (#17863)

Merged via squash.

  • Merge commit: 49cf2bc
  • Verified:
    • pnpm check
    • pnpm test extensions/feishu/src/bot.card-action.test.ts extensions/feishu/src/monitor.reaction.test.ts extensions/feishu/src/bot.test.ts
  • Changes made:
    • Rebased onto current main and resolved monitor event-handler conflicts
    • Kept existing reaction handling and added card.action.trigger handling in parallel
    • Addressed formatting and strict typing () for the new callback path
  • Why these changes were made:
    • Ensure Feishu card action callbacks are not dropped while preserving current monitor behavior and type-safety standards.

Thanks @Clawborn!

@Takhoffman
Copy link
Contributor

Correction for formatting in prior note:

  • Changes made:
    • Rebased onto current main and resolved monitor event-handler conflicts
    • Kept existing reaction handling and added card.action.trigger handling in parallel
    • Addressed formatting and strict typing (data: unknown) for the new callback path

mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
(cherry picked from commit 27dc003)
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
(cherry picked from commit 27dc003)
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
(cherry picked from commit 27dc003)
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
newtontech pushed a commit to newtontech/openclaw-fork that referenced this pull request Feb 28, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
wanjizheng pushed a commit to wanjizheng/openclaw that referenced this pull request Mar 1, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
venjiang pushed a commit to venjiang/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants