From 81516707129ec2f3c86b16cf45507c4f2df7cfc2 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:02:10 -0700 Subject: [PATCH] fix(mcp): widen discovery lock wait to cover real discovery durations The bounded lock wait was 10 x 0.2s = 2s, but the concurrent-discovery scenario this lock exists for (#62771: hermes serve + gateway spawning every MCP server twice) reports 40-60s discovery rounds. A 2s budget guarantees the loser times out and runs unguarded exactly when the guard matters. Widen to 240 x 0.5s = 120s; fail-soft unguarded fallback and test overrides unchanged. --- tools/mcp_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mcp_tool.py b/tools/mcp_tool.py index dea31592469f..5398700cc4ac 100644 --- a/tools/mcp_tool.py +++ b/tools/mcp_tool.py @@ -4106,8 +4106,8 @@ _LOCK_UNAVAILABLE: Any = object() # sentinel: locking broken/unavailable _MCP_DISCOVERY_LOCK_PATH: Optional[str] = None # resolved lazily # Retry constants for the bounded wait when another process holds the lock. -_MCP_DISCOVERY_LOCK_MAX_RETRIES: int = 10 -_MCP_DISCOVERY_LOCK_RETRY_DELAY_S: float = 0.2 +_MCP_DISCOVERY_LOCK_MAX_RETRIES: int = 240 +_MCP_DISCOVERY_LOCK_RETRY_DELAY_S: float = 0.5 class _LockCookie: