Skip to content

fix(lark): handle card.action.trigger over the long connection#604

Open
loind wants to merge 2 commits into
iOfficeAI:mainfrom
loind:fix/lark-card-action-callback
Open

fix(lark): handle card.action.trigger over the long connection#604
loind wants to merge 2 commits into
iOfficeAI:mainfrom
loind:fix/lark-card-action-callback

Conversation

@loind

@loind loind commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Interactive card button clicks were delivered but did nothing — Feishu reported a callback timeout.

Root cause (confirmed via debug log)

Over the long connection, a card button click arrives as an event with event_type = "card.action.trigger":

DEBUG "Lark unhandled event type" event_type="card.action.trigger"

handle_ws_text only routed frame-type card (webhook mode) to handle_card_action; the event branch handled im.message.receive_v1 / application.bot.menu_v6 only, so card.action.trigger fell through to _ => unhandled and was dropped → no response → Feishu 3s timeout.

Fix

  • Route event_type == "card.action.trigger" (event branch) to handle_card_action.
  • CardActionEvent now reads open_chat_id / open_message_id from the event context (long connection) with fallback to the top-level fields (legacy webhook).

Testing

  • New unit test card_action_event_parses_long_connection_context.
  • cargo test -p aionui-channel --features lark — all green.
  • Verified end-to-end: before, clicking logged unhandled event type; the fix routes the click to the card handler.

Notes

Requires the app's callback subscription (回调订阅) to use the long connection (developer console). Independent of #602 (region) and #603 (pre-auth replay).

loind added 2 commits July 11, 2026 14:41
Interactive card button clicks arrive over the long connection as an
`event` with event_type `card.action.trigger`, but only frame-type
`card` (webhook mode) was routed to the card handler — so clicks were
dropped ("unhandled event type") and Feishu reported a callback timeout.

Route the event to handle_card_action, and read open_chat_id /
open_message_id from the event `context` (webhook nests them top-level).
Reply to the card callback with a card-callback response body
(`{}` = keep card unchanged) instead of the generic `{"code":200}`
event ack, so the platform no longer reports a callback timeout on the
clicked button. Plain events keep the `{"code":200}` ack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant