The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(nous): treat "takes no reasoning parameter" as a definitive no
Brooklyn Nicholsonb4f978d983b2
diff --git a/hermes_cli/inventory.py b/hermes_cli/inventory.pyindex 47ca84a607f..d122213be65 100644--- a/hermes_cli/inventory.py+++ b/hermes_cli/inventory.py@@ -440,7 +440,10 @@ def _apply_capabilities(rows: list[dict]) -> None:Aggregators that publish per-model reasoning detail add`can_disable_reasoning`, False on reasoning-mandatory routes whose upstreamanswers a disable with HTTP 400. Omitted when the catalog doesn't say,- which the UI reads as "no restriction known".+ which the UI reads as "no restriction known". Such a catalog also overrides+ `reasoning` itself when it reports a route that takes no reasoning+ parameter — a definitive negative from the provider actually serving the+ model outranks the models.dev inference.The catalog's `supported_efforts` list is deliberately NOT forwarded: itunder-reports. The Portal accepts and honors levels a route doesn't@@ -480,7 +483,12 @@ def _apply_capabilities(rows: list[dict]) -> None:detail = read_reasoning_catalog(model)except Exception:detail = None- if detail:+ if detail and not detail.get("supports_reasoning"):+ # For a route it serves, the aggregator's own catalog beats+ # models.dev: no reasoning parameter means no reasoning+ # controls, so there is no disable to describe either.+ entry["reasoning"] = False+ elif detail:entry["can_disable_reasoning"] = not detail.get("mandatory")caps[model] = entrydiff --git a/plugins/model-providers/nous/__init__.py b/plugins/model-providers/nous/__init__.pyindex e179e5c1b26..e56470482c8 100644--- a/plugins/model-providers/nous/__init__.py+++ b/plugins/model-providers/nous/__init__.py@@ -71,10 +71,13 @@ class NousProfile(ProviderProfile):Reasoning-mandatory routes answer ``reasoning: {enabled: false}``with HTTP 400 ("Reasoning is mandatory for this model"), so the- catalog's ``mandatory`` flag decides. Cache-only, and an unknown- model (catalog cold, unlisted, or unreachable) also answers True:- a cold first turn errs toward the old omit-everything behavior- rather than risking a 400.+ catalog decides. Cache-only, and an unknown model (catalog cold,+ unlisted, or unreachable) also answers True: a cold first turn errs+ toward the old omit-everything behavior rather than risking a 400.++ A route the catalog says takes no reasoning parameter at all is+ treated the same way — sending it a disable is sending a parameter+ the Portal has told us it doesn't accept."""try:from hermes_cli.models import (@@ -88,6 +91,8 @@ class NousProfile(ProviderProfile):return Trueexcept Exception:return True+ if not caps.get("supports_reasoning"):+ return Truereturn bool(caps.get("mandatory"))def build_api_kwargs_extras(diff --git a/tests/hermes_cli/test_inventory_reasoning_caps.py b/tests/hermes_cli/test_inventory_reasoning_caps.pyindex dd35b48162e..7fc40cc9c2f 100644--- a/tests/hermes_cli/test_inventory_reasoning_caps.py+++ b/tests/hermes_cli/test_inventory_reasoning_caps.py@@ -16,15 +16,12 @@ import hermes_cli.models as models_moddef _patch_catalog(monkeypatch, caps_by_model, *, provider="nous"):"""Point the Nous/OpenRouter catalog readers at a fixed capability map."""monkeypatch.setattr(models_mod, "model_supports_fast_mode", lambda model: False)+ monkeypatch.setattr(models_mod, "warm_nous_reasoning_caps_async", lambda: None)+ monkeypatch.setattr(models_mod, "warm_openrouter_reasoning_caps_async", lambda: None)monkeypatch.setattr(- models_mod, "warm_nous_reasoning_caps_async", lambda: None, raising=False- )- monkeypatch.setattr(- models_mod, "warm_openrouter_reasoning_caps_async", lambda: None, raising=False- )- reader = f"{provider}_model_reasoning_capabilities"- monkeypatch.setattr(- models_mod, reader, lambda model, **kw: caps_by_model.get(model), raising=False+ models_mod,+ f"{provider}_model_reasoning_capabilities",+ lambda model, **kw: caps_by_model.get(model),)@@ -62,6 +59,25 @@ def test_advertised_efforts_never_reach_the_picker(monkeypatch):assert "supported_efforts" not in rows[0]["capabilities"]["deepseek/deepseek-v4-pro"]+def test_non_reasoning_route_offers_no_reasoning_controls(monkeypatch):+ """The serving provider's catalog outranks the models.dev inference.++ models.dev defaults an uncatalogued model to "has reasoning"; when the+ aggregator actually serving the route says it takes no reasoning+ parameter, that is the definitive answer and the picker shows no+ reasoning controls at all — so there is no disable to describe either.+ """+ _patch_catalog(monkeypatch, {+ "moonshotai/kimi-k3-instruct": {"supports_reasoning": False},+ })+ rows = [{"slug": "nous", "models": ["moonshotai/kimi-k3-instruct"]}]+ inv._apply_capabilities(rows)++ caps = rows[0]["capabilities"]["moonshotai/kimi-k3-instruct"]+ assert caps["reasoning"] is False+ assert "can_disable_reasoning" not in caps++def test_reasoning_mandatory_route_cannot_disable(monkeypatch):"""`mandatory` inverts into the flag the Thinking toggle keys off.@@ -127,12 +143,12 @@ def test_openrouter_uses_its_own_catalog(monkeypatch):def test_catalog_failure_never_breaks_the_picker(monkeypatch):"""A raising catalog reader degrades to "unknown", not to a broken payload."""monkeypatch.setattr(models_mod, "model_supports_fast_mode", lambda model: False)- monkeypatch.setattr(models_mod, "warm_nous_reasoning_caps_async", lambda: None, raising=False)+ monkeypatch.setattr(models_mod, "warm_nous_reasoning_caps_async", lambda: None)def _boom(model, **kw):raise RuntimeError("catalog exploded")- monkeypatch.setattr(models_mod, "nous_model_reasoning_capabilities", _boom, raising=False)+ monkeypatch.setattr(models_mod, "nous_model_reasoning_capabilities", _boom)rows = [{"slug": "nous", "models": ["deepseek/deepseek-v4-pro"]}]inv._apply_capabilities(rows)diff --git a/tests/plugins/model_providers/test_nous_profile.py b/tests/plugins/model_providers/test_nous_profile.pyindex 68d738dcc2e..32c2a199aca 100644--- a/tests/plugins/model_providers/test_nous_profile.py+++ b/tests/plugins/model_providers/test_nous_profile.py@@ -49,6 +49,8 @@ def portal_catalog(monkeypatch):"supported_efforts": None,"mandatory": True,},+ # Catalogued, and it takes no reasoning parameter at all.+ "moonshotai/kimi-k3-instruct": {"supports_reasoning": False},})@@ -83,6 +85,20 @@ class TestNousReasoningWireShape:)assert "reasoning" not in extra_body+ def test_disable_dropped_for_non_reasoning_route(self, nous_profile, portal_catalog):+ """A route the catalog says takes no reasoning parameter gets none.++ Hermes' own ``supports_reasoning`` can disagree with the Portal about a+ given route; when it does, the catalog of the service actually serving+ the model wins, and we don't send it a parameter it doesn't accept.+ """+ extra_body, _ = nous_profile.build_api_kwargs_extras(+ reasoning_config={"enabled": False},+ supports_reasoning=True,+ model="moonshotai/kimi-k3-instruct",+ )+ assert "reasoning" not in extra_body+@pytest.mark.parametrize("model",["deepseek/deepseek-v4-pro", "arcee-ai/trinity-large-thinking", "private/unlisted-route"],