openclaw - 💡(How to fix) Fix Telegram routed agent sessions do not honor agents.list[].model per-agent override [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#54883Fetched 2026-04-08 01:34:50
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

When I create a dedicated agent with its own Telegram bot binding and set agents.list[].model.primary to an Ollama model, the routed Telegram session does not actually run on that configured per-agent model.

Instead:

  • the session appears to target the configured Ollama model
  • session_status reports the configured Ollama model
  • but the actual session log and runtime replies are generated by openai-codex/gpt-5.4

This makes the active runtime model differ from the model reported by status/tooling.


Root Cause

When I create a dedicated agent with its own Telegram bot binding and set agents.list[].model.primary to an Ollama model, the routed Telegram session does not actually run on that configured per-agent model.

Instead:

  • the session appears to target the configured Ollama model
  • session_status reports the configured Ollama model
  • but the actual session log and runtime replies are generated by openai-codex/gpt-5.4

This makes the active runtime model differ from the model reported by status/tooling.


Code Example

{
  "id": "ollama-agent",
  "model": {
    "primary": "ollama/gpt-oss:120b",
    "fallbacks": [
      "openai-codex/gpt-5.4",
      "github-copilot/gpt-4o"
    ]
  }
}

---

"model": {
  "primary": "ollama/gpt-oss:120b",
  "fallbacks": [
    "openai-codex/gpt-5.4",
    "github-copilot/gpt-4o"
  ]
}

---

{
  "type": "route",
  "agentId": "ollama-agent",
  "match": {
    "channel": "telegram",
    "accountId": "ollama-agent"
  }
}

---

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "openai-codex/gpt-5.4",
        "fallbacks": [
          "ollama/gpt-oss:120b",
          "github-copilot/gpt-4o"
        ]
      },
      "models": {
        "openai-codex/gpt-5.4": {},
        "github-copilot/gpt-4o": {},
        "ollama/gpt-oss:120b": {}
      }
    },
    "list": [
      {
        "id": "ollama-agent",
        "workspace": "...",
        "agentDir": "...",
        "model": {
          "primary": "ollama/gpt-oss:120b",
          "fallbacks": [
            "openai-codex/gpt-5.4",
            "github-copilot/gpt-4o"
          ]
        }
      }
    ]
  },
  "bindings": [
    {
      "type": "route",
      "agentId": "ollama-agent",
      "match": {
        "channel": "telegram",
        "accountId": "ollama-agent"
      }
    }
  ],
  "channels": {
    "telegram": {
      "accounts": {
        "ollama-agent": {
          "botToken": "configured"
        }
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Telegram routed agent sessions do not honor agents.list[].model per-agent override; runtime still uses fallback/default model

Summary

When I create a dedicated agent with its own Telegram bot binding and set agents.list[].model.primary to an Ollama model, the routed Telegram session does not actually run on that configured per-agent model.

Instead:

  • the session appears to target the configured Ollama model
  • session_status reports the configured Ollama model
  • but the actual session log and runtime replies are generated by openai-codex/gpt-5.4

This makes the active runtime model differ from the model reported by status/tooling.


Environment

  • OpenClaw version: 2026.3.11
  • Host: macOS arm64
  • Channel: Telegram
  • Providers involved:
    • openai-codex/gpt-5.4
    • ollama/gpt-oss:120b
  • Ollama endpoint:
    • remote Ollama at http://172.28.28.158:11434
  • Routing style:
    • top-level bindings[] mapping Telegram accountId to a dedicated agentId

Expected behavior

A Telegram message routed to an agent with:

{
  "id": "ollama-agent",
  "model": {
    "primary": "ollama/gpt-oss:120b",
    "fallbacks": [
      "openai-codex/gpt-5.4",
      "github-copilot/gpt-4o"
    ]
  }
}

should actually execute on ollama/gpt-oss:120b, unless that model truly fails.

If fallback occurs, the failure reason should be surfaced clearly, and status output should distinguish configured vs active runtime model.


Actual behavior

For a Telegram-routed dedicated agent:

  • the bot replies successfully
  • session_status reports:
    • Model: ollama/gpt-oss:120b
    • Fallback: openai-codex/gpt-5.4
  • the agent then answers ollama/gpt-oss:120b when asked which model it is using
  • however, the actual session log shows:
    • provider: openai-codex
    • model: gpt-5.4
  • openclaw status also shows the active session model as gpt-5.4

So the configured model / reported model and the actual generation model diverge.


Reproduction steps

  1. Configure a custom Ollama provider reachable from OpenClaw.
  2. Add a dedicated agent in agents.list[], for example ollama-agent.
  3. Set:
"model": {
  "primary": "ollama/gpt-oss:120b",
  "fallbacks": [
    "openai-codex/gpt-5.4",
    "github-copilot/gpt-4o"
  ]
}
  1. Bind a Telegram bot/account to that agent:
{
  "type": "route",
  "agentId": "ollama-agent",
  "match": {
    "channel": "telegram",
    "accountId": "ollama-agent"
  }
}
  1. Send a message to that Telegram bot.
  2. Observe:
    • the reply works
    • openclaw status shows the session model as gpt-5.4
    • the session JSONL entries show provider=openai-codex, model=gpt-5.4
    • session_status inside the same session reports ollama/gpt-oss:120b

Relevant config shape

Simplified config:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "openai-codex/gpt-5.4",
        "fallbacks": [
          "ollama/gpt-oss:120b",
          "github-copilot/gpt-4o"
        ]
      },
      "models": {
        "openai-codex/gpt-5.4": {},
        "github-copilot/gpt-4o": {},
        "ollama/gpt-oss:120b": {}
      }
    },
    "list": [
      {
        "id": "ollama-agent",
        "workspace": "...",
        "agentDir": "...",
        "model": {
          "primary": "ollama/gpt-oss:120b",
          "fallbacks": [
            "openai-codex/gpt-5.4",
            "github-copilot/gpt-4o"
          ]
        }
      }
    ]
  },
  "bindings": [
    {
      "type": "route",
      "agentId": "ollama-agent",
      "match": {
        "channel": "telegram",
        "accountId": "ollama-agent"
      }
    }
  ],
  "channels": {
    "telegram": {
      "accounts": {
        "ollama-agent": {
          "botToken": "configured"
        }
      }
    }
  }
}

