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

One regression test per config section feeding the Desktop picker payload:
a volcengine-agent-plan style `default_model` chain under `providers:` and
a `model:` chain under `custom_providers:`. Both assert the raw chain stays
first as the default entry and the split ids follow, deduped in order.

Cases adapted from #50603.

Co-authored-by: LeonSGP43 <cine.dreamer.one@gmail.com>
This commit is contained in:
Brooklyn NicholsonandLeonSGP43 authored and brooklyn! committed 2026-09-27 18:31:33 -05:00
1 parent f2eb98feae
commit bac0c45d85
2 files changed
+76

No files matched your search

@@ -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", {})
@@ -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