mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
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. |
||
|---|---|---|
| .. | ||
| builtin_hooks | ||
| platforms | ||
| __init__.py | ||
| channel_directory.py | ||
| config.py | ||
| delivery.py | ||
| display_config.py | ||
| hooks.py | ||
| mirror.py | ||
| pairing.py | ||
| restart.py | ||
| run.py | ||
| session.py | ||
| session_context.py | ||
| status.py | ||
| sticker_cache.py | ||
| stream_consumer.py | ||