Skip to content

fix(config): restore custom providers after v11→v12 migration#9016

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-989fd3e1
Apr 13, 2026
Merged

fix(config): restore custom providers after v11→v12 migration#9016
teknium1 merged 1 commit into
mainfrom
hermes/hermes-989fd3e1

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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) into providers (a YAML dict), then deletes the original list. But all runtime resolvers still read custom_providers. After migration, named custom endpoints silently stop resolving — fallback chains fail with AuthError.

The fix: Adds get_compatible_custom_providers() in config.py that 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-)

File What changed
hermes_cli/config.py New: _normalize_custom_provider_entry(), providers_dict_to_custom_providers(), get_compatible_custom_providers(). Migration uses pop() instead of del.
hermes_cli/runtime_provider.py _get_named_custom_provider() uses compat layer; _resolve_named_custom_runtime() supports key_env; provider_key matching
hermes_cli/auth_commands.py _get_custom_provider_names() returns 3-tuple with provider_key
hermes_cli/main.py Model picker + _model_flow_named_custom() handle provider_key + key_env; persist model to correct schema
agent/auxiliary_client.py key_env env var support + custom_entry.get('model') fallback
agent/credential_pool.py _iter_custom_providers() falls back to compat layer
cli.py /model switch passes compat list
gateway/run.py /model switch + context_length lookup use compat layer
run_agent.py Per-model context_length lookup uses compat layer
tests/hermes_cli/test_config.py 4 new tests: migration, runtime compat, URL key priority, dedup
tests/hermes_cli/test_runtime_provider_resolution.py 2 new tests: providers dict resolution, key_env resolution; codex pool mock fix
tests/tools/test_browser_camofox_state.py Fix stale version assertion (15→17)

Extended 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 passing cfg.get('custom_providers')
  • run_agent.py + gateway/run.py: per-model context_length lookup still read the legacy list
  • main.py _model_flow_named_custom(): didn't handle provider_key for config persistence

All of these are now covered.

Test plan

  • 139 targeted tests pass (config, runtime_provider, auxiliary, camofox)
  • 1886 hermes_cli tests pass (17 pre-existing failures unrelated to this change)
  • E2E: post-migration config, runtime resolution from providers dict, key_env, dedup, empty config

Fixes #8776
Closes #8814

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
@teknium1 teknium1 merged commit c449cd1 into main Apr 13, 2026
4 of 6 checks passed
@teknium1 teknium1 deleted the hermes/hermes-989fd3e1 branch April 13, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v11→v12 config migration converts custom_providers → providers: dict, but no runtime code reads providers:

2 participants