Skip to content

[Bug]: hermes setup can overwrite auxiliary model choices saved by picker #22073

@stepanov1975

Description

@stepanov1975

Bug Description

hermes setup can overwrite configuration changes made by the shared model/provider picker before the setup wizard exits.

This affects auxiliary task model choices made during setup. For example, if the picker writes an auxiliary override such as:

auxiliary:
  compression:
    provider: gemini
    model: gemini-2.5-flash

the setup wizard can later save its stale in-memory config snapshot and reset that choice back to auto.

This is the same stale-config class as the custom-provider overwrite issue, but the current resync only preserves selected top-level keys (model, custom_providers). Any other section written by the shared picker can still be lost.

Steps to Reproduce

  1. Start with default config where auxiliary.compression.provider is auto.
  2. Run the setup model flow and choose an auxiliary model/provider override from the delegated picker path.
  3. Allow setup to complete so the outer wizard performs its final save_config(config).
  4. Inspect ~/.hermes/config.yaml.

Minimal regression shape:

  1. Load setup's in-memory config.
  2. Simulate select_provider_and_model() writing auxiliary.compression.provider = gemini and model = gemini-2.5-flash to disk.
  3. Return to setup_model_provider().
  4. Call save_config(config) as the setup wizard does on exit.

Expected Behavior

Any config changes written by the shared model/provider picker should survive the setup wizard's final save, including auxiliary task choices and future picker-owned sections.

Actual Behavior

The final setup save can write the older in-memory config object back to disk, reverting picker-written values. Current code only resyncs a small whitelist (model, custom_providers), so auxiliary choices can still be lost.

Affected Component

  • Setup / Installation
  • Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Not attached. This is a local code-path regression with a focused unit test reproduction; no credentials or runtime logs are needed to reproduce it.

Operating System

Ubuntu 24.04

Python Version

Python 3.11.15

Hermes Version

Hermes Agent v0.13.0 (2026.5.7), observed against commit 242da9db9.

Additional Logs / Traceback (optional)

No traceback; this is silent config loss.

Root Cause Analysis (optional)

setup_model_provider(config) delegates to select_provider_and_model(). That picker and its subflows perform their own load_config() / save_config() cycle and write to config.yaml directly.

The outer setup wizard still holds the earlier config dict loaded at wizard startup. When setup later calls save_config(config), that stale object can overwrite what the picker wrote.

The current code partially mitigates this by copying back model and custom_providers after the picker returns, but the same root cause applies to any picker-written section, including auxiliary.

Proposed Fix (optional)

After the shared picker returns, reload config.yaml and refresh the caller's dict in place:

_refreshed = load_config()
config.clear()
config.update(_refreshed)

This preserves object identity for the rest of setup while ensuring the final wizard save uses the latest on-disk config.

Are you willing to submit a PR for this?

Yes. PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions