Skip to content

[Bug]: Profile model configuration is ignored when using -p flag (timing bug) #4486

Description

@eloklam

Issue: Profile model configuration is ignored when using -p flag

Bug Description

When running Hermes with a specific profile (hermes -p <profile> chat), the model configured in that profile's config.yaml is not being used. Instead, Hermes falls back to the hardcoded default model (anthropic/claude-opus-4.6).

Environment

  • Hermes version: 0.6.0 (2026.3.30)
  • OS: Linux
  • Python: 3.12.3

Reproduction Steps

  1. Create a profile with a specific model:
hermes profile create orchestrator
  1. Configure ~/.hermes/profiles/orchestrator/config.yaml:
model:
  provider: fireworks
  model: fireworks-ai/accounts/fireworks/routers/kimi-k2p5-turbo
  api_key: <your-key>
  1. Verify profile shows correct model:
$ hermes profile show orchestrator
Profile: orchestrator
Model:   fireworks-ai/accounts/fireworks/routers/kimi-k2p5-turbo ✅
  1. Run with profile:
$ hermes -p orchestrator chat
⚕ claude-opus-4.6 · 0:05          ❌ Wrong model!

Expected Behavior

When running hermes -p orchestrator chat, the CLI should use the model from ~/.hermes/profiles/orchestrator/config.yaml.

Actual Behavior

The CLI uses the hardcoded default model claude-opus-4.6, ignoring the profile config.

Root Cause Analysis

The issue is a timing problem in the config loading sequence:

  1. In cli.py line 465:

    CLI_CONFIG = load_cli_config()

    This is evaluated at module import time.

  2. In hermes_cli/main.py:

    _apply_profile_override()  # Sets HERMES_HOME based on -p flag
    # ...later...
    from cli import HermesCLI  # cli.py is imported AFTER profile override

    BUT load_cli_config() at line 135 uses:

    user_config_path = _hermes_home / "config.yaml"

    Where _hermes_home is evaluated at module load time (line 76):

    _hermes_home = get_hermes_home()  # Cached before profile override
  3. Result: CLI_CONFIG loads from the default ~/.hermes/config.yaml, not the profile's config.

Affected Code Locations

cli.py line 135:

user_config_path = _hermes_home / 'config.yaml'  # Uses cached value

cli.py line 76:

_hermes_home = get_hermes_home()  # Evaluated before profile override

cli.py line 1097-1099 (HermesCLI.__init__):

_model_config = CLI_CONFIG.get("model", {})
_config_model = (_model_config.get("default") or _model_config.get("model") or "")
self.model = model or _config_model or _DEFAULT_CONFIG_MODEL  # Falls back to opus

Workaround

Until this is fixed, users must:

  1. Set the model in the root ~/.hermes/config.yaml instead of profile configs
  2. Or add default: <model> to profile configs (in addition to model:)

Suggested Fix

Change cli.py line 135 to use get_hermes_home() directly instead of the cached _hermes_home:

-    user_config_path = _hermes_home / 'config.yaml'
+    user_config_path = get_hermes_home() / 'config.yaml'

This ensures the current HERMES_HOME env var is read each time load_cli_config() is called.

Additional Context

This bug defeats the purpose of profile-based configurations. Users expect profiles to be self-contained, but currently the root config's defaults interfere with profile configs due to the merge behavior + hardcoded fallback.

Labels

  • bug
  • config
  • profiles
  • high-priority

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions