fix: migrate sibling custom-provider slug sites to custom_provider_slug

find_custom_provider_identity_by_model (runtime_provider.py:895,908) and
acp_adapter/server.py:149 still used the old f"custom:{_normalize_custom_provider_name(...)}"
pattern while the rest of the codebase migrated to custom_provider_slug.
For keyed providers whose display name differs from their config key, the
model-based reverse lookup would return custom:<display-name> instead of
the stable custom:<provider_key> identity every other code path returns.

Co-authored-by: Gille <4317663+helix4u@users.noreply.github.com>
This commit is contained in:
kshitijk4poor 2026-07-30 21:17:28 +05:00 committed by kshitij
parent 2de1e86c16
commit 7b5a18817e
2 changed files with 7 additions and 4 deletions

View file

@ -114,6 +114,7 @@ def _named_custom_provider_catalogs() -> list[tuple[str, str, list[tuple[str, st
load_config,
)
from hermes_cli.models import fetch_api_models
from hermes_cli.providers import custom_provider_slug
except ImportError:
return []
@ -145,8 +146,7 @@ def _named_custom_provider_catalogs() -> list[tuple[str, str, list[tuple[str, st
base_url = str(entry.get("base_url", "") or "").strip()
if not name or not base_url:
continue
slug_source = provider_key or name
slug = "custom:" + slug_source.strip().lower().replace(" ", "-")
slug = custom_provider_slug(name, provider_key)
api_key = str(entry.get("api_key", "") or "").strip()
if not api_key:

View file

@ -892,7 +892,7 @@ def find_custom_provider_identity_by_model(model: str) -> Optional[str]:
if not isinstance(entry, dict):
continue
if _entry_serves_model(entry):
return f"custom:{_normalize_custom_provider_name(str(ep_name))}"
return custom_provider_slug(str(ep_name), str(ep_name))
try:
custom_providers = get_compatible_custom_providers(config)
@ -905,7 +905,10 @@ def find_custom_provider_identity_by_model(model: str) -> Optional[str]:
if not isinstance(name, str) or not name.strip():
continue
if _entry_serves_model(entry):
return f"custom:{_normalize_custom_provider_name(name)}"
return custom_provider_slug(
name,
str(entry.get("provider_key", "") or ""),
)
return None