diff --git a/backend/app/services/openclaw/admin_service.py b/backend/app/services/openclaw/admin_service.py index 0456b86..f0d1229 100644 --- a/backend/app/services/openclaw/admin_service.py +++ b/backend/app/services/openclaw/admin_service.py @@ -350,11 +350,6 @@ class GatewayAdminLifecycleService(OpenClawDBService): ) try: runtime_agents_raw = await openclaw_call("agents.list", config=config) - runtime_sessions_raw = await openclaw_call( - "sessions.list", - {"limit": 500}, - config=config, - ) except OpenClawGatewayError as exc: detail = normalize_gateway_error_message(str(exc)) raise HTTPException( @@ -362,18 +357,12 @@ class GatewayAdminLifecycleService(OpenClawDBService): detail=f"Gateway runtime query failed: {detail}", ) from exc + # sessions.list with any non-trivial limit blocks the gateway's Node.js event + # loop on large session stores, making the gateway unresponsive. The fallback + # key "agent:{id}:main" is the standard format used for every agent, so omitting + # the sessions lookup has no practical effect on matching accuracy. runtime_agents = _as_dict_list(runtime_agents_raw) - runtime_sessions = _as_dict_list(runtime_sessions_raw) - session_by_agent_key: dict[str, str] = {} - for runtime_session in runtime_sessions: - key = runtime_session.get("key") - if not isinstance(key, str): - continue - parts = key.split(":") - if len(parts) < 2 or parts[0] != "agent": - continue - session_by_agent_key[parts[1]] = key existing_agents = await Agent.objects.filter_by(gateway_id=gateway.id).all(self.session) existing_by_session_key = {