Files
hermes-agent/plugins
Teknium df1610f4ac fix(gateway): drain stops inbound fetchers before withdrawing message handlers
drain_gateway_runtime set every adapter's handler to None while Telegram's
getUpdates long-poll and Slack's Socket Mode kept receiving: each update they
acked in the drain window hit handle_message's handler-less drop and was never
redelivered (live: a DM sent during a SIGTERM drain was logged as dropped and
never answered, even after the reboot).

The drain now calls an optional adapter seam, stop_inbound(), first (every
profile's adapters; a failure logs and the disconnect retries it). Telegram
stops the updater and fences the polling lifecycle so the reconnect ladder
reads it as teardown; Slack closes Socket Mode with _running=False so the
watchdog cannot reconnect. Egress stays up for admitted work. Unfetched
updates stay on the platform and are answered after the restart.

Telegram's method lives in telegram_held_inbound.py; Slack's in a new
adapter_socket_lifecycle.py mixin (with _cancel_socket_watchdog moved out) so
neither over-cap adapter grows.

Fixes #143122

Co-authored-by: liuhao1024 <liuhao1024@users.noreply.github.com>
2026-11-10 13:28:59 -08:00
..