Skip to content

fix: setup wizard overwrites custom endpoint config with OpenRouter defaults#3688

Closed
patlegu wants to merge 1 commit into
NousResearch:mainfrom
patlegu:fix/setup-wizard-custom-endpoint-overwrite
Closed

fix: setup wizard overwrites custom endpoint config with OpenRouter defaults#3688
patlegu wants to merge 1 commit into
NousResearch:mainfrom
patlegu:fix/setup-wizard-custom-endpoint-overwrite

Conversation

@patlegu

@patlegu patlegu commented Mar 29, 2026

Copy link
Copy Markdown

Problem

When selecting Custom OpenAI-compatible endpoint in the setup wizard, the settings entered by the user (base URL, model name) are silently overwritten by the OpenRouter defaults after the wizard completes.

Symptoms: ~/.hermes/config.yaml ends up with:

model:
  base_url: https://openrouter.ai/api/v1
  default: anthropic/claude-opus-4.6

instead of the user-provided values (e.g. http://localhost:11434/v1 + local model).

Root Cause

_model_flow_custom() (main.py) loads its own independent copy of config via load_config(), applies the custom endpoint settings, and saves it. However, the caller setup_model_provider() (setup.py) holds a separate config dict loaded at wizard startup. The final save_config(config) call at line 1802 of setup.py overwrites everything _model_flow_custom() just saved.

Fix

Reload config in setup.py immediately after _model_flow_custom() returns, so the caller's copy reflects the saved changes before the final write.

from hermes_cli.main import _model_flow_custom
_model_flow_custom(config)
# _model_flow_custom saves config independently (loads its own copy).
# Reload here so the final save_config(config) below doesn't overwrite it.
from hermes_cli.config import load_config as _reload_config
config.update(_reload_config())

One line added, no refactoring. _model_flow_custom() logic is untouched.

Reproduction

  1. Run hermes setup
  2. Select Custom OpenAI-compatible endpoint
  3. Enter http://localhost:11434/v1 as base URL, ollama as API key, qwen2.5-coder:14b as model
  4. Complete the wizard
  5. cat ~/.hermes/config.yamlmodel.base_url is still https://openrouter.ai/api/v1

Tested with Ollama on WSL2.

_model_flow_custom() loads and saves its own config copy independently.
When called from setup_model_provider(), the final save_config(config)
was overwriting the custom endpoint settings with stale OpenRouter defaults.

Reload config after _model_flow_custom returns so the caller's copy
reflects the saved changes before the final write.
@dieutx

dieutx commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Pretty sure #4180 already addressed this — the custom flow now syncs the in-memory config dict before the wizard's final save.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels May 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #4180 (merged) — same root cause: _model_flow_custom() saves config independently but caller in setup.py overwrites with stale copy.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #4180 (merged) — same root cause: _model_flow_custom() saves config independently but caller in setup.py overwrites with stale copy.

@teknium1

Copy link
Copy Markdown
Contributor

Closed in favour of @stepanov1975's broader PR #22074, which was salvaged onto current main via #28882. Your fix correctly identified the bug but was narrower (only the custom path); #22074's config.clear(); config.update(reload) preserves every section the picker may have touched (auxiliary, providers, model_aliases, …). Thanks for the original report and patch.

@teknium1 teknium1 closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants