fix(feishu): stop using card action callback token as synthetic message_id - #43609
Lazymonter wants to merge 1 commit into
Conversation
VerificationReviewed the Feishu card action callback token fix. The change sets Why this is correct: The callback token is a short-lived delivery token, not a Feishu message ID. When used as Test coverage: The new test Clean fix, no issues found. |
|
Verification comment from automated review Reviewed the diff. The fix is correct: the Feishu callback token is a short-lived delivery token, not a message ID. Using it as Setting The dedup concern is handled separately by |
|
Thanks for isolating the callback-token issue. The defect still exists on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
ae1847a to
b75e303
Compare
When a user clicks a button on a Feishu interactive card, _handle_card_action_event() builds a synthetic MessageEvent using the card action callback token (c-xxx) as message_id. When the agent replies, _reply_anchor_for_event() returns this token as reply_to, but the Feishu ReplyMessage API requires open_message_id (om_xxx) — the ID of the original card message. The reply fails with: [99992354] Invalid ids: [c-xxx] The P2CardActionTriggerData.CallBackContext already provides open_message_id alongside open_chat_id, but the adapter was only extracting open_chat_id and ignoring open_message_id. Fix: extract open_message_id from context and use it as message_id (preferred), with token as fallback (still valid for dedup) and uuid4 as last resort. Production-verified: running this 2-line fix in a Docker deployment for 7+ weeks. Card button replies that previously failed with 99992354 now deliver successfully as threaded replies to the original card. Related: NousResearch#6422 (stale, targets pre-migration path), NousResearch#43609 (alternative approach using message_id=None which loses reply threading)
|
@Lazymonter Thanks for this — the One heads-up: issue #7200 asks for the processing-status reaction to appear on card clicks, and setting Both approaches fix the dropped-reply bug; #85864 additionally preserves the reaction feedback #7200 expects. Happy to coordinate if you want to fold the |
Problem
When an interactive card button is clicked,
_handle_card_action_eventbuilds a syntheticCOMMANDevent. Its callbacktokenis a short-lived card-update credential, not a Feishu IM message ID.Passing that token (or the previous random UUID fallback) as
event.message_idmakes_reply_anchor_for_event()use it asreply_to. Feishu rejects the response with error 99992354 (invalid message ID), so the result of a card-button command never reaches the chat.Fix
Set
message_id=Noneon the synthetic event:Testing
scripts/run_tests.sh tests/gateway/test_feishu_approval_buttons.py -q— 38 passed.git diff --checkpass.