The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(providers): bare named custom providers resolve to custom profile for reasoning_effort
holnyc57b45afce95
diff --git a/providers/__init__.py b/providers/__init__.pyindex 4d253aacfb0..46fc1ceae9b 100644--- a/providers/__init__.py+++ b/providers/__init__.py@@ -182,6 +182,14 @@ def get_provider_profile(name: str) -> ProviderProfile | None:# explicitly registered that route. Other names retain exact lookup.if profile is None and is_custom_route:profile = lookup("custom")+ # Bare named custom providers (not ``custom:<name>``) that are configured in+ # ``providers:`` / ``custom_providers:`` but lack an explicit profile entry+ # also share the generic wire policy. Check via the runtime helper so this+ # module never imports ``hermes_cli`` at module level.+ if profile is None and isinstance(name, str) and not is_custom_route:+ from hermes_cli.runtime_provider_custom import has_named_custom_provider+ if has_named_custom_provider(name):+ profile = lookup("custom")return profilediff --git a/tests/providers/test_named_custom_reasoning.py b/tests/providers/test_named_custom_reasoning.pyindex dd1d3acbd08..425367d81b7 100644--- a/tests/providers/test_named_custom_reasoning.py+++ b/tests/providers/test_named_custom_reasoning.py@@ -1,9 +1,34 @@-"""Named custom routes use the same reasoning contract as bare custom."""+"""Named custom routes use the same reasoning contract as bare custom.++Regression for https://github.com/NousResearch/hermes-agent/issues/119681+"""from providers import get_provider_profile, register_providerfrom providers.base import ProviderProfilefrom agent.transports.chat_completions import ChatCompletionsTransport+def test_bare_named_custom_provider_gets_custom_profile(monkeypatch):+ """Bare name (no ``custom:`` prefix) configured in providers: resolves to custom profile.++ Regression for https://github.com/NousResearch/hermes-agent/issues/119681+ """+ import providers+ get_provider_profile("custom")+ monkeypatch.setattr(providers, "_REGISTRY", dict(providers._REGISTRY))+ monkeypatch.setattr(providers, "_ALIASES", dict(providers._ALIASES))+ monkeypatch.setattr(providers, "_PROVIDER_LIST_CACHE", None)+ custom_profile = get_provider_profile("custom")+ assert custom_profile is not None++ def fake_has_named(name):+ return name == "my-endpoint"++ with monkeypatch.context() as m:+ m.setattr("hermes_cli.runtime_provider_custom.has_named_custom_provider", fake_has_named)+ result = get_provider_profile("my-endpoint")+ assert result is custom_profile++def test_named_custom_route_keeps_final_reasoning_effort():transport = ChatCompletionsTransport()for effort in ("low", "medium", "high"):