Skip to content

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

Open
patlegu wants to merge 1 commit intoNousResearch:mainfrom
patlegu:fix/setup-wizard-custom-endpoint-overwrite
Open

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

Conversation

@patlegu
Copy link
Copy Markdown

@patlegu patlegu commented Mar 29, 2026

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.
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.

1 participant