The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): reuse utils.file_signature for the pairing cache key
kshitijk4poorb3a1900e72a1
diff --git a/gateway/pairing.py b/gateway/pairing.pyindex 9cd80007a92..c009aa9d5d9 100644--- a/gateway/pairing.py+++ b/gateway/pairing.py@@ -20,7 +20,7 @@ from typing import Optionalfrom gateway.whatsapp_identity import expand_whatsapp_aliases, normalize_whatsapp_identifierfrom hermes_constants import get_default_hermes_root, get_hermes_dir, get_hermes_home-from utils import atomic_json_write+from utils import atomic_json_write, file_signaturelogger = logging.getLogger(__name__)@@ -379,7 +379,7 @@ class PairingStore:# fstat identifies the actual opened file even during atomic replacement.with path.open("rb") as stream:st = os.fstat(stream.fileno())- key = (st.st_dev, st.st_ino, st.st_mtime_ns, st.st_ctime_ns, st.st_size)+ key = (st.st_dev, *file_signature(st))cached = self._approved_cache.get(platform)if cached is not None and cached[0] == key:return cached[1]diff --git a/gateway/platforms/api_server.py b/gateway/platforms/api_server.pyindex bcbb9c0c8ac..a418ee56250 100644--- a/gateway/platforms/api_server.py+++ b/gateway/platforms/api_server.py@@ -2646,9 +2646,7 @@ class APIServerAdapter(OpenAICompatRoutesMixin, BasePlatformAdapter):store = self._browser_control_artifacts.get(profile_key)if store is not None:return store- lock = self._browser_control_artifact_locks.get(profile_key)- if lock is None:- lock = self._browser_control_artifact_locks.setdefault(profile_key, asyncio.Lock())+ lock = self._browser_control_artifact_locks.setdefault(profile_key, asyncio.Lock())async with lock:store = self._browser_control_artifacts.get(profile_key)if store is not None: