The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(models): preserve empty catalog and custom model semantics
Vadelma81e813507f3d
diff --git a/acp_adapter/server.py b/acp_adapter/server.pyindex 51c47e4e160..f864d42a2cd 100644--- a/acp_adapter/server.py+++ b/acp_adapter/server.py@@ -900,7 +900,14 @@ class HermesACPAgent(acp.Agent):def choice_provider(model_id: str) -> str:parts = model_id.split(":")- return ":".join(parts[:2]) if parts[:1] == ["custom"] and len(parts) > 1 else parts[0]+ if parts[:1] == ["custom"] and len(parts) > 1:+ candidate = f"custom:{parts[1].lower()}"+ from hermes_cli.models import _configured_custom_provider_ids++ if candidate in _configured_custom_provider_ids():+ return candidate+ return "custom"+ return parts[0]if named_empty_authoritative:available_models = [diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.pyindex 12f85d2e615..e8835a8c102 100644--- a/hermes_cli/model_switch.py+++ b/hermes_cli/model_switch.py@@ -3771,7 +3771,9 @@ def list_authenticated_providers(api_mode=grp.get("api_mode"),)if live_models is not None and (- live_models or not bool(grp.get("has_explicit_models"))+ live_models+ or not bool(grp.get("has_explicit_models"))+ or isinstance(live_models, _NativePickerModelList)):if isinstance(live_models, _NativePickerModelList):native_catalog_empty = not live_modelsdiff --git a/hermes_cli/models.py b/hermes_cli/models.pyindex 44896263e13..3372507ae81 100644--- a/hermes_cli/models.py+++ b/hermes_cli/models.py@@ -2546,7 +2546,10 @@ def parse_model_input(raw: str, current_provider: str) -> tuple[str, str]:custom_name = model_part[:second_colon].strip()actual_model = model_part[second_colon + 1:].strip()if custom_name and actual_model:- return (f"custom:{custom_name}", actual_model)+ custom_id = f"custom:{custom_name.lower()}"+ if custom_id in _configured_custom_provider_ids():+ return (custom_id, actual_model)+ return ("custom", model_part)return (normalize_provider(provider_part), model_part)return (current_provider, stripped)diff --git a/tests/acp/test_named_provider_catalogs.py b/tests/acp/test_named_provider_catalogs.pyindex f79b8baf769..e4663021484 100644--- a/tests/acp/test_named_provider_catalogs.py+++ b/tests/acp/test_named_provider_catalogs.py@@ -246,7 +246,16 @@ class TestModelStateIncludesNamedProviders:from hermes_cli.models import parse_model_inputchoice_id = "custom:bedrock-mantle:openai.gpt-5.5"- provider, model = parse_model_input(choice_id, "bedrock")+ cfg = {+ "providers": {+ "bedrock-mantle": {+ "name": "AWS Bedrock Mantle",+ "base_url": "https://bedrock.example/v1",+ }+ }+ }+ with patch("hermes_cli.config.load_config", return_value=cfg):+ provider, model = parse_model_input(choice_id, "bedrock")assert provider == "custom:bedrock-mantle"assert model == "openai.gpt-5.5"