fix: preserve user-defined providers when assigning model via GUI/API - #57114
Closed
mmchuangyt-ai wants to merge 1 commit into
Closed
fix: preserve user-defined providers when assigning model via GUI/API#57114mmchuangyt-ai wants to merge 1 commit into
mmchuangyt-ai wants to merge 1 commit into
Conversation
_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).
This was referenced Jul 7, 2026
Contributor
|
This PR’s reported dashboard/API provider-rewrite behavior is already fixed on current
The later consolidated implementation also covers the related #60337 path referenced in the timeline, so this focused patch is redundant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_normalize_main_model_assignment()inhermes_cli/web_server.pyhad a blind spot: when a user-defined provider (configured viaconfig.yaml -> providers:) was used to assign a model through the desktop GUI or/api/model/set, the function checked only built-in_KNOWN_PROVIDER_NAMESand_AGGREGATOR_PROVIDERS. Custom providers likeopen.cherryin.netmatched neither, so the code unconditionally fell back toopenrouter, 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:
_KNOWN_PROVIDER_NAMES(built-in) → proceed to model normalization_AGGREGATOR_PROVIDERS) → keep current providerFix
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 modelpicker already does (which skips_normalize_main_model_assignmententirely for user-defined providers).Test plan
config.yaml -> providers:(e.g.open.cherryin.netwith its ownapiendpoint)config.yaml -> model.provideris overwritten toopenrouterconfig.yaml -> model.providercorrectly stays as the custom provider slugRelated
Fixes an issue where Desktop GUI model selection silently breaks custom providers.