The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): skip disabled entries when naming a custom route
unsupportedpastels82ba0ab6b67b
diff --git a/hermes_cli/runtime_provider_custom.py b/hermes_cli/runtime_provider_custom.pyindex e77bd274e71..3b99217c64b 100644--- a/hermes_cli/runtime_provider_custom.py+++ b/hermes_cli/runtime_provider_custom.py@@ -303,6 +303,7 @@ def _find_custom_identity(matches: Callable[[dict[str, Any]], bool],config: Optional[dict[str, Any]] = None) -> Optional[str]:"""First entry in ``providers:`` then legacy ``custom_providers:`` where ``matches(entry)``holds, as its canonical ``custom:<name>`` slug. *config* defaults to the active profile's."""+ from hermes_cli.config import is_provider_enabledrp = _rp()try:config = rp.load_config() if config is None else config@@ -311,7 +312,7 @@ def _find_custom_identity(matches: Callable[[dict[str, Any]], bool],providers = config.get("providers")if isinstance(providers, dict):for ep_name, entry in providers.items():- if isinstance(entry, dict) and matches(entry):+ if isinstance(entry, dict) and is_provider_enabled(entry) and matches(entry):return custom_provider_slug(str(ep_name), str(ep_name))try:custom_providers = rp.get_compatible_custom_providers(config)diff --git a/tests/gateway/test_bare_custom_route_identity.py b/tests/gateway/test_bare_custom_route_identity.pyindex a5e225e52a0..189a29cf46c 100644--- a/tests/gateway/test_bare_custom_route_identity.py+++ b/tests/gateway/test_bare_custom_route_identity.py@@ -44,6 +44,13 @@ def test_a_bare_custom_launch_pick_freezes_the_configured_entry(tmp_path, pick,assert (model['provider'], model.get('base_url')) == (provider, RELAY)+def test_a_disabled_sibling_serving_the_model_never_names_the_route():+ from hermes_cli.runtime_provider_custom import routed_custom_identity+ config = {'providers': {**SIBLINGS['providers'],+ 'deepseek': {**SIBLINGS['providers']['deepseek'], 'enabled': False}}}+ assert routed_custom_identity(RELAY, 'deepseek-v4.1-flash', config) == 'custom:glm'++def test_a_bare_custom_route_is_persisted_as_its_entry(home):from gateway.run_turn_prepare import GatewayTurnPrepareMixinfrom hermes_state import SessionDB