Skip to content

The agent that grows with you

fix(telegram): name the actual stall in the polling-stall fatal message

kshitijk4poor1a51cedc0bbc
diff --git a/plugins/platforms/telegram/adapter.py b/plugins/platforms/telegram/adapter.py
index 07891cc2c05..13f5bde82a5 100644
--- a/plugins/platforms/telegram/adapter.py
+++ b/plugins/platforms/telegram/adapter.py
@@ -2142,8 +2142,8 @@ class TelegramAdapter(BasePlatformAdapter):
# Not a retry: no counter bump, no backoff, no in-place stop/drain. The supervisor's rebuild
# runs disconnect(), which performs the same bounded updater.stop() and app.shutdown().
message = (
- "Telegram polling stall confirmed (getUpdates made no progress); "
- "rebuilding the adapter instead of reusing an Updater whose long-poll action did not quiesce."
+ "Telegram polling stall confirmed (%s); rebuilding the adapter instead of reusing "
+ "a wedged Updater/dispatcher in place." % _redact_telegram_error_text(error)
)
await self._go_fatal_network(message, "[%s] %s (rebuilding adapter via supervisor)", self.name, message)
return
diff --git a/tests/gateway/test_telegram_ingress_dispatch_recovery.py b/tests/gateway/test_telegram_ingress_dispatch_recovery.py
index 649c7133f12..7067f25c6d3 100644
--- a/tests/gateway/test_telegram_ingress_dispatch_recovery.py
+++ b/tests/gateway/test_telegram_ingress_dispatch_recovery.py
@@ -130,6 +130,7 @@ async def test_dispatch_stall_marks_degraded_and_goes_fatal():
await task
assert adapter.has_fatal_error
assert adapter.fatal_error_retryable is True
+ assert "PTB dispatcher made no progress" in adapter.fatal_error_message
adapter._notify_fatal_error.assert_awaited_once()
adapter._mark_degraded.assert_called_once()
updater.start_polling.assert_not_awaited()