Skip to content

fix: preserve user-defined providers when assigning model via GUI/API - #57114

Closed
mmchuangyt-ai wants to merge 1 commit into
NousResearch:mainfrom
mmchuangyt-ai:main
Closed

fix: preserve user-defined providers when assigning model via GUI/API#57114
mmchuangyt-ai wants to merge 1 commit into
NousResearch:mainfrom
mmchuangyt-ai:main

Conversation

@mmchuangyt-ai

Copy link
Copy Markdown

Summary

_normalize_main_model_assignment() in hermes_cli/web_server.py had a blind spot: when a user-defined provider (configured via config.yaml -> providers:) was used to assign a model through the desktop GUI or /api/model/set, the function checked only built-in _KNOWN_PROVIDER_NAMES and _AGGREGATOR_PROVIDERS. Custom providers like open.cherryin.net matched neither, so the code unconditionally fell back to openrouter, silently overwriting the user configured provider.

Root cause

https://github.com/NousResearch/hermes-agent/blob/30e947e0a/hermes_cli/web_server.py#L998-L1016

The fallback logic at line 998 only handled two cases:

  • Provider is in _KNOWN_PROVIDER_NAMES (built-in) → proceed to model normalization
  • Provider is an aggregator (_AGGREGATOR_PROVIDERS) → keep current provider
  • Everything else → fallback to openrouter ← the bug

Fix

Before falling back to openrouter, check whether the provider slug exists in config.yaml -> providers: (the user-defined provider registry). If it does, return immediately — custom provider namespaces are opaque to the built-in normalizer and should be preserved verbatim.

This aligns the HTTP API behavior with what the CLI hermes model picker already does (which skips _normalize_main_model_assignment entirely for user-defined providers).

Test plan

  1. Set up a custom provider in config.yaml -> providers: (e.g. open.cherryin.net with its own api endpoint)
  2. Open Desktop GUI → Model Settings → Select a model under the custom provider → Apply
  3. Before fix: config.yaml -> model.provider is overwritten to openrouter
  4. After fix: config.yaml -> model.provider correctly stays as the custom provider slug

Related

Fixes an issue where Desktop GUI model selection silently breaks custom providers.

_normalize_main_model_assignment() had a blind spot: when
a user-defined provider (configured via config.yaml -> providers section)
was used to assign a model through the desktop GUI or /api/model/set,
the function checked only built-in _KNOWN_PROVIDER_NAMES and
_AGGREGATOR_PROVIDERS - custom providers like open.cherryin.net
matched neither, so the code unconditionally fell back to openrouter,
silently overwriting the user configured provider.

Fix: before falling back to openrouter, check whether the provider
slug exists in config.yaml -> providers section (the user-defined
provider registry). If it does, return immediately - custom provider
namespaces are opaque to the built-in normalizer and should be
preserved verbatim.

This aligns the HTTP API behavior with what the CLI hermes model
picker already does (which skips _normalize_main_model_assignment
entirely for user-defined providers).
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 2, 2026
@teknium1

Copy link
Copy Markdown
Contributor

This PR’s reported dashboard/API provider-rewrite behavior is already fixed on current main. This is an automated hermes-sweeper review.

  • Commit 9a15fad0d6c370ba09bf87af92144f46ccd2bc4a (fix(web): preserve declared providers in model writes (#63058)) added the consolidated fix.
  • hermes_cli/web_server.py:1063-1082 resolves configured providers: and legacy custom_providers: before the unknown-vendor → OpenRouter fallback.
  • hermes_cli/web_server.py:5819 applies that normalization in POST /api/model/set before persisting configuration.
  • tests/hermes_cli/test_main_model_custom_provider_normalization.py:13-40 covers configured provider preservation, custom-provider canonicalization, and the genuine unknown-vendor fallback.

The later consolidated implementation also covers the related #60337 path referenced in the timeline, so this focused patch is redundant.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants