HERMES-GIELIE/api
Sanjay Santhanam a958c29373 fix(config): phantom Custom group when active provider is ai-gateway (#1881)
Two bugs in get_available_models() conspired to duplicate the active
provider's auto-detected models under a phantom 'Custom' group whenever
custom_providers was also declared in config.yaml:

1. custom:* PIDs not in _named_custom_groups (e.g. stale slugs left from
   prior configs) fell through to the auto_detected_models fallback, copying
   the active provider's whole catalog into a phantom Custom: <slug> group.
   Fix: continue unconditionally for ANY custom:* PID — the named-group
   branch is the only legitimate population path.

2. The bare 'custom' PID, with the active provider being concrete (e.g.
   ai-gateway), hit 'elif auto_detected_models: copy.deepcopy(...)' and
   built a duplicate Custom group of the active provider's models with
   mismatched provider prefixes. Fix: when pid == 'custom' and the active
   provider is non-custom, leave models_for_group empty.

The reporter also suggested a third fix gating resolve_model_provider() on
config_provider — that's intentionally NOT applied because it conflicts with
the long-standing model-specific-override semantics covered by
test_model_resolver.py::test_custom_provider_*_routes_to_named_custom_provider
(custom_providers entries explicitly override the active provider's routing
when the user opted-in). The reporter's symptom (duplicate UI group) lives
entirely in get_available_models()'s group construction and is fully fixed
by the two changes above.

Tests: 6 new regression tests (3 in #1881 file + reuse), 774 broader
tests still green (model/provider/custom/config domain).
2026-05-08 15:15:49 +00:00
..
__init__.py
agent_health.py
agent_sessions.py fix: keep cross-surface session continuations visible 2026-05-07 16:58:39 +00:00
auth.py
background.py
clarify.py
commands.py
config.py fix(config): phantom Custom group when active provider is ai-gateway (#1881) 2026-05-08 15:15:49 +00:00
dashboard_probe.py
extensions.py
gateway_watcher.py
helpers.py fix: add cdn.jsdelivr.net to CSP connect-src to allow xterm source map fetches 2026-05-07 20:42:55 +00:00
kanban_bridge.py stage-315 absorb: document handle_kanban_* three-valued return contract 2026-05-07 18:52:01 +00:00
metering.py
models.py fix: persist generated title refresh marker 2026-05-08 01:36:10 +02:00
oauth.py fix(oauth): serialize Anthropic env fallback reads 2026-05-07 02:47:19 +00:00
onboarding.py
profiles.py
providers.py Stage 314: PR #1827 — sync Codex provider card models with picker by @Michaelyklam 2026-05-07 17:58:52 +00:00
rollback.py
routes.py fix: preserve pending turn during stale cleanup 2026-05-07 23:57:01 +02:00
session_ops.py
session_recovery.py
startup.py
state_sync.py
streaming.py fix: show auto-compression running state 2026-05-07 18:41:13 +00:00
system_health.py
terminal.py
updates.py
upload.py
workspace.py fix: preserve inaccessible workspace entries 2026-05-07 16:56:48 +00:00