fix(config): preserve api_key during provider migration for unauthenticated servers - #29576
Open
chimpera wants to merge 1 commit into
Open
fix(config): preserve api_key during provider migration for unauthenticated servers#29576chimpera wants to merge 1 commit into
chimpera wants to merge 1 commit into
Conversation
…icated servers The v11→v12 config migration (custom_providers list → providers dict) stripped api_key values matching "no-key" or "no-key-required" from migrated entries. These are legitimate values used by self-hosted backends (llama.cpp, Ollama, vLLM, etc.) that expose an OpenAI-compatible /v1/models endpoint but don't require authentication. Without the api_key, model discovery is skipped entirely (see model_switch.py list_authenticated_providers Section 3), causing the /model picker to only show the single default_model instead of the full catalog. Users who add a placeholder api_key to work around this lose it on every config migration triggered by an update. Stop filtering out these values — only skip empty strings. If a user explicitly configured an api_key (even a placeholder), the migration should preserve it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Thanks for identifying the legacy migration path. The reported model-picker behavior is already addressed on current main, but retaining placeholder strings remains a separate config-UX decision. Problems
Suggested changes
Automated hermes-sweeper review. |
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
custom_providerslist →providersdict) strippedapi_keyvalues matching"no-key"or"no-key-required"from migrated entries/v1/modelsbut don't require authenticationapi_key, model discovery is skipped entirely (seemodel_switch.pySection 3), causing the/modelpicker to only showdefault_modelinstead of the full catalogapi_keyto work around this lose it on every config migration triggered by an updateProblem
A user adds a placeholder
api_keyto enable model discovery for their local server:This works — the
/modelpicker shows all models from/v1/models. But the nexthermes updatetriggers a config migration that runs:The
api_keyis silently stripped. After restart, the picker reverts to showing onlydefault_model.Fix
Stop filtering out
"no-key"and"no-key-required". Only skip empty strings:If a user explicitly configured an
api_key— even a placeholder — the migration should preserve it.Relationship to #29575
This PR addresses the same underlying problem from a different angle. #29575 fixes the discovery logic so providers without an
api_keycan still be probed. This PR fixes the migration so placeholder keys aren't silently stripped. Both fixes are independently valid; together they fully resolve the issue.Test plan
api_key: no-key-requiredto a provider entryapi_keyis preserved in the migratedproviders:dict entry🤖 Generated with Claude Code