fix(mcp): reload args on config.yaml changes (#72839) - #72864
webtecnica wants to merge 4 commits into
Conversation
|
Thanks for isolating the concurrent registration race. The narrow Problems
Suggested changes
Automated hermes-sweeper review. |
SummaryOne PR addresses issue #72839. #72864 adds config-digest-based MCP replacement and concurrent-registration guards, but the diff does not establish safe cleanup of stale subprocesses and does not address the reported Related pull requests
Suggested consolidationKeep #72864 open with a salvage path: retain the two Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I72839(["issue #72839 (open)"])
P72864["PR #72864 (open)"]
P72864 -->|best fix| I72839
class I72839 open
class P72864 open
class P72864 best
class P72864 target
click I72839 "https://github.com/NousResearch/hermes-agent/issues/72839"
click P72864 "https://github.com/NousResearch/hermes-agent/pull/72864"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 22 kB of PR diffs, 3 kB of issue/PR text, 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Summary
Fixes #72839: MCP servers cached their startup config in
_configon theMCPServerTaskbut never checked whether the config had changed whenregister_mcp_servers()was called again. Any edit toconfig.yaml(e.g. changing--browser firefoxto--browser chromiumfor@playwright/mcp) was silently ignored — the old server process survived all reconnect attempts and ran alongside a duplicate process spawned with the new args.Root cause
register_mcp_servers()filtered out every server already listed in_servers:Because an already-connected server was never removed from
_servers, config edits were invisible until a full process restart. During restart the old orphan subprocess persisted because no PID check discovered it.Fix
Config digest —
_compute_config_digest()hashes the config fields that affect the spawned transport/subprocess (command,args,env,url,headers,transport,auth, timeouts,sampling/elicitationconfigs).Store digest on startup —
MCPServerTask.run()stores_config_digestafter assigningself._config.Detect and restart —
register_mcp_servers()now compares each already-connected server's stored digest against the current config digest. When they diverge:_servers_run_stdio's existing_kill_orphaned_mcp_children())new_serversconnection path, which picks up the fresh configAlso fixes a related gap:
register_mcp_servers()now checks_server_connectingto prevent duplicate spawns from concurrent calls (regression #72818).Testing
_config_digest(returnsNone→ comparison skipped)_run_stdiocovers the case where the old subprocess is still alive when the new one spawnsRelated