Repository navigation
Closed
hashbender/hermes-agent
#263Labels
P2Medium — degraded but workaround existsMedium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adapterTelegram bot adaptertype/bugSomething isn't workingSomething isn't working
Description
Bug: Telegram gateway adapter fails to connect for some valid bot tokens
Environment
- Hermes version: 0.16.0 (2026.6.5) · upstream 2c174bc
- Python: 3.11.15
- OS: Ubuntu 25.04
- Repo: https://github.com/NousResearch/hermes-agent.git (commit cc14b74)
- Gateway running via: systemd units (
hermes-gateway-<profile>.service)
Reproduction
- Created 3 persona profiles under
~/.hermes/profiles/:grace,lynn,stephen - Each profile has:
- Valid Telegram bot token (verified via
curl https://api.telegram.org/bot<token>/getMe) GATEWAY_ALLOW_ALL_USERS=truein.env- Persona middleware configured (
persona.active_persona,external_middleware_url)
- Valid Telegram bot token (verified via
- Grace connects and works correctly in group chat
-5338831834 - Lynn and Stephen both fail with identical timeout error
Expected Behavior
Gateway initializes Telegram adapter and connects within ~5 seconds, same as Grace.
Actual Behavior
ERROR gateway.run: ✗ telegram error: telegram connect timed out after 30s
WARNING gateway.run: No adapter could be created for any of the 1 configured platform(s)
The gateway process starts, but the Telegram adapter never establishes a connection.
Evidence
Grace (working):
- Token:
8652118103:***(46 chars) - Status: Connects successfully, responds in group
.envhasTELEGRAM_HOME_CHANNEL=8948173366
Lynn (failing):
- Token:
8819007439:***(46 chars, pure ASCII) curl getMereturns valid user object.envhasTELEGRAM_HOME_CHANNEL=8948173366(added as workaround)- Status:
telegram connect timed out after 30s
Stephen (failing):
- Token:
8845420023:***(46 chars, pure ASCII) curl getMereturns valid user object.envhasTELEGRAM_HOME_CHANNEL=8948173366(added as workaround)- Status:
telegram connect timed out after 30s
Configuration (identical pattern across all three)
# config.yaml
model:
default: gemma3:4b
provider: ollama
providers:
ollama:
host: http://localhost:11434
persona:
active_persona: <profile>-v1
disable_external_middleware: false
external_middleware_url: http://localhost:8100
gateway:
platforms:
telegram:
enabled: true# .env (all three profiles)
TELEGRAM_BOT_TOKEN=<valid...>
GATEWAY_ALLOW_ALL_USERS=true
TELEGRAM_HOME_CHANNEL=8948173366Logs
ERROR gateway.run: ✗ telegram error: telegram connect timed out after 30s
WARNING gateway.run: No adapter could be created for any of the 1 configured platform(s)
WARNING gateway.run: Gateway started with no connected platforms
WARNING gateway.run: Reconnect telegram error: telegram connect timed out after 30s, next retry in 60s
Workaround
Grace profile works identically with the same config pattern. The difference appears to be internal to the Telegram client initialization for certain bot tokens or profile configurations.
Suggested Investigation
- Telegram client adapter initialization in
gateway/telegram.pyor equivalent - Why
getMesucceeds via direct curl but adapter connect times out - Difference in initialization path between working (Grace) and failing (Lynn/Stephen) profiles
Metadata
Metadata
Assignees
Labels
P2Medium — degraded but workaround existsMedium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adapterTelegram bot adaptertype/bugSomething isn't workingSomething isn't working
Activity
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(email): defer catch-up off the connect budget to stop 30s reconne…
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path
fix(telegram): defer post-connect housekeeping off the connect path