The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(catalog): keep the delisted deepseek-v4-flash-free out of the live OpenCode picker too
teknium1bb5d745ab156
diff --git a/hermes_cli/models.py b/hermes_cli/models.pyindex 8f9099987fd..364629ec558 100644--- a/hermes_cli/models.py+++ b/hermes_cli/models.py@@ -2138,12 +2138,15 @@ def normalize_opencode_model_id(provider_id: Optional[str], model_id: Optional[sOPENCODE_ZEN_FREE_KEYLESS_PLACEHOLDER = "opencode-zen-free-keyless"_OPENCODE_ZEN_FREE_BASE_URL = "https://opencode.ai/zen/v1"-# ``-free``-suffixed slugs that are KEYED (Go-subscription) models, NOT anonymous-servable —-# excluded from the keyless catalog despite the suffix (ox-alpha-free is Ox Alpha's Go twin).-# The Go relay delisted ox-alpha-free (2026-09-09; GET /zen/go/v1/models omits it, POST → 401),-# so it is gone from the opencode-go curated floor too — the exclusion stays so a stale live-# list can never route it into the keyless catalog.-_OPENCODE_FREE_KEYED_SUFFIX_MODELS = frozenset({"ox-alpha-free"})+# ``-free``-suffixed slugs the live list may carry that the keyless catalog must NOT offer:+# - KEYED (Go-subscription) twins, not anonymous-servable despite the suffix (ox-alpha-free is+# Ox Alpha's Go twin; the Go relay delisted it 2026-09-09 — the exclusion stays so a stale live+# list can never route it into the keyless catalog).+# - Delisted ids the relay still LISTS but no longer serves: deepseek-v4-flash-free (promo ended;+# gone from opencode.ai/docs/zen by 2026-09-15 yet still in GET /zen/v1/models, and every POST+# 400s "Model is unavailable"). Offering it lets a first-turn 400 drive a fallback switch that+# strands the whole session (#111749).+_OPENCODE_FREE_EXCLUDED_MODELS = frozenset({"ox-alpha-free", "deepseek-v4-flash-free"})# In-process memo for _fetch_opencode_free_models(): (fetched_at, ids-or-None). Validation and# healing call provider_model_ids("opencode-free") several times per resolution; failures are@@ -2170,8 +2173,8 @@ def opencode_zen_free_headers() -> dict:def _fetch_opencode_free_models(timeout: float = 8.0, *, force_refresh: bool = False) -> Optional[list[str]]:"""Live keyless OpenCode Free catalog from the Zen relay, filtered to the anonymous-servable- ``*-free`` tier minus known keyed twins (Go ``ox-alpha-free`` is KEYED despite the suffix) — the- same membership criterion ``opencode_zen_free_runtime`` routes on."""+ ``*-free`` tier minus ``_OPENCODE_FREE_EXCLUDED_MODELS`` (keyed twins and listed-but-dead ids) —+ the same membership criterion ``opencode_zen_free_runtime`` routes on."""from hermes_cli.urllib_security import open_credentialed_urlnow = time.time()@@ -2194,7 +2197,7 @@ def _fetch_opencode_free_models(live_free = [m["id"] for m in itemsif isinstance(m, dict) and isinstance(m.get("id"), str)- and m["id"].lower().endswith("-free") and m["id"].lower() not in _OPENCODE_FREE_KEYED_SUFFIX_MODELS+ and m["id"].lower().endswith("-free") and m["id"].lower() not in _OPENCODE_FREE_EXCLUDED_MODELS]result = live_free or None_set_opencode_free_live_memo(result)diff --git a/hermes_cli/models_catalog_static.py b/hermes_cli/models_catalog_static.pyindex 971de125d3e..9a2c260c3df 100644--- a/hermes_cli/models_catalog_static.py+++ b/hermes_cli/models_catalog_static.py@@ -228,7 +228,7 @@ _PROVIDER_MODELS: dict[str, list[str]] = {"gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.1-pro", "gemini-3-flash","grok-4.6", "grok-4.5", "grok-build-0.1", "muse-spark-1.2", "minimax-m3", "minimax-m2.7", "minimax-m2.5","glm-5.3", "glm-5.3-flash", "glm-5.2", "glm-5.1", "glm-5", "kimi-k2.7-code", "deepseek-v4-pro",- "deepseek-v4-flash", "deepseek-v4-flash-free", "qwen3.6-plus", "qwen3.5-plus", "big-pickle", "mimo-v2.5-free",+ "deepseek-v4-flash", "qwen3.6-plus", "qwen3.5-plus", "big-pickle", "mimo-v2.5-free","nemotron-3-ultra-free", "nemotron-3.5-lightning-free","muse-spark-1.2-contributor-free", "muse-spark-1.3-contributor-free",],diff --git a/tests/hermes_cli/test_opencode_free_live_catalog.py b/tests/hermes_cli/test_opencode_free_live_catalog.pyindex 8bcc0903615..b704c58c708 100644--- a/tests/hermes_cli/test_opencode_free_live_catalog.py+++ b/tests/hermes_cli/test_opencode_free_live_catalog.py@@ -33,9 +33,9 @@ _STATIC_FLOOR = list(_PROVIDER_MODELS["opencode-free"])# The live relay's current free tier. x-preview-f-free was DELISTED 2026-08-26;# hy3-free and laguna-s-2.1-free were DELISTED 2026-09-09 (gone from live-# /models, anon 401 "Model … is not supported").+# /models, anon 401 "Model … is not supported"); deepseek-v4-flash-free was+# DELISTED 2026-09-15 (still LISTED by /models, every POST 400s "Model is unavailable")._LIVE_FREE_MODELS = [- "deepseek-v4-flash-free","mimo-v2.5-free","nemotron-3-ultra-free","nemotron-3.5-lightning-free",@@ -50,6 +50,7 @@ _LIVE_RAW_IDS = _LIVE_FREE_MODELS + ["claude-sonnet-5", # paid"gpt-5.6-sol", # paid"ox-alpha-free", # KEYED Go-subscription (suffix looks free)+ "deepseek-v4-flash-free", # delisted but still listed; POST → 400 "Model is unavailable"]@@ -63,7 +64,7 @@ class TestProviderModelIdsOpencodeFree:result = provider_model_ids("opencode-free")assert "x-preview-f-free" not in result # delisted — REVERT-PROOF- assert "deepseek-v4-flash-free" in result # newly-live — REVERT-PROOF+ assert "nemotron-3-ultra-free" in result # newly-live — REVERT-PROOFassert "mimo-v2.5-free" in result # newly-live — REVERT-PROOFdef test_live_catalog_filters_out_keyed_free_suffix_model(self):@@ -183,6 +184,36 @@ class TestOpencodeFreeFollowUps:assert calls["n"] == 1self._reset_memo(mod)+ def test_fetch_drops_listed_but_delisted_model(self):+ """A delisted id the relay still LISTS (deepseek-v4-flash-free: docs/zen dropped it,+ every POST 400s "Model is unavailable") must not reach the keyless picker; offering it+ lets a first-turn 400 drive a fallback switch that strands the session (#111749)."""+ import hermes_cli.models as mod++ self._reset_memo(mod)++ def fake_open(req, timeout):+ import io, json as _json++ class _Resp(io.BytesIO):+ def __enter__(self):+ return self++ def __exit__(self, *a):+ return False++ return _Resp(_json.dumps({"data": [{"id": m} for m in _LIVE_RAW_IDS]}).encode())++ try:+ with patch("hermes_cli.urllib_security.open_credentialed_url", fake_open):+ live = mod._fetch_opencode_free_models(force_refresh=True)+ finally:+ self._reset_memo(mod)+ assert live is not None+ assert "deepseek-v4-flash-free" not in live+ assert "ox-alpha-free" not in live+ assert "mimo-v2.5-free" in live # control: a servable free model survives the filter+def test_heal_union_includes_live_only_model(self):"""A newly-live free model absent from the static floor must still healopencode-go/zen selections to the keyless Zen relay (sibling-site widen: