The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): warn once per stalled own-gateway probe, not every cycle
kshitijk4poore48aa5e2f45a
diff --git a/gateway/run_profile_reconcile.py b/gateway/run_profile_reconcile.pyindex 5853bed6632..29652f31c96 100644--- a/gateway/run_profile_reconcile.py+++ b/gateway/run_profile_reconcile.py@@ -53,6 +53,7 @@ class GatewayProfileReconcileMixin:_served_profile_signatures: Optional[Dict[str, tuple]] = None_profile_reconcile_lock: Optional[asyncio.Lock] = None_profile_own_gateway_warned: Optional[set[str]] = None+ _profile_probe_timeout_warned: Optional[set[str]] = None# ── state helpers ─────────────────────────────────────────────────────────────────────────────@@ -113,7 +114,9 @@ class GatewayProfileReconcileMixin:from gateway.status import live_gateway_pid_for_homeblocked = set()+ timed_out = set()warned = self._profile_own_gateway_warned or set()+ timeout_warned = self._profile_probe_timeout_warned or set()for name in list(current):if name == active or name in known:continue@@ -129,9 +132,12 @@ class GatewayProfileReconcileMixin:timeout=_OWN_GATEWAY_PROBE_TIMEOUT_SECS)except asyncio.TimeoutError:# Unprovable is not "own gateway running": skip it this cycle without- # warning about (or remembering) a gateway that may not exist.- logger.warning("[MULTIPLEX] Own-gateway probe for profile '%s' timed out; "- "not serving it this cycle", name)+ # warning about (or remembering) a gateway that may not exist. Warn once+ # per stall; a peer that stays wedged repeats at DEBUG every cycle.+ timed_out.add(name)+ log = logger.debug if name in timeout_warned else logger.warning+ log("[MULTIPLEX] Own-gateway probe for profile '%s' timed out; "+ "not serving it this cycle", name)del current[name]continueif pid is not None:@@ -141,6 +147,7 @@ class GatewayProfileReconcileMixin:"stop it before the host can serve this profile", name)del current[name]self._profile_own_gateway_warned = blocked+ self._profile_probe_timeout_warned = timed_outsigs = self._served_profile_signatures or {}added = [n for n in current if n not in known and n != active]removed = [n for n in known if n not in current and n != active]diff --git a/tests/gateway/test_multiplex_hot_serve.py b/tests/gateway/test_multiplex_hot_serve.pyindex c171f609292..b0fc7089dd8 100644--- a/tests/gateway/test_multiplex_hot_serve.py+++ b/tests/gateway/test_multiplex_hot_serve.py@@ -154,6 +154,13 @@ async def test_stalled_own_gateway_probe_never_wedges_the_loop_or_serves(tmp_patassert "gamma" not in (runner._profile_own_gateway_warned or set())await asyncio.wait_for(heartbeat, timeout=1.0)+ # A peer that stays wedged must not re-WARN on every 30 s watcher cycle.+ result = await runner.reconcile_served_profiles(reason="watcher")+ assert result["added"] == []+ stalled_warnings = [r for r in caplog.records if r.levelname == "WARNING"+ and "probe for profile 'gamma' timed out" in r.getMessage()]+ assert len(stalled_warnings) == 1+released.set()result = await runner.reconcile_served_profiles(reason="watcher")assert result["added"] == ["gamma"]