Skip to content

The agent that grows with you

fix(feishu): log rejected delete_message responses

kshitijk4poor8d959f965c64
diff --git a/plugins/platforms/feishu/adapter.py b/plugins/platforms/feishu/adapter.py
index df1eceece60..e3dffc94da6 100644
--- a/plugins/platforms/feishu/adapter.py
+++ b/plugins/platforms/feishu/adapter.py
@@ -1725,18 +1725,19 @@ class FeishuAdapter(BasePlatformAdapter):
return SendResult(success=False, error=str(exc))
async def delete_message(self, chat_id: str, message_id: str) -> bool:
- """Delete a bot-posted message so stream-consumer fallback/fresh-final can
- remove a truncated edit bubble instead of leaving it next to the full send.
-
- Feishu has no ``delete_message`` today, so ``_delete_previews`` no-ops and a
- failed finalize-edit + fallback send (#103068) keeps both bubbles.
- """
+ """Delete a bot-posted message (used by stream-consumer preview cleanup)."""
if not self._client or not message_id:
return False
try:
request = self._build_delete_message_request(message_id)
response = await self._run_blocking(self._client.im.v1.message.delete, request)
- return self._response_succeeded(response)
+ if self._response_succeeded(response):
+ return True
+ logger.debug(
+ "[Feishu] Delete of message %s rejected: code=%s msg=%s",
+ message_id, getattr(response, "code", None), getattr(response, "msg", None),
+ )
+ return False
except Exception:
logger.debug("[Feishu] Failed to delete message %s", message_id, exc_info=True)
return False
diff --git a/tests/gateway/test_feishu.py b/tests/gateway/test_feishu.py
index 12f8f7a6ea0..bec73de9bdf 100644
--- a/tests/gateway/test_feishu.py
+++ b/tests/gateway/test_feishu.py
@@ -300,14 +300,6 @@ class TestDeleteMessage(unittest.TestCase):
self.assertTrue(ok)
self.assertEqual(captured["ids"], ["om_preview"])
- def test_delete_message_returns_false_when_disconnected(self):
- from gateway.config import PlatformConfig
- from plugins.platforms.feishu.adapter import FeishuAdapter
-
- adapter = FeishuAdapter(PlatformConfig())
- adapter._client = None
- self.assertFalse(asyncio.run(adapter.delete_message("oc_chat", "om_preview")))
-
class TestAdapterModule(unittest.TestCase):
def test_load_settings_uses_sdk_defaults_for_invalid_ws_reconnect_values(self):