hermes-agent/gateway
Hermes Agent 8cf7e80fc5 feat(gateway): auto-reload MCP connections on config change
Add a background _mcp_config_watcher() task to the gateway that polls
config.yaml every 30 seconds and auto-reloads MCP server connections
when the mcp_servers section changes.

This solves the problem where OAuth token refresh cron jobs update
Bearer tokens in config.yaml, but the running gateway keeps using
stale cached credentials until manually restarted.

The CLI already had this via _check_config_mcp_changes() — this ports
the same concept to the async gateway event loop.

Changes:
- GatewayRunner.__init__: initialize _mcp_config_mtime and
  _mcp_config_servers state from current config
- GatewayRunner.start(): launch _mcp_config_watcher as background task
- GatewayRunner._mcp_config_watcher(): async background task that:
  - Uses mtime fast-path to avoid unnecessary YAML reads
  - Deep-compares mcp_servers dict to detect header changes
  - Runs shutdown/discover in executor to avoid blocking event loop
  - Sleeps in 1s increments for responsive shutdown
  - 30s initial delay to let startup finish

Tests: 7 new tests covering no-change skip, header change detection,
non-MCP change skip, server add/remove, shutdown behavior, and
full integration test.
2026-04-12 07:03:50 +00:00
..
builtin_hooks refactor: replace inline HERMES_HOME re-implementations with get_hermes_home() 2026-04-07 10:40:34 -07:00
platforms fix(discord): decouple readiness from slash sync 2026-04-11 19:22:14 -07:00
__init__.py Enhance CLI with multi-platform messaging integration and configuration management 2026-02-02 19:01:51 -08:00
channel_directory.py fix(gateway): derive channel directory platforms from enum instead of hardcoded list (#7450) 2026-04-10 17:27:32 -07:00
config.py feat(gateway): add WeCom callback-mode adapter for self-built apps 2026-04-11 15:22:49 -07:00
delivery.py fix: remove 115 verified dead code symbols across 46 production files 2026-04-10 03:44:43 -07:00
display_config.py feat: per-platform display verbosity configuration (#8006) 2026-04-11 17:20:34 -07:00
hooks.py feat: built-in boot-md hook — run BOOT.md on gateway startup (#3733) 2026-03-29 10:19:54 -07:00
mirror.py chore: remove ~100 unused imports across 55 files (#3016) 2026-03-25 15:02:03 -07:00
pairing.py fix: multiple platform adaptors concurrency 2026-04-06 16:49:54 -07:00
restart.py fix(gateway): address restart review feedback 2026-04-10 21:18:34 -07:00
run.py feat(gateway): auto-reload MCP connections on config change 2026-04-12 07:03:50 +00:00
session.py fix(matrix): replace pickle crypto store with SQLite, fix E2EE decryption (#7981) 2026-04-12 07:24:46 +05:30
session_context.py fix(gateway): add HERMES_SESSION_KEY to session_context contextvars 2026-04-11 15:35:04 -07:00
status.py fix(discord): decouple readiness from slash sync 2026-04-11 19:22:14 -07:00
sticker_cache.py chore: remove ~100 unused imports across 55 files (#3016) 2026-03-25 15:02:03 -07:00
stream_consumer.py feat(gateway): surface natural mid-turn assistant messages in chat platforms 2026-04-11 16:21:39 -07:00