Fix Feishu card button callback parameters dropped (missing handler)#17863
Fix Feishu card button callback parameters dropped (missing handler)#17863Takhoffman merged 1 commit intoopenclaw:mainfrom
Conversation
| await handleFeishuMessage({ | ||
| cfg, | ||
| event: messageEvent, | ||
| botOpenId: params.botOpenId, | ||
| runtime, | ||
| accountId, | ||
| }); |
There was a problem hiding this 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.
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.| }, | ||
| }, | ||
| message: { | ||
| message_id: `card-action-${event.token}`, |
There was a problem hiding this 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:
| 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.|
This pull request has been automatically marked as stale due to inactivity. |
…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).
d85762b to
b64aadf
Compare
|
PR #17863 - Fix Feishu card button callback parameters dropped (missing handler) (#17863) Merged via squash.
Thanks @Clawborn! |
|
Correction for formatting in prior note:
|
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com> (cherry picked from commit 27dc003)
Co-authored-by: Kai <clawborn@users.noreply.github.com> (cherry picked from commit 27dc003)
Co-authored-by: Kai <clawborn@users.noreply.github.com> (cherry picked from commit 27dc003)
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Cherry-pick of upstream 49cf2bc.
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Cherry-pick of upstream 49cf2bc.
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Co-authored-by: Kai <clawborn@users.noreply.github.com>
Description
Feishu card interactions (button clicks) trigger a
card.action.triggerevent, which was previously ignored by the bot monitor. This meant button clicks had no effect and parameters were lost.Fix
card.action.trigger.src/feishu/card-action.ts) to convert card actions into synthetic message events so they can be processed by the agent (supportingvalueas text or JSON).Tests
Added
extensions/feishu/src/bot.card-action.test.tsverifying:textpayload is converted to messageAI Transparency
extensions/feishu/src/bot.card-action.test.ts)Greptile Summary
This PR adds a handler for Feishu card button click events (
card.action.trigger), which were previously silently ignored. The newcard-action.tsadapter converts card action payloads into syntheticFeishuMessageEventobjects so they can be processed through the existing message pipeline. The monitor registers the new event handler following the same pattern as existing handlers.message_idis built fromevent.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.Confidence Score: 2/5
event.tokenbeing 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.tsline 59 — themessage_idgeneration usingevent.tokenneeds to use a unique identifier instead.Last reviewed commit: d85762b