From 9c3e37d2ee3b5aaec2203e55df737d86dc5cc706 Mon Sep 17 00:00:00 2001 From: Colin Chang Date: Wed, 20 May 2026 23:24:10 +0800 Subject: [PATCH 1/2] fix: custom_providers models allowlist takes priority over live /v1/models fetch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Custom providers that have a curated models: list in config.yaml (e.g. ZenMux gateways) should show ONLY those configured models in the picker dropdown, not the full /v1/models catalog. Before this fix, _named_custom_groups unconditionally called _read_custom_endpoint_models() which would pull hundreds of models from aggregator gateways and overwrite the user's curated list. Now the build checks if the custom_provider entry has a non-empty models dict/list in config.yaml — if so, it skips the live fetch and uses only the configured models (same behavior as hermes-agent model_switch.py Section 4 patch). Closes: configure-model-list-should-be-authoritative --- api/config.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/api/config.py b/api/config.py index 225c8e06..65b418d5 100644 --- a/api/config.py +++ b/api/config.py @@ -3364,9 +3364,30 @@ def get_available_models() -> dict: _cp_key_env = str(_cp.get("key_env") or "").strip() if _cp_key_env: _cp_api_key = str(os.getenv(_cp_key_env) or "").strip() + + # Check if user has configured models in config.yaml — + # configured models take priority over live /v1/models + # discovery (same as hermes-agent model_switch.py Section 4 + # patch). Without this check, ZenMux and similar aggregator + # gateways would show hundreds of online models instead of + # the user's curated list. + _cp_configured_models = _cp.get("models") + _cp_has_configured_models = ( + isinstance(_cp_configured_models, (dict, list)) + and len(_cp_configured_models) > 0 + ) _live_models = auto_detected_models_by_provider.get(_slug) _live_error = None - if _live_models is None: + if _cp_has_configured_models: + # Skip the live /v1/models probe when an allowlist + # exists — the curated list wins and probe failures + # should not surface as a user-facing diagnostic in + # that case. Still respect any pre-warm result that + # ``auto_detected_models_by_provider`` already + # populated (cheap to keep). + if _live_models is None: + _live_models = [] + elif _live_models is None: _live_models, _live_error = _read_custom_endpoint_models( _cp_base_url, _slug, From 1bf905a0ccbb09e6803f55367169b9120ee1a01a Mon Sep 17 00:00:00 2001 From: nesquena-hermes <[email protected]> Date: Wed, 20 May 2026 20:40:48 +0000 Subject: [PATCH 2/2] Stamp CHANGELOG for v0.51.98 (Release BV / stage-391 / 1-PR follow-on) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9921aa94..bc701e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ## [Unreleased] +## [v0.51.98] — 2026-05-20 — Release BV (stage-391 — 1-PR follow-on — custom_providers allowlist priority over live /v1/models) + +### Fixed + +- **PR #2640** by @colin-chang — When a `custom_providers` entry in `config.yaml` declares a curated `models:` allowlist (e.g. a ZenMux or other aggregator gateway), respect the curated list instead of also fetching the live `/v1/models` catalog. Without this guard the picker rendered hundreds of online models alongside the user's curated three, swamping the intended selection. The allowlist guard skips the live probe entirely; the existing fall-through to a live probe still runs when no `models:` list is configured. Composes cleanly with #2626 / v0.51.96 — when the live probe is skipped, no `models_endpoint_error` is surfaced (the curated list is the source of truth and probe failures should not show as a user-facing diagnostic in that case). + ## [v0.51.97] — 2026-05-20 — Release BU (stage-390 — 2-PR batch — startup session-index rebuild + config-managed custom-provider cards) ### Fixed