The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(connectors): catch only gateway errors around the portal account read
Siddharth Balyane5ebe5d8d7d9
diff --git a/tools/connectors/managed.py b/tools/connectors/managed.pyindex a9ced507e08..3ac11197938 100644--- a/tools/connectors/managed.py+++ b/tools/connectors/managed.py@@ -7,7 +7,7 @@ from typing import Any, Callable, Dict, List, Optional, Tuplefrom tools.connectors.contract import Actor, SettleReason, TargetState, allowedfrom tools.connectors.gateway.config import operation_session_key-from tools.connectors.gateway.errors import RateLimited+from tools.connectors.gateway.errors import RateLimited, ToolGatewayErrorfrom tools.connectors.operation import ConnectionOperation, DetachedOperation, IllegalTransition, Targetfrom tools.connectors.run import Kind, run_operationfrom tools.connectors.targets import HostedTarget, catalog_names, hosted_names, misrouted_to_hosted_error@@ -232,7 +232,7 @@ def _alias_status(targets: list[Target]) -> Optional[dict[str, dict[str, Any]]]:return Nonetry:rows = portal_accounts()- except Exception as exc:+ except ToolGatewayError as exc:logger.debug("connector accounts read for reconnect failed: %s", exc)rows = []return {t.name: {"connected": any(r.get("connector") == t.name and r.get("alias") == t.alias@@ -264,7 +264,7 @@ def _status_result(client: Any, connectors: list[str]) -> str:items = [i for i in items if str(i.get("connector", "")).lower() in wanted]try:rows = portal_accounts()- except Exception as exc:+ except ToolGatewayError as exc:# The account list is extra detail; the connector list alone still answers status.logger.debug("connector accounts for status failed: %s", exc)else:@@ -283,7 +283,7 @@ def _status_result(client: Any, connectors: list[str]) -> str:def _rename_result(target: HostedTarget) -> str:"""Rename the one account of ``target.name`` called ``target.alias`` (or, when unnamed, labelledso) to ``target.to``. Synchronous: no operation and no card."""- from tools.connectors.gateway.errors import GatewayUnavailable, IdempotencyConflict, ToolGatewayError+ from tools.connectors.gateway.errors import GatewayUnavailable, IdempotencyConflictfrom tools.connectors.portal.client import PortalConnectorClientrows = [r for r in portal_accounts() if str(r.get("connector", "")).lower() == target.name]