The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(providers): a models.dev-keyed profile overlay labels its picker row with display_name
Teknium2ced575ec679
diff --git a/hermes_cli/providers.py b/hermes_cli/providers.pyindex 3d57e4a2e01..d87a6fff2a1 100644--- a/hermes_cli/providers.py+++ b/hermes_cli/providers.py@@ -221,15 +221,15 @@ def normalize_provider(name: str, overlay_profiles: Optional[list] = None) -> stdef _get_overlay(canonical: str) -> tuple[Optional[HermesOverlay], str]:- """``(overlay, label)`` for a canonical id: the static table, else a profile's ``provider_overlay``- (a profile labels its own id; a models.dev id keeps the catalog spelling)."""+ """``(overlay, label)`` for a canonical id: the static table, else a profile's ``provider_overlay``,+ labelled with the profile's ``display_name`` also when keyed by its models.dev id: without a+ models.dev catalog (offline, blocked) that label is the one picker rows and headings show."""if canonical in HERMES_OVERLAYS:return HERMES_OVERLAYS[canonical], _LABEL_OVERRIDES.get(canonical, canonical)prof = _overlay_profile(canonical)if prof is None or _profile_overlay_key(prof) != canonical:return None, canonical- label = (prof.display_name or canonical) if canonical == prof.name else canonical- return HermesOverlay(**prof.provider_overlay), _LABEL_OVERRIDES.get(canonical, label)+ return HermesOverlay(**prof.provider_overlay), _LABEL_OVERRIDES.get(canonical, prof.display_name or canonical)def is_actual_route(provider: str = "", base_url: str = "") -> bool:diff --git a/tests/hermes_cli/test_provider_table_placement.py b/tests/hermes_cli/test_provider_table_placement.pyindex c57a9825b49..2da0f4da72d 100644--- a/tests/hermes_cli/test_provider_table_placement.py+++ b/tests/hermes_cli/test_provider_table_placement.py@@ -122,3 +122,24 @@ def test_profile_models_dev_id_resolves_at_lookup_time(monkeypatch):assert md._models_dev_to_hermes_ids("zz-catalog") == ["zz-hosted"]assert md.models_dev_provider_map() == {"zz-hosted": "zz-catalog"}assert md.PROVIDER_TO_MODELS_DEV == {} # never merged into the static dict+++def test_models_dev_keyed_overlay_row_keeps_the_profile_slug_and_label_offline(monkeypatch):+ """A profile whose overlay is keyed by its models.dev id lists under its own name and display_name+ when no models.dev catalog is at hand (offline, blocked): not under the catalog id."""+ import agent.models_dev as md+ from hermes_cli import providers as prov+ from hermes_cli.model_switch import list_authenticated_providers++ hosted = ProviderProfile(+ name="zz-hosted", aliases=("zz-hosted-alias",), display_name="ZZ Hosted", models_dev_id="zz-catalog",+ overlay_aliases=("zzh",), provider_overlay={"extra_env_vars": ("ZZ_HOSTED_TOKEN",)})+ _use_profiles(monkeypatch, hosted)+ monkeypatch.setattr(md, "_MODELS_DEV_TO_PROVIDER", None)+ monkeypatch.setattr(md, "fetch_models_dev", lambda *a, **k: {})+ monkeypatch.setattr(prov, "_models_dev_info", lambda canonical, allow_network=True: None)+ monkeypatch.setenv("ZZ_HOSTED_TOKEN", "zz-test-token")++ assert prov.get_label("zz-hosted") == prov.get_label("zzh") == "ZZ Hosted"+ rows = [r for r in list_authenticated_providers(current_provider="zz-catalog") if "zz" in r["slug"]]+ assert [(r["slug"], r["name"], r["is_current"]) for r in rows] == [("zz-hosted", "ZZ Hosted", True)]