hermes-agent/tests/hermes_cli/test_local_provider_alias_parity.py
Hermes Agent 70f7fa05ca fix(providers): keep llamacpp as the model table's managed-runtime id
Mapping the llamacpp aliases to custom in hermes_cli.models sent the
managed local runtime's /model validation down the custom branch before
the staged-library check, so a downloaded-but-not-running GGUF lost its
recognized verdict and an unstaged one was accepted. Keep local and vllm
on custom there, leave the llamacpp aliases on their runtime id, and
move the orphaned 'local' display label to 'custom'.

The parity test now reads the aliases from the custom provider profile
instead of a hand-written list.
2026-09-25 14:25:16 -05:00

36 lines
1.6 KiB
Python

"""Parity contract for local OpenAI-compatible provider aliases (issue #62213).
The CLI, config, and credential layers each normalise provider names through a
different table:
* ``hermes_cli.providers.normalize_provider`` (routing / api-mode)
* ``hermes_cli.models.normalize_provider`` (model picker / web server)
* ``hermes_cli.auth.resolve_provider`` (credential resolution)
Historically these disagreed for the local self-hosted server aliases: bare
``local`` stayed ``"local"`` in ``providers`` and ``models`` while ``auth`` mapped
it to ``"custom"``, and ``vllm`` got three answers (``local`` / ``vllm`` /
``custom``) — the "custom, local, custom:local" confusion the bug report
describes. Every alias the ``custom`` provider profile declares must land on
``custom``; the one exception is the model table's managed llama.cpp runtime id,
which the picker's Local row and the staged-library validator key on.
"""
import pytest
from hermes_cli.auth import resolve_provider
from hermes_cli.models import normalize_provider as models_normalize
from hermes_cli.providers import LLAMACPP_ALIASES, normalize_provider as providers_normalize
from providers import get_provider_profile
_CUSTOM_ALIASES = tuple(get_provider_profile("custom").aliases)
@pytest.mark.parametrize("alias", _CUSTOM_ALIASES)
def test_custom_profile_aliases_normalize_to_custom_in_every_table(alias):
assert providers_normalize(alias) == "custom"
assert resolve_provider(alias) == "custom"
if alias in LLAMACPP_ALIASES:
assert models_normalize(alias) in LLAMACPP_ALIASES
else:
assert models_normalize(alias) == "custom"