fix(gateway): fall back safely without approval identities
This commit is contained in:
1 parent
b481dfea13
commit
f30178e18a
8 files changed
+65
-77
No files matched your search
@@ -8892,6 +8892,7 @@ def get_gateway_caps(base_url: str, api_key: str = "") -> dict:
|
||||
caps = {
|
||||
"approval_events": False,
|
||||
"run_approval_response": False,
|
||||
"approval_identity_v1": False,
|
||||
"capabilities_reachable": False,
|
||||
"probe_error": None,
|
||||
"fetched_at": 0.0,
|
||||
@@ -8909,6 +8910,7 @@ def get_gateway_caps(base_url: str, api_key: str = "") -> dict:
|
||||
features = {}
|
||||
caps["approval_events"] = bool(features.get("approval_events"))
|
||||
caps["run_approval_response"] = bool(features.get("run_approval_response"))
|
||||
caps["approval_identity_v1"] = bool(features.get("approval_identity_v1"))
|
||||
except urllib.error.HTTPError as exc:
|
||||
caps["capabilities_reachable"] = True
|
||||
caps["probe_error"] = f"{type(exc).__name__}: {exc}"
|
||||
@@ -8948,6 +8950,11 @@ def gateway_supports_approval(base_url: str, api_key: str = "") -> bool:
|
||||
return bool(caps.get("approval_events") and caps.get("run_approval_response"))
|
||||
|
||||
|
||||
def gateway_supports_approval_identity_v1(base_url: str, api_key: str = "") -> bool:
|
||||
"""True only when Gateway advertises authoritative approval identities."""
|
||||
return bool(get_gateway_caps(base_url, api_key).get("approval_identity_v1"))
|
||||
|
||||
|
||||
def invalidate_gateway_caps(base_url: str | None = None) -> None:
|
||||
"""Evict capability cache for base_url, or all entries when base_url is None."""
|
||||
with _GATEWAY_CAPS_LOCK:
|
||||
|
||||
Reference in new issue
Block a user