Skip to content

fix(update): warn when gateway is running before hermes update - #23793

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/update-gateway-running-check
Closed

fix(update): warn when gateway is running before hermes update#23793
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/update-gateway-running-check

Conversation

@ygd58

@ygd58 ygd58 commented May 11, 2026

Copy link
Copy Markdown
Contributor

Problem

Running hermes update while the gateway is active can leave Telegram polling in a broken state. Old process holds the bot token, new binary cannot re-bind it.

Fix

Add a pre-update gateway check: if running PIDs are found, warn the user and prompt to confirm. Recommended flow: hermes gateway stop → hermes update → hermes gateway start.

Fixes #23783 (partial)

Updating in-place while the gateway holds open connections (e.g.
Telegram polling) can leave the bot token in a stale state and break
messaging platforms after the update (issue NousResearch#23783).

Add a pre-update check: if gateway PIDs are found, warn the user and
prompt to confirm before proceeding. Recommended flow is:
  hermes gateway stop → hermes update → hermes gateway start

Fixes NousResearch#23783 (partial - prevents the condition; does not recover
already-broken Telegram polling state)
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels May 11, 2026
@teknium1

Copy link
Copy Markdown
Contributor

This looks implemented on current main via the newer update/restart and Telegram conflict-recovery path.

Automated hermes-sweeper review evidence:

  • hermes_cli/main.py:8898 now has a post-update gateway restart block for all running gateways, because the code update is shared across profiles.
  • hermes_cli/main.py:9299 handles manual non-service gateways: it finds running gateway PIDs, relaunches profile gateways where possible, signals old processes, waits briefly for exit, and prints manual restart guidance for unmapped processes.
  • hermes_cli/gateway.py:557 documents find_gateway_pids(..., all_profiles=True) specifically for hermes update, since updating code affects every profile.
  • gateway/platforms/telegram.py:1074 recovers the post-update Telegram polling-conflict case where the old long-poll session is still held server-side.
  • gateway/platforms/telegram.py:1703 clears stale webhook state before polling and routes polling conflicts into that recovery path.
  • The Telegram conflict recovery landed in f260aa6dc0fd6ecafb36964c33a39276fdd8da0a and is contained in v2026.5.28 and later tags.

The exact UX from this PR — warning before update and asking the user to manually stop/start — is not the path main chose, but the underlying bug this PR was trying to avoid is covered by the current automatic restart/conflict-recovery behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram bot token already in use after hermes update — gateway fails to start, Telegram broken afterwards

3 participants