From e3293c007f284f6a5e6db6bd2885f733dc547246 Mon Sep 17 00:00:00 2001 From: samggggflynn <41468846+samggggflynn@users.noreply.github.com> Date: Mon, 18 May 2026 19:59:37 -0700 Subject: [PATCH] fix: add pre_start() to _IncomingHandler for dingtalk SDK compatibility The dingtalk-stream SDK calls pre_start() on every registered handler before opening the WebSocket connection. Without this method, the SDK raises AttributeError and kills the stream connection, causing DingTalk to be unable to connect via Stream Mode. --- gateway/platforms/dingtalk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gateway/platforms/dingtalk.py b/gateway/platforms/dingtalk.py index 06b30db7b04..c77de2f3616 100644 --- a/gateway/platforms/dingtalk.py +++ b/gateway/platforms/dingtalk.py @@ -1395,6 +1395,16 @@ class _IncomingHandler( self._adapter = adapter self._loop = loop + def pre_start(self) -> None: + """No-op pre-start hook required by dingtalk-stream SDK. + + The SDK calls ``pre_start()`` on every registered handler before + opening the WebSocket connection. Without this method, the SDK + raises ``AttributeError: '_IncomingHandler' object has no + attribute 'pre_start'`` and kills the stream connection. + """ + return + async def process(self, message: "CallbackMessage"): """Called by dingtalk-stream (>=0.20) when a message arrives.