Skip to content

C:/Program Files/Git/model command shows config model instead of active fallback model #1615

@MaxKerkula

Description

@MaxKerkula

Bug

When the primary model hits a rate limit and the agent falls back to a backup model (e.g., minimax/minimax-m2.5 via OpenRouter), the /model command still displays the primary model from config.yaml (e.g., gpt-5.4). The agent itself also reports the wrong model when asked.

Steps to Reproduce

  1. Configure a primary model (gpt-5.4 via openai-codex) with a fallback (minimax/minimax-m2.5 via openrouter)
  2. Send messages until the primary model's rate limit is hit
  3. Observe Fallback activated: gpt-5.4 → minimax/minimax-m2.5 (openrouter) in logs
  4. Send /model in Telegram
  5. Response shows Current model: gpt-5.4 / Provider: OpenAI Codex — wrong

Root Cause

_handle_model_command in gateway/run.py reads the model from config.yaml and env vars:

current = os.getenv("HERMES_MODEL") or "gpt-5.4"
# ... then reads config.yaml model.default

But _try_activate_fallback in run_agent.py only updates the AIAgent instance's runtime state (self.model, self.provider), which is discarded after the agent run completes. The gateway has no persistent record that a fallback is active.

Expected Behavior

/model should show the actually active model and indicate when running on a fallback:

🤖 Current model: minimax/minimax-m2.5 (fallback)
Provider: OpenRouter
Primary model (gpt-5.4 via OpenAI Codex) is rate-limited.

Environment

  • Hermes Agent v0.2.x (latest main)
  • Gateway mode with Telegram
  • Primary: gpt-5.4 via openai-codex
  • Fallback: minimax/minimax-m2.5 via openrouter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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