mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-12-03 15:42:16 +00:00
_drain_polling_connections() awaited polling_req.shutdown() and .initialize() without a timeout. When the getUpdates httpx connection is wedged on a stale CLOSE-WAIT socket, that close can block forever, hanging _handle_polling_network_error (the tracked _polling_error_task). The task never completes, so every escalation path — _schedule_polling_recovery, _probe_pending_updates, the heartbeat verifier — stays gated behind its in-flight guard, the ladder freezes mid-way, _set_fatal_error is never reached, and Restart=always never fires: the gateway is alive but silently dead. Wrap both drain awaits in asyncio.wait_for with a new module-level _DRAIN_TIMEOUT (15.0s, matching _UPDATER_STOP_TIMEOUT), mirroring the existing bounded stop()/start_polling() sites. On timeout the drain logs and continues, so the handler task completes and the ladder always advances toward the fatal-restart escalation. Adds test_reconnect_continues_if_drain_hangs, which wedges the drain and asserts the handler still reaches start_polling within a hard bound. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| adapter.py | ||
| plugin.yaml | ||
| telegram_ids.py | ||
| telegram_network.py | ||