Evidence

openclaw status

Shows a routed session like:

  • agent:ollama-agent:telegram:direct:...
  • model shown as gpt-5.4

Session metadata

The session metadata includes:

  • fallbackNoticeSelectedModel = ollama/gpt-oss:120b
  • fallbackNoticeActiveModel = openai-codex/gpt-5.4

Session JSONL

The actual assistant messages are recorded with:

  • provider: openai-codex
  • model: gpt-5.4

session_status inconsistency

Inside the same session, session_status reports:

  • Model: ollama/gpt-oss:120b
  • Fallback: openai-codex/gpt-5.4

But the actual generation entries are still gpt-5.4.


Why this seems buggy

This appears to be one of:

  1. agents.list[].model is not actually applied for Telegram-routed sessions
  2. runtime falls back immediately but does not expose the actual failure reason clearly
  3. session_status reports configured/selected model rather than active generation model
  4. model selection and model reporting are inconsistent for routed agent sessions

Suggested fixes

  1. Ensure Telegram routed sessions actually honor agents.list[].model
  2. If fallback occurs before first generation, surface the real reason clearly
  3. Make session_status distinguish:
    • configured target model
    • selected model
    • active generation model
  4. Align openclaw status, session_status, and JSONL runtime metadata

Additional note

I also observed similar behavior when trying to apply per-agent model overrides to main, where new Telegram sessions still used the global default model rather than the agent-specific primary model. That may indicate this is not limited to a single custom agent, but a broader issue with routed session model resolution.

extent analysis

Fix Plan

To address the issue where Telegram routed agent sessions do not honor the agents.list[].model per-agent override, follow these steps:

  1. Update Model Selection Logic: Modify the model selection logic to prioritize the agents.list[].model configuration for routed sessions.
  2. Improve Fallback Handling: Enhance fallback handling to clearly surface the reason for fallback and ensure that the actual generation model is reported accurately.
  3. Unify Model Reporting: Align openclaw status, session_status, and JSONL runtime metadata to consistently report the active generation model.

Example Code Changes:

# In the model selection function
def select_model(agent_config, session_config):
    # Prioritize agent-specific model configuration
    if agent_config.get('model'):
        return agent_config['model']['primary']
    # Fallback to global default model
    return session_config['defaults']['model']['primary']

# In the fallback handling function
def handle_fallback(fallback_reason, selected_model, active_model):
    # Surface the fallback reason clearly
    logging.info(f'Fallback reason: {fallback_reason}')
    # Report the active generation model accurately
    return active_model

# In the session status function
def get_session_status(session):
    # Distinguish between configured, selected, and active generation models
    configured_model = session['agent_config']['model']['primary']
    selected_model = session['selected_model']
    active_model = session['active_model']
    return {
        'Configured Model': configured_model,
        'Selected Model': selected_model,
        'Active Model': active_model
    }

Verification

To verify that the fix worked:

  1. Configure a custom Ollama provider and a dedicated agent with a per-agent model override.
  2. Send a message to the Telegram bot bound to the dedicated agent.
  3. Check the openclaw status output to ensure that the active generation model matches the configured model.
  4. Verify that the session JSONL entries report the correct provider and model.
  5. Confirm that session_status accurately distinguishes between the configured, selected, and active generation models.

Extra Tips

  • Ensure that the agents.list[].model configuration is correctly applied to routed sessions.
  • Test the fallback handling to ensure that the reason for fallback is clearly surfaced.
  • Review the model reporting to ensure consistency across openclaw status, session_status, and JSONL runtime metadata.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

A Telegram message routed to an agent with:

{
  "id": "ollama-agent",
  "model": {
    "primary": "ollama/gpt-oss:120b",
    "fallbacks": [
      "openai-codex/gpt-5.4",
      "github-copilot/gpt-4o"
    ]
  }
}

should actually execute on ollama/gpt-oss:120b, unless that model truly fails.

If fallback occurs, the failure reason should be surfaced clearly, and status output should distinguish configured vs active runtime model.


Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Telegram routed agent sessions do not honor agents.list[].model per-agent override [1 participants]