Skip dead and exhausted pool entries in _get_provider_api_key to match prior pool.select() contract

This commit is contained in:
Rod Boev committed 2026-06-20 21:42:51 -04:00
1 parent b3c9bf5ad1
commit 7f7ec57ebd
1 file changed
+7
+7
View File
@@ -1283,6 +1283,13 @@ def _get_provider_api_key(provider_id: str) -> str | None:
return cp_key
# Fallback: try credential pool (e.g. bothub key stored via auth.json)
for entry in _pool_entry_payloads(provider_id):
status = str(entry.get("last_status") or "").strip().lower()
if status == "dead":
continue
if status == "exhausted":
ns = SimpleNamespace(**entry)
if _entry_is_pool_exhausted(ns):
continue
key = str(
entry.get("runtime_api_key")
or entry.get("agent_key")