The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(nous): tell a governed org its model choice is restricted
Mariano Nicolinic38d62aefe9f
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.pyindex f97f91bca52..eebbc5609c9 100644--- a/hermes_cli/auth.py+++ b/hermes_cli/auth.py@@ -9438,6 +9438,11 @@ def _login_nous(args, pconfig: ProviderConfig) -> None:)_portal = auth_state.get("portal_base_url", "")if model_ids:+ from hermes_cli.nous_account import nous_policy_notice++ _policy_notice = nous_policy_notice()+ if _policy_notice:+ print(_policy_notice)print(f"Showing {len(model_ids)} curated models — use \"Enter custom model name\" for others.")selected_model = _prompt_model_selection(model_ids, pricing=pricing,diff --git a/hermes_cli/model_setup_flows.py b/hermes_cli/model_setup_flows.pyindex 90075912a1e..94896921591 100644--- a/hermes_cli/model_setup_flows.py+++ b/hermes_cli/model_setup_flows.py@@ -581,6 +581,11 @@ def _model_flow_nous(config, current_model="", args=None):print(unavailable_message or f"Upgrade at {_url} to access paid models.")return+ from hermes_cli.nous_account import nous_policy_notice++ _policy_notice = nous_policy_notice()+ if _policy_notice:+ print(_policy_notice)print(f'Showing {len(model_ids)} curated models — use "Enter custom model name" for others.')diff --git a/hermes_cli/nous_account.py b/hermes_cli/nous_account.pyindex 4c3bf0a51f7..c63d090fc40 100644--- a/hermes_cli/nous_account.py+++ b/hermes_cli/nous_account.py@@ -427,6 +427,27 @@ def nous_policy_present() -> Optional[bool]:return None+def nous_policy_notice() -> str:+ """A one-line notice for an org that restricts model choice, else ``""``.++ Under the gateway's policy filter a blocked model is omitted rather than+ marked, which reads as "Hermes does not support this" instead of "your org+ disallows it". This says which it is without enumerating anything: model+ policy is an allowlist, so an org that admits a handful of models blocks+ the whole rest of the catalog, and listing those would be a worse UI than+ omitting them.++ Silent unless the claim is explicitly true — absent means an older mint,+ not an unrestricted org.+ """+ if nous_policy_present() is not True:+ return ""+ return (+ "Your organization restricts which models are available — "+ "models outside its policy are not listed."+ )++def _fresh_account_info(*,state: dict[str, Any],diff --git a/tests/hermes_cli/test_nous_policy_filter.py b/tests/hermes_cli/test_nous_policy_filter.pyindex a225d560dc5..edb7e6dc201 100644--- a/tests/hermes_cli/test_nous_policy_filter.py+++ b/tests/hermes_cli/test_nous_policy_filter.py@@ -157,3 +157,30 @@ class TestNousPolicyPresent:def test_undecodable_token_is_unknown(self, monkeypatch):self._patch_token(monkeypatch, "not-a-jwt")assert nous_policy_present() is None+++class TestNousPolicyNotice:+ """A governed org is told its choice is restricted, rather than left to+ read an omitted model as one Hermes does not support."""++ def _patch(self, monkeypatch, present):+ monkeypatch.setattr(account_mod, "nous_policy_present", lambda: present)++ def test_shows_a_line_for_a_governed_org(self, monkeypatch):+ self._patch(monkeypatch, True)+ assert "restricts which models" in account_mod.nous_policy_notice()++ @pytest.mark.parametrize("present", [False, None])+ def test_silent_otherwise(self, monkeypatch, present):+ """Absent is an older mint, not an unrestricted org — either way there+ is nothing truthful to say."""+ self._patch(monkeypatch, present)+ assert account_mod.nous_policy_notice() == ""++ def test_names_no_models(self, monkeypatch):+ """Policy is an allowlist, so the blocked set is most of the catalog;+ the notice must not try to enumerate it."""+ self._patch(monkeypatch, True)+ notice = account_mod.nous_policy_notice()+ assert "/" not in notice, f"looks like it names a model: {notice}"+ assert len(notice.splitlines()) == 1diff --git a/tests/hermes_cli/test_nous_policy_surfaces.py b/tests/hermes_cli/test_nous_policy_surfaces.pyindex e279162b0ce..e59974c511a 100644--- a/tests/hermes_cli/test_nous_policy_surfaces.py+++ b/tests/hermes_cli/test_nous_policy_surfaces.py@@ -217,3 +217,23 @@ class TestNousPrefetch:)slugs = ms._collect_authed_provider_slugs({}, {"nous": list(CURATED)}, [])assert "nous" not in slugs+++class TestPolicyNoticeIsShown:+ """The notice reaches the two flows where a user picks a model."""++ def test_login_prints_it(self, monkeypatch, tmp_path, policy, capsys):+ import hermes_cli.nous_account as account_mod++ monkeypatch.setattr(account_mod, "nous_policy_present", lambda: True)+ TestLoginNous()._run(monkeypatch, tmp_path)+ assert "restricts which models" in capsys.readouterr().out++ def test_login_silent_for_an_ungoverned_org(+ self, monkeypatch, tmp_path, no_policy, capsys+ ):+ import hermes_cli.nous_account as account_mod++ monkeypatch.setattr(account_mod, "nous_policy_present", lambda: False)+ TestLoginNous()._run(monkeypatch, tmp_path)+ assert "restricts which models" not in capsys.readouterr().out