fix(model_picker): detect mapped-provider auth-store credentials
This commit is contained in:
@@ -990,6 +990,14 @@ def list_authenticated_providers(
|
||||
|
||||
# Check if any env var is set
|
||||
has_creds = any(os.environ.get(ev) for ev in env_vars)
|
||||
if not has_creds:
|
||||
try:
|
||||
from hermes_cli.auth import _load_auth_store
|
||||
store = _load_auth_store()
|
||||
if store and hermes_id in store.get("credential_pool", {}):
|
||||
has_creds = True
|
||||
except Exception:
|
||||
pass
|
||||
if not has_creds:
|
||||
continue
|
||||
|
||||
|
||||
@@ -81,3 +81,22 @@ def test_kilo_overlay_uses_hermes_slug():
|
||||
|
||||
kilo_mdev = next((p for p in providers if p["slug"] == "kilo"), None)
|
||||
assert kilo_mdev is None, "kilo slug should not appear (resolved to kilocode)"
|
||||
|
||||
|
||||
|
||||
def test_mapped_provider_credential_pool_visibility(monkeypatch):
|
||||
"""Mapped providers should appear when credentials live only in auth-store credential_pool."""
|
||||
monkeypatch.setattr("agent.models_dev.fetch_models_dev", lambda: {"google-ai-studio": {"env": ["GEMINI_API_KEY"]}})
|
||||
monkeypatch.setattr("agent.models_dev.PROVIDER_TO_MODELS_DEV", {"gemini": "google-ai-studio"})
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.auth._load_auth_store",
|
||||
lambda: {"providers": {}, "credential_pool": {"gemini": {"token": "fake"}}},
|
||||
)
|
||||
monkeypatch.delenv("GEMINI_API_KEY", raising=False)
|
||||
|
||||
providers = list_authenticated_providers(current_provider="gemini")
|
||||
|
||||
gemini = next((p for p in providers if p["slug"] == "gemini"), None)
|
||||
assert gemini is not None, "gemini should appear when auth-store credential_pool has creds"
|
||||
assert gemini["is_current"] is True
|
||||
assert gemini["total_models"] > 0
|
||||
|
||||
Reference in New Issue
Block a user