The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(providers): a timeout-only providers.<name> block no longer shadows the builtin
Bardioc1977f284a05f1da7
diff --git a/hermes_cli/providers.py b/hermes_cli/providers.pyindex 6329cbc6f7f..04ae7d4fb58 100644--- a/hermes_cli/providers.py+++ b/hermes_cli/providers.py@@ -400,12 +400,22 @@ def _user_pdef(pid: str, name: str, base_url: str, key_env: str, transport: strdef resolve_user_provider(name: str, user_config: Dict[str, Any]) -> Optional[ProviderDef]:- """Resolve a provider from the user's config.yaml ``providers:`` section."""+ """Resolve a provider from the user's config.yaml ``providers:`` section.++ A ``providers.<name>`` block that carries no endpoint (``api``/``url``/``base_url``) is not a+ custom-endpoint definition — it is tuning for a BUILT-IN provider of the same name (e.g.+ ``providers.bedrock: {stale_timeout_seconds: 600}``, the documented path in+ ``agent/turn_recovery.py`` / ``thinking_timeout_guidance.py``). Resolving it here would shadow+ the built-in's real transport/base_url/auth_type with an empty ``openai_chat``/``api_key``+ stub, routing e.g. AWS Bedrock through the generic custom-endpoint ``/models`` probe (#110402).+ """entry = user_config.get(name) if isinstance(user_config, dict) and user_config else Noneif not isinstance(entry, dict):return None- return _user_pdef(name, entry.get("name", "") or name,- entry.get("api", "") or entry.get("url", "") or entry.get("base_url", "") or "",+ base_url = entry.get("api", "") or entry.get("url", "") or entry.get("base_url", "") or ""+ if not base_url:+ return None+ return _user_pdef(name, entry.get("name", "") or name, base_url,entry.get("key_env") or entry.get("api_key_env") or "",entry.get("transport", "openai_chat") or "openai_chat")diff --git a/tests/hermes_cli/test_user_provider_timeout_only_entry.py b/tests/hermes_cli/test_user_provider_timeout_only_entry.pynew file mode 100644index 00000000000..b831fdd0390--- /dev/null+++ b/tests/hermes_cli/test_user_provider_timeout_only_entry.py@@ -0,0 +1,33 @@+"""Regression for #110402: a ``providers.<name>`` block with no endpoint (only tuning keys like+``stale_timeout_seconds``/``request_timeout_seconds``) must not shadow a BUILT-IN provider of the+same name. ``providers.bedrock: {stale_timeout_seconds: 600}`` is the documented way to tune a+built-in's per-call timeout (agent/turn_recovery.py, agent/thinking_timeout_guidance.py); it is not+a custom-endpoint definition and must fall through to the real Bedrock overlay (aws_sdk auth,+bedrock_converse transport) instead of resolving to an empty ``openai_chat``/``api_key`` stub that+routes Bedrock through the generic custom-endpoint ``/models`` probe.+"""++from hermes_cli.providers import resolve_provider_full, resolve_user_provider+++def test_timeout_only_entry_does_not_resolve_as_a_custom_provider():+ """A providers.<name> block with only tuning keys is not a provider definition."""+ user_providers = {"bedrock": {"stale_timeout_seconds": 600, "request_timeout_seconds": 1800}}+ assert resolve_user_provider("bedrock", user_providers) is None+++def test_timeout_only_bedrock_entry_falls_through_to_the_builtin_overlay():+ """resolve_provider_full must still resolve Bedrock's real transport/auth_type, not a stub."""+ user_providers = {"bedrock": {"stale_timeout_seconds": 600, "request_timeout_seconds": 1800}}+ pdef = resolve_provider_full("bedrock", user_providers, None)+ assert pdef is not None+ assert pdef.transport == "bedrock_converse"+ assert pdef.auth_type == "aws_sdk"+++def test_entry_with_an_endpoint_still_resolves_as_a_custom_provider():+ """A real endpoint-bearing providers.<name> block keeps resolving (no over-correction)."""+ user_providers = {"local-ollama": {"api": "http://localhost:11434/v1", "name": "Local Ollama"}}+ pdef = resolve_user_provider("local-ollama", user_providers)+ assert pdef is not None+ assert pdef.base_url == "http://localhost:11434/v1"