Skip to content

The agent that grows with you

fix(gateway): report a timed-out own-gateway probe as a timeout, not a live gateway

kshitijk4poorb8027e195ccc
diff --git a/gateway/run_profile_reconcile.py b/gateway/run_profile_reconcile.py
index 59036ccef7d..5853bed6632 100644
--- a/gateway/run_profile_reconcile.py
+++ b/gateway/run_profile_reconcile.py
@@ -128,10 +128,12 @@ class GatewayProfileReconcileMixin:
self._run_housekeeping_in_executor(live_gateway_pid_for_home, current[name]),
timeout=_OWN_GATEWAY_PROBE_TIMEOUT_SECS)
except asyncio.TimeoutError:
- # Unprovable this cycle must read as blocked: the multiplexer never races
- # a possibly-live own gateway. Next cycle probes again.
- logger.debug("Own-gateway probe for profile '%s' stalled; treating as blocked", name)
- pid = -1
+ # 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)
+ del current[name]
+ continue
if pid is not None:
blocked.add(name)
if name not in warned:
diff --git a/tests/gateway/test_multiplex_hot_serve.py b/tests/gateway/test_multiplex_hot_serve.py
index 59b52910262..c171f609292 100644
--- a/tests/gateway/test_multiplex_hot_serve.py
+++ b/tests/gateway/test_multiplex_hot_serve.py
@@ -148,7 +148,10 @@ async def test_stalled_own_gateway_probe_never_wedges_the_loop_or_serves(tmp_pat
result = await asyncio.wait_for(runner.reconcile_served_profiles(reason="watcher"), timeout=2.0)
assert result["added"] == []
assert _served_record(home) == ["default", "alpha"]
- assert len([r for r in caplog.records if "still runs its own gateway" in r.message]) == 1
+ messages = [r.getMessage() for r in caplog.records]
+ assert [m for m in messages if "probe for profile 'gamma' timed out" in m]
+ assert not [m for m in messages if "still runs its own gateway" in m]
+ assert "gamma" not in (runner._profile_own_gateway_warned or set())
await asyncio.wait_for(heartbeat, timeout=1.0)
released.set()