Skip to content

fix(setup): persist provider when switching model endpoints#951

Closed
StefanIsMe wants to merge 1 commit into
NousResearch:mainfrom
StefanIsMe:fix/setup-model-provider-switch
Closed

fix(setup): persist provider when switching model endpoints#951
StefanIsMe wants to merge 1 commit into
NousResearch:mainfrom
StefanIsMe:fix/setup-model-provider-switch

Conversation

@StefanIsMe

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a provider-selection persistence bug in hermes setup model.

Problem:

  • If a user had custom selected and then changed models/providers in setup, Hermes could keep
    HERMES_INFERENCE_PROVIDER=custom, causing runtime/provider mismatch.

What this changes:

  • Normalizes Keep current to an explicit provider before model selection.
  • Persists HERMES_INFERENCE_PROVIDER in provider/model flows (including OpenAI Codex and custom endpoint flows).
  • Prevents setup from silently falling through to the wrong provider behavior.

Why this approach:

  • Fixes the issue at the source (setup model flow) instead of requiring manual .env edits.

Related Issue

N/A (no issue opened)

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated provider persistence and selection logic in:
    • hermes_cli/setup.py
    • hermes_cli/main.py
  • Added regression tests:
    • tests/test_setup_model_provider.py
      • test_setup_keep_current_custom_does_not_fall_through
      • test_setup_switch_custom_to_codex_updates_provider

How to Test

  1. Start from a custom endpoint setup (HERMES_INFERENCE_PROVIDER=custom, OPENAI_BASE_URL set).
  2. Run hermes setup model, select Login with OpenAI Codex, choose a Codex model.
  3. Verify:
    • HERMES_INFERENCE_PROVIDER=openai-codex
    • OPENAI_BASE_URL is cleared
    • Hermes runs using Codex provider without custom-provider mismatch.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):,
    feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a
    duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 11 (WSL2 Ubuntu)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A (N/A)
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A (N/A)
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A (N/A)
  • I've considered cross-platform impact (Windows, macOS) per the [compatibility guide](https://github.com/
    NousResearch/hermes-agent/blob/main/CONTRIBUTING.md#cross-platform-compatibility) — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A (N/A)

Screenshots / Logs

Targeted regression tests:

  • pytest -q tests/test_setup_model_provider.py
  • Result: 2 passed

@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #1283. Your substantive setup-side fix was cherry-picked and adapted onto current main, but we narrowed it to the keep-current/provider-selection pieces that still mattered because current main already handles most of the broader provider persistence through config-first resolution. Thanks again for the contribution.

@teknium1 teknium1 closed this Mar 14, 2026
@StefanIsMe StefanIsMe deleted the fix/setup-model-provider-switch branch April 11, 2026 17:00
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…f48b210a

fix(setup): salvage keep-current provider handling from NousResearch#951
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…f48b210a

fix(setup): salvage keep-current provider handling from NousResearch#951
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…f48b210a

fix(setup): salvage keep-current provider handling from NousResearch#951
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…f48b210a

fix(setup): salvage keep-current provider handling from NousResearch#951
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.

2 participants