diff --git a/gateway/run.py b/gateway/run.py index ddb7de0e18516..125185aeaa816 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -7270,6 +7270,12 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew "config": platform_config, "attempts": 0, "next_retry": time.monotonic(), + "credential_claim": self._adapter_credential_claim( + adapter.platform, adapter + ), + "listener_claim": self._adapter_listener_claim( + adapter.platform, adapter + ), } logger.info( "%s queued for background reconnection", diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.py index 59da0a5a089bc..eea8e316ff796 100644 --- a/plugins/platforms/telegram/adapter.py +++ b/plugins/platforms/telegram/adapter.py @@ -4318,10 +4318,19 @@ class TelegramAdapter(BasePlatformAdapter): via ``_consume_abandoned_task``. """ task = asyncio.ensure_future(awaitable) - if timeout <= 0: - done, _pending = await asyncio.wait({task}) - else: - done, _pending = await asyncio.wait({task}, timeout=timeout) + try: + if timeout <= 0: + done, _pending = await asyncio.wait({task}) + else: + done, _pending = await asyncio.wait({task}, timeout=timeout) + except asyncio.CancelledError: + # Outer cancellation (e.g. the fatal handler's outer timeout) must + # not orphan the inner task — asyncio.wait does NOT cancel its + # futures when itself cancelled (#80598). Mirror the pattern used + # by GatewayRunner._await_adapter_cleanup_with_timeout. + task.cancel() + task.add_done_callback(_consume_abandoned_task) + raise if task in done: # Intentional cancels (heartbeat / identity / lifecycle) surface as # CancelledError — swallow so disconnect keeps advancing.