mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-07 13:02:07 +00:00
fix(models): live-first merge + update opencode-zen catalog + uncap aggregator picker
This commit is contained in:
parent
2e7e600eaa
commit
f98ffbc246
5 changed files with 110 additions and 26 deletions
|
|
@ -114,8 +114,8 @@ class TestProviderModelIdsPreferred:
|
|||
patch("providers.base.ProviderProfile.fetch_models", return_value=["kimi-k2.6"]),
|
||||
):
|
||||
out = provider_model_ids("kimi-coding")
|
||||
# Curated-first order; curated newest (k2.7-code) stays ahead of live.
|
||||
assert out[:2] == ["kimi-k2.7-code", "kimi-k2.6"]
|
||||
# Live-first order; live entry (k2.6) comes before curated-only (k2.7-code).
|
||||
assert out[:2] == ["kimi-k2.6", "kimi-k2.7-code"]
|
||||
|
||||
def test_kimi_setup_flow_uses_same_coding_plan_catalog(self):
|
||||
"""The setup wizard must not carry a stale duplicate Kimi model list."""
|
||||
|
|
|
|||
51
tests/hermes_cli/test_opencode_zen_model_limit.py
Normal file
51
tests/hermes_cli/test_opencode_zen_model_limit.py
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"""Regression tests for OpenCode Zen model picker limits."""
|
||||
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import hermes_cli.providers as providers_mod
|
||||
from hermes_cli.model_switch import list_authenticated_providers
|
||||
|
||||
|
||||
def test_opencode_zen_lists_all_models_while_other_providers_remain_capped(monkeypatch):
|
||||
"""OpenCode Zen is an aggregator product, so the picker must expose its full catalog."""
|
||||
zen_models = [f"zen-model-{i}" for i in range(57)]
|
||||
deepseek_models = [f"deepseek-model-{i}" for i in range(57)]
|
||||
|
||||
monkeypatch.setattr(
|
||||
"agent.models_dev.PROVIDER_TO_MODELS_DEV",
|
||||
{
|
||||
"opencode-zen": "opencode",
|
||||
"deepseek": "deepseek",
|
||||
},
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"agent.models_dev.fetch_models_dev",
|
||||
lambda: {"opencode": {}, "deepseek": {}},
|
||||
)
|
||||
monkeypatch.setattr(providers_mod, "HERMES_OVERLAYS", {})
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.models.cached_provider_model_ids",
|
||||
lambda provider: {
|
||||
"opencode-zen": zen_models,
|
||||
"deepseek": deepseek_models,
|
||||
}.get(provider, []),
|
||||
)
|
||||
|
||||
with patch.dict(
|
||||
os.environ,
|
||||
{
|
||||
"OPENCODE_ZEN_API_KEY": "test-zen-key",
|
||||
"DEEPSEEK_API_KEY": "test-deepseek-key",
|
||||
},
|
||||
clear=False,
|
||||
):
|
||||
providers = list_authenticated_providers(max_models=50)
|
||||
|
||||
opencode_zen = next(p for p in providers if p["slug"] == "opencode-zen")
|
||||
deepseek = next(p for p in providers if p["slug"] == "deepseek")
|
||||
|
||||
assert opencode_zen["models"] == zen_models
|
||||
assert opencode_zen["total_models"] == len(zen_models)
|
||||
assert deepseek["models"] == deepseek_models[:50]
|
||||
assert deepseek["total_models"] == len(deepseek_models)
|
||||
|
|
@ -23,7 +23,7 @@ class TestGenericProviderLiveCuratedMerge:
|
|||
return p
|
||||
|
||||
def test_live_models_merged_with_curated(self):
|
||||
"""Curated models come first; live-only models are appended."""
|
||||
"""Live models come first; curated-only models are appended."""
|
||||
live = ["glm-5.2", "glm-5.1", "glm-5"]
|
||||
curated = _PROVIDER_MODELS["zai"] # includes glm-5.1, glm-5, glm-4.5, etc.
|
||||
profile = self._make_profile(live)
|
||||
|
|
@ -34,9 +34,9 @@ class TestGenericProviderLiveCuratedMerge:
|
|||
):
|
||||
result = provider_model_ids("zai")
|
||||
|
||||
# Curated entries first, in catalog order (keeps newest curated models
|
||||
# like glm-5.2 at the top of the picker — see #46309).
|
||||
assert result[: len(curated)] == list(curated)
|
||||
# Live entries first (provider's authoritative catalog),
|
||||
# curated-only entries appended afterwards.
|
||||
assert result[: len(live)] == list(live)
|
||||
assert result[0] == "glm-5.2"
|
||||
# Models present in both live and curated are not duplicated.
|
||||
assert result.count("glm-5.2") == 1
|
||||
|
|
@ -76,8 +76,8 @@ class TestGenericProviderLiveCuratedMerge:
|
|||
):
|
||||
result = provider_model_ids("zai")
|
||||
|
||||
# Curated-first: curated casing wins for models present in both.
|
||||
assert result == ["glm-5.1", "GLM-5", "glm-4.5"]
|
||||
# Live-first: live casing wins for models present in both.
|
||||
assert result == ["GLM-5.1", "glm-5", "glm-4.5"]
|
||||
|
||||
def test_empty_curated_returns_live_only(self):
|
||||
"""When no curated list exists, live is returned as-is."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue