From 7f7ec57ebdc76f8aab11ba3ca6afc8cf850f988e Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Sat, 20 Jun 2026 21:42:51 -0400 Subject: [PATCH] Skip dead and exhausted pool entries in _get_provider_api_key to match prior pool.select() contract --- api/providers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/providers.py b/api/providers.py index bbc588c0..dc1ec76f 100644 --- a/api/providers.py +++ b/api/providers.py @@ -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")