fix(config): restore custom providers after v11→v12 migration#9016
Merged
Conversation
The v11→v12 migration converts custom_providers (list) into providers (dict), then deletes the list. But all runtime resolvers read from custom_providers — after migration, named custom endpoints silently stop resolving and fallback chains fail with AuthError. Add get_compatible_custom_providers() that reads from both config schemas (legacy custom_providers list + v12+ providers dict), normalizes entries, deduplicates, and returns a unified list. Update ALL consumers: - hermes_cli/runtime_provider.py: _get_named_custom_provider() + key_env - hermes_cli/auth_commands.py: credential pool provider names - hermes_cli/main.py: model picker + _model_flow_named_custom() - agent/auxiliary_client.py: key_env + custom_entry model fallback - agent/credential_pool.py: _iter_custom_providers() - cli.py + gateway/run.py: /model switch custom_providers passthrough - run_agent.py + gateway/run.py: per-model context_length lookup Also: use config.pop() instead of del for safer migration, fix stale _config_version assertions in tests, add pool mock to codex test. Co-authored-by: 墨綠BG <s5460703@gmail.com> Closes #8776, salvaged from PR #8814
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
Salvaged from PR #8814 by 墨綠BG (@BlackishGreen33), with extended coverage to all consumers.
The bug: The v11→v12 config migration converts
custom_providers(a YAML list) intoproviders(a YAML dict), then deletes the original list. But all runtime resolvers still readcustom_providers. After migration, named custom endpoints silently stop resolving — fallback chains fail withAuthError.The fix: Adds
get_compatible_custom_providers()inconfig.pythat reads from both config schemas (legacy list + v12+ dict), normalises entries, deduplicates, and returns a unified list. All consumers now use this function.Changes (12 files, 496+/73-)
hermes_cli/config.py_normalize_custom_provider_entry(),providers_dict_to_custom_providers(),get_compatible_custom_providers(). Migration usespop()instead ofdel.hermes_cli/runtime_provider.py_get_named_custom_provider()uses compat layer;_resolve_named_custom_runtime()supportskey_env;provider_keymatchinghermes_cli/auth_commands.py_get_custom_provider_names()returns 3-tuple withprovider_keyhermes_cli/main.py_model_flow_named_custom()handleprovider_key+key_env; persist model to correct schemaagent/auxiliary_client.pykey_envenv var support +custom_entry.get('model')fallbackagent/credential_pool.py_iter_custom_providers()falls back to compat layercli.py/modelswitch passes compat listgateway/run.py/modelswitch + context_length lookup use compat layerrun_agent.pytests/hermes_cli/test_config.pytests/hermes_cli/test_runtime_provider_resolution.pytests/tools/test_browser_camofox_state.pyExtended coverage beyond PR #8814
The original PR fixed the core runtime path but missed several consumers:
cli.py+gateway/run.py: /model switch was still passingcfg.get('custom_providers')run_agent.py+gateway/run.py: per-model context_length lookup still read the legacy listmain.py_model_flow_named_custom(): didn't handleprovider_keyfor config persistenceAll of these are now covered.
Test plan
Fixes #8776
Closes #8814