Bug: When clicking approve/deny on the interactive approval card in Feishu, the card does not update to show the decision (green/red). The card remains in its original orange state.
Root cause: _update_approval_card() in gateway/platforms/feishu.py uses UpdateMessageRequest (HTTP PUT) to update the card. Feishu's PUT endpoint replaces the entire message, which strips the interactive elements (buttons). The update appears to succeed silently but the card loses its card rendering.
Fix: Use PatchMessageRequest (HTTP PATCH) instead, which updates only the specified fields while preserving the message's interactive card format.
Changes:
- Add imports:
from lark_oapi.api.im.v1 import PatchMessageRequest, PatchMessageRequestBody
- In
_update_approval_card(), replace:
body = self._build_update_message_body(msg_type="interactive", content=payload)
request = self._build_update_message_request(message_id=message_id, request_body=body)
await asyncio.to_thread(self._client.im.v1.message.update, request)
With:
body = PatchMessageRequestBody.builder().content(payload).build()
request = PatchMessageRequest.builder().message_id(message_id).request_body(body).build()
await asyncio.to_thread(self._client.im.v1.message.patch, request)
Key difference: PatchMessageRequestBody only needs .content() (no .msg_type()), and calls .patch instead of .update.
SDK: lark-oapi >= 1.5.3 already includes PatchMessageRequest and PatchMessageRequestBody.
Additional improvement: Split the guard clause if not self._client or not message_id: return into two separate checks with warning logs for easier debugging when message_id is empty.
Bug: When clicking approve/deny on the interactive approval card in Feishu, the card does not update to show the decision (green/red). The card remains in its original orange state.
Root cause:
_update_approval_card()ingateway/platforms/feishu.pyusesUpdateMessageRequest(HTTP PUT) to update the card. Feishu's PUT endpoint replaces the entire message, which strips the interactive elements (buttons). The update appears to succeed silently but the card loses its card rendering.Fix: Use
PatchMessageRequest(HTTP PATCH) instead, which updates only the specified fields while preserving the message's interactive card format.Changes:
_update_approval_card(), replace:With:
Key difference:
PatchMessageRequestBodyonly needs.content()(no.msg_type()), and calls.patchinstead of.update.SDK: lark-oapi >= 1.5.3 already includes
PatchMessageRequestandPatchMessageRequestBody.Additional improvement: Split the guard clause
if not self._client or not message_id: returninto two separate checks with warning logs for easier debugging when message_id is empty.