test: add regression tests for custom_providers multi-model dedup and grouping

Tests for salvaged PRs #9233 and #8011.
This commit is contained in:
Teknium 2026-04-13 16:33:28 -07:00 committed by Teknium
parent ec9bf9e378
commit ac80bd61ad
2 changed files with 78 additions and 0 deletions

View file

@ -564,6 +564,30 @@ class TestCustomProviderCompatibility:
# Legacy entry wins (read first)
assert compatible[0]["api_key"] == "legacy-key"
def test_dedup_preserves_entries_with_different_models(self, tmp_path):
"""Entries with same name+URL but different models must not be collapsed."""
config_path = tmp_path / "config.yaml"
config_path.write_text(
yaml.safe_dump(
{
"_config_version": 17,
"custom_providers": [
{"name": "Ollama Cloud", "base_url": "https://ollama.com/v1", "model": "qwen3-coder"},
{"name": "Ollama Cloud", "base_url": "https://ollama.com/v1", "model": "glm-5.1"},
{"name": "Ollama Cloud", "base_url": "https://ollama.com/v1", "model": "kimi-k2.5"},
],
}
),
encoding="utf-8",
)
with patch.dict(os.environ, {"HERMES_HOME": str(tmp_path)}):
compatible = get_compatible_custom_providers()
assert len(compatible) == 3
models = [e.get("model") for e in compatible]
assert models == ["qwen3-coder", "glm-5.1", "kimi-k2.5"]
class TestInterimAssistantMessageConfig:
"""Test the explicit gateway interim-message config gate."""