Skip to content

The agent that grows with you

test(model): cover comma-chain splitting for providers and custom_providers

Brooklyn Nicholsonbac0c45d8593
diff --git a/tests/hermes_cli/test_model_switch_custom_providers.py b/tests/hermes_cli/test_model_switch_custom_providers.py
index 85510cd1485..0996d4a1748 100644
--- a/tests/hermes_cli/test_model_switch_custom_providers.py
+++ b/tests/hermes_cli/test_model_switch_custom_providers.py
@@ -288,6 +288,40 @@ def test_providers_singular_model_does_not_suppress_ollama_native_discovery(monk
assert ollama["models"] == ["qwen3:latest", "llama3.2:latest"]
+def test_list_splits_comma_chain_custom_provider_model(monkeypatch):
+ """A comma-separated custom-provider ``model:`` chain surfaces as individual entries.
+
+ Regression (fixes #50557): picker rows are fed from ``list_authenticated_providers``
+ and previously rendered the whole fallback chain as one dropdown entry. The raw chain
+ stays first so the server-side fallback behaviour remains the default pick.
+ """
+ monkeypatch.setattr("agent.models_dev.fetch_models_dev", lambda: {})
+ monkeypatch.setattr(providers_mod, "HERMES_OVERLAYS", {})
+
+ providers = list_authenticated_providers(
+ current_provider="openai-codex",
+ user_providers={},
+ custom_providers=[
+ {
+ "name": "Volcengine Agent Plan",
+ "base_url": "https://ark.cn-beijing.volces.com/api/v3",
+ "model": "deepseek-v4-flash, deepseek-v4-pro, glm-5.2, deepseek-v4-flash",
+ }
+ ],
+ max_models=50,
+ )
+
+ rows = [p for p in providers if p["name"] == "Volcengine Agent Plan"]
+ assert len(rows) == 1
+ assert rows[0]["models"] == [
+ "deepseek-v4-flash, deepseek-v4-pro, glm-5.2, deepseek-v4-flash",
+ "deepseek-v4-flash",
+ "deepseek-v4-pro",
+ "glm-5.2",
+ ]
+ assert rows[0]["total_models"] == 4
+
+
def test_list_authenticated_providers_can_skip_custom_provider_live_probe(monkeypatch):
monkeypatch.setattr("agent.models_dev.fetch_models_dev", lambda: {})
monkeypatch.setattr(providers_mod, "HERMES_OVERLAYS", {})
diff --git a/tests/hermes_cli/test_user_providers_model_switch.py b/tests/hermes_cli/test_user_providers_model_switch.py
index 5f7d93411e9..76a1bc6a6bd 100644
--- a/tests/hermes_cli/test_user_providers_model_switch.py
+++ b/tests/hermes_cli/test_user_providers_model_switch.py
@@ -213,6 +213,48 @@ def test_list_authenticated_providers_accepts_base_url_and_singular_model(monkey
assert custom["total_models"] == 3
+def test_list_authenticated_providers_splits_comma_default_model_chain(monkeypatch):
+ """Comma-separated ``default_model`` chains surface as individually selectable entries.
+
+ Regression (fixes #50557): a volcengine-agent-plan style fallback chain in
+ ``providers:`` rendered as one dropdown entry in the Desktop picker, which
+ feeds off this payload. The raw chain stays first as the default (fallback)
+ pick; the split ids follow, deduped in order.
+ """
+ monkeypatch.setattr("agent.models_dev.fetch_models_dev", lambda: {})
+ monkeypatch.setattr("hermes_cli.providers.HERMES_OVERLAYS", {})
+ monkeypatch.setattr("hermes_cli.models.fetch_api_models", lambda *_a, **_kw: None)
+
+ user_providers = {
+ "volcengine-agent-plan": {
+ "name": "VOLCENGINE-AGENT-PLAN",
+ "base_url": "https://ark.cn-beijing.volces.com/api/v3",
+ "default_model": "deepseek-v4-flash, deepseek-v4-pro, glm-5.2, deepseek-v4-flash",
+ }
+ }
+
+ providers = list_authenticated_providers(
+ current_provider="volcengine-agent-plan",
+ user_providers=user_providers,
+ custom_providers=[],
+ max_models=50,
+ )
+
+ user_prov = next(
+ (p for p in providers if p.get("is_user_defined") and p["slug"] == "volcengine-agent-plan"),
+ None,
+ )
+
+ assert user_prov is not None
+ assert user_prov["models"] == [
+ "deepseek-v4-flash, deepseek-v4-pro, glm-5.2, deepseek-v4-flash",
+ "deepseek-v4-flash",
+ "deepseek-v4-pro",
+ "glm-5.2",
+ ]
+ assert user_prov["total_models"] == 4
+
+
def test_list_authenticated_providers_dedupes_when_user_and_custom_overlap(monkeypatch):
"""When the same slug appears in both ``providers:`` dict and
``custom_providers:`` list, emit exactly one row (providers: dict wins