Bug Description
The Telegram gateway process becomes unresponsive after running for an extended period (observed: ~24+ hours). Messages sent to the bot in Telegram are not received, and the integration stops responding entirely.
Root Cause
The httpx connection pool used for Telegram Bot API requests becomes exhausted. The gateway log shows:
Pool timeout: All connections in the connection pool are occupied
Over time, connections to api.telegram.org are opened but not properly released back to the pool. Once all pool slots are occupied, new requests (including getUpdates polling) hang indefinitely, making the gateway non-functional.
Steps to Reproduce
- Start the gateway:
hermes gateway run --replace
- Let it run for 24+ hours with normal Telegram activity
- The gateway stops responding to Telegram messages
- Log shows pool timeout errors
Current Workaround
Kill and restart the gateway process:
ps aux | grep "hermes_cli.main gateway" | grep -v grep
kill <PID>
cd ~/.hermes/hermes-agent && venv/bin/python -m hermes_cli.main gateway run --replace &
Expected Behavior
The gateway should handle connection pooling robustly:
- Release connections back to the pool after each request
- Configure appropriate pool limits and timeouts for long-running operation
- Optionally implement a health check / watchdog that detects a stuck gateway and auto-recovers
Actual Behavior
Gateway hangs silently after ~24h. No automatic recovery. Requires manual kill + restart.
Environment
- OS: Ubuntu on WSL2 (Windows 11)
- Hermes Agent: latest (installed via hermes-agent setup)
- Python: venv under ~/.hermes/hermes-agent/
- Telegram platform: long polling mode
Bug Description
The Telegram gateway process becomes unresponsive after running for an extended period (observed: ~24+ hours). Messages sent to the bot in Telegram are not received, and the integration stops responding entirely.
Root Cause
The httpx connection pool used for Telegram Bot API requests becomes exhausted. The gateway log shows:
Over time, connections to
api.telegram.orgare opened but not properly released back to the pool. Once all pool slots are occupied, new requests (includinggetUpdatespolling) hang indefinitely, making the gateway non-functional.Steps to Reproduce
hermes gateway run --replaceCurrent Workaround
Kill and restart the gateway process:
Expected Behavior
The gateway should handle connection pooling robustly:
Actual Behavior
Gateway hangs silently after ~24h. No automatic recovery. Requires manual kill + restart.
Environment