diff --git a/hermes_cli/model_switch_providers.py b/hermes_cli/model_switch_providers.py index 0d1c408b0f..00014ab4e2 100644 --- a/hermes_cli/model_switch_providers.py +++ b/hermes_cli/model_switch_providers.py @@ -416,7 +416,9 @@ def _nous_picker_model_ids(curated: dict, force_fresh_nous_tier: bool) -> list: union_with_portal_paid_recommendations, ) from hermes_cli.auth import get_provider_auth_state - pricing = get_pricing_for_provider("nous") or {} + # Cache-only: both Portal unions below discard the pricing map (``model_ids, _ = ...``); + # only the appended ids matter, so a live catalog fetch here buys nothing but latency. + pricing = get_pricing_for_provider("nous", cached_only=True) or {} try: portal = (get_provider_auth_state("nous") or {}).get("portal_base_url", "") or "" except Exception: diff --git a/tests/hermes_cli/test_nous_picker_pricing_cached_only.py b/tests/hermes_cli/test_nous_picker_pricing_cached_only.py new file mode 100644 index 0000000000..12a5609ecd --- /dev/null +++ b/tests/hermes_cli/test_nous_picker_pricing_cached_only.py @@ -0,0 +1,22 @@ +"""The Nous picker row never starts a pricing fetch: the picker only uses the ids the Portal +unions append, and a cold pricing cache must not hold the picker open (salvage of #102099).""" + +import hermes_cli.models_pricing as mp +from hermes_cli import model_switch_providers as msp + + +def test_nous_picker_model_ids_reads_pricing_cache_only(monkeypatch): + seen: list[bool] = [] + + def fake_pricing(provider, *, force_refresh=False, cached_only=False): + seen.append(cached_only) + return {} + + monkeypatch.setattr(mp, "get_pricing_for_provider", fake_pricing) + # Keep the sibling Portal calls off the network; only the pricing call shape is under test. + monkeypatch.setattr("hermes_cli.models.check_nous_free_tier", lambda **kw: False) + monkeypatch.setattr("hermes_cli.models.fetch_nous_recommended_models", lambda *a, **kw: None) + monkeypatch.setattr(mp, "nous_policy_allowed_ids", lambda **kw: None) + + assert msp._nous_picker_model_ids({"nous": ["nous/a"]}, False) == ["nous/a"] + assert seen == [True]