Files
hermes-agent/tools
Halldrix ef50bb344c fix(mcp): cap discovery pass timeout and derive lock waiter budget from it
A bounded discovery pass runs ceil(N/cap) 120s waves, so a fleet of slow
servers now legitimately occupies the cross-process discovery lock past the
120s the unbounded scatter used to need. The lock waiter (240 x 0.5s) would
give up mid-pass, fail over, and discover unguarded beside the still-connecting
holder - respawning the duplicate stdio trees this PR removes (#117373 review).

Cap the pass at _MCP_DISCOVERY_PASS_MAX_SEC = 300 so one stuck connect cannot
pin the calling thread (and the lock) for the tens of minutes 120*waves allows,
and derive _MCP_DISCOVERY_LOCK_MAX_RETRIES from the same ceiling (320s waiter
budget > 300s pass) so the waiter always outlasts a legitimate holder.
2026-09-21 01:44:16 -07:00
..