Skip to content

fix(cli): preserve wizard config + honour custom-provider aliases (#22074, #27132)#28882

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-008bccbc
May 19, 2026
Merged

fix(cli): preserve wizard config + honour custom-provider aliases (#22074, #27132)#28882
teknium1 merged 2 commits into
mainfrom
hermes/hermes-008bccbc

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Closes two long-standing custom-endpoint persistence bugs that together cause provider: ollama (or any local-server alias) on a LAN IP to silently 401 against OpenRouter.

What changes

1. Wizard re-syncs the full config dict, not just model + custom_providers — salvage of @stepanov1975's PR #22074.
setup.py:setup_model_provider() previously only refreshed model and custom_providers from disk after the shared model picker wrote. Any neighbouring section the picker touched (auxiliary, providers, model_aliases, credential_pool_strategies) was then overwritten with stale values by the wizard's final save_config(config). The fix is the obvious config.clear(); config.update(load_config()).

2. Runtime treats ollama/vllm/llamacpp/llama-cpp like custom for base_url trustcloses #27132.
auth.resolve_provider() correctly normalises those aliases to "custom" at the top level, but two sites in runtime_provider.py were still string-comparing the original alias against the literal "custom":

  • _config_base_url_trustworthy_for_bare_custom() rejected non-loopback URLs because cfg_provider_norm was "ollama", not "custom".
  • _resolve_openrouter_runtime() only entered the trust branch when requested_norm == "custom".
    Both sites now consult resolve_provider() and treat any alias that resolves to "custom" identically. No duplicated alias map.

Without #2, even with #1's wizard fix the user's saved provider: ollama config would still fall through to OpenRouter at runtime — they're the two halves of the same user-visible bug ("local endpoint selection does not persist → 401 on next start").

Validation

$ scripts/run_tests.sh tests/hermes_cli/ -k 'resolve or runtime or provider or custom'
1311 passed in 17.50s

E2E (live import, isolated HERMES_HOME, only OPENROUTER_API_KEY set):

config before after
provider: ollama + LAN IP openrouter (401) custom, LAN IP
provider: vllm + LAN IP openrouter (401) custom, LAN IP
provider: llamacpp + LAN IP openrouter (401) custom, LAN IP
provider: ollama + loopback openrouter (worse than #27132 reported) custom, loopback
provider: custom + LAN IP custom (already worked) custom (unchanged)
provider: openrouter openrouter (unchanged) openrouter (unchanged)

Three new tests in test_runtime_provider_resolution.py lock in the alias behaviour as a contract.

Credits / supersedes

Closes

stepanov1975 and others added 2 commits May 19, 2026 11:24
Resync the setup wizard's in-memory config after the shared model picker writes to disk so the wizard's final save does not overwrite auxiliary choices or other provider updates.\n\nAdds a regression test for auxiliary task choices saved by the picker.
…for base_url trust (#27132)

When config.yaml has provider: ollama (or vllm/llamacpp/llama-cpp) with a
non-loopback base_url, auth.py's resolve_provider() correctly normalises
the alias to 'custom' at the top level, but two sites in runtime_provider.py
were still comparing the *original* string against the literal 'custom':

  - _config_base_url_trustworthy_for_bare_custom() rejected non-loopback
    URLs because cfg_provider_norm was 'ollama', not 'custom'.
  - _resolve_openrouter_runtime() only entered the trust branch when
    requested_norm == 'custom'.

Both sites now consult resolve_provider() and treat any alias that
resolves to 'custom' identically. Result: provider: ollama + LAN IP no
longer silently falls through to OpenRouter (HTTP 401), matching the
behaviour of provider: custom with the same base_url.

E2E verified across 6 cases (ollama/vllm/llamacpp/custom + LAN; ollama +
loopback; openrouter + cloud) — all route to the configured endpoint;
'frobnicate' + LAN still rejects with AuthError as before.

Also adds scripts/release.py AUTHOR_MAP entry for @stepanov1975
(PR #22074 — wizard config picker preservation, cherry-picked into the
preceding commit).
@github-actions

Copy link
Copy Markdown
Contributor

🚨 CRITICAL Supply Chain Risk Detected

This PR contains a pattern that has been used in real supply chain attacks. A maintainer must review the flagged code carefully before merging.

🚨 CRITICAL: Install-hook file added or modified

These files can execute code during package installation or interpreter startup.

Files:

hermes_cli/setup.py

Scanner only fires on high-signal indicators: .pth files, base64+exec/eval combos, subprocess with encoded commands, or install-hook files. Low-signal warnings were removed intentionally — if you're seeing this comment, the finding is worth inspecting.

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-008bccbc vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8969 on HEAD, 8969 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4724 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles area/auth Authentication, OAuth, credential pools P1 High — major feature broken, no workaround labels May 19, 2026
@teknium1 teknium1 merged commit 6a159be into main May 19, 2026
19 of 21 checks passed
@teknium1 teknium1 deleted the hermes/hermes-008bccbc branch May 19, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider aliases (ollama/vllm/llamacpp) silently fall through to OpenRouter when base_url is a LAN or remote IP

3 participants