The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(credential_pool): unpack the tuple in next_available_at's gate
kshitijk4poor82019e7c1b2d
diff --git a/agent/credential_pool.py b/agent/credential_pool.pyindex 3d1742e7825..1022665087c 100644--- a/agent/credential_pool.py+++ b/agent/credential_pool.py@@ -642,7 +642,8 @@ class CredentialPool:``_available_entries`` caller (see the comment on ``has_available``)."""with self._lock:- if self._available_entries():+ available, _pending = self._available_entries()+ if available:return Nonecandidates: List[float] = []for entry in self._entries:diff --git a/tests/run_agent/test_reset_aware_primary_restore.py b/tests/run_agent/test_reset_aware_primary_restore.pyindex a97dac3d5a3..efc071e996f 100644--- a/tests/run_agent/test_reset_aware_primary_restore.py+++ b/tests/run_agent/test_reset_aware_primary_restore.py@@ -203,9 +203,23 @@ class TestNextAvailableAt:original = pool._available_entriesdef _probe(**kwargs):- held["locked"] = not pool._lock.acquire(blocking=False)- if not held["locked"]:- pool._lock.release()+ # self._lock is an RLock (deferred-refresh mutations self-lock),+ # so a same-thread non-blocking acquire always succeeds; probe+ # ownership from a helper thread instead.+ import threading as _t++ blocked = _t.Event()++ def _try():+ if not pool._lock.acquire(blocking=False):+ blocked.set()+ else:+ pool._lock.release()++ worker = _t.Thread(target=_try)+ worker.start()+ worker.join(timeout=5)+ held["locked"] = blocked.is_set()return original(**kwargs)pool._available_entries = _probe