openclaw - 💡(How to fix) Fix Hot reload of agents.defaults.model.primary overrides channels.modelByChannel for existing sessions

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…

When agents.defaults.model.primary is changed in openclaw.json, the gateway hot-reload path applies the new default directly to already-running sessions without rechecking channels.modelByChannel. This means a per-channel model override (e.g. pinning a Telegram DM to Opus while the global default is GPT-5.4) gets silently overwritten whenever the global default changes.

Root Cause

When agents.defaults.model.primary is changed in openclaw.json, the gateway hot-reload path applies the new default directly to already-running sessions without rechecking channels.modelByChannel. This means a per-channel model override (e.g. pinning a Telegram DM to Opus while the global default is GPT-5.4) gets silently overwritten whenever the global default changes.

Fix Action

Workaround

Manually set the model override on the affected session via /status model=anthropic/claude-opus-4-6 or the session_status tool after each config change. This is fragile and must be repeated.

Code Example

17:04:14 config change detected; evaluating reload (agents.defaults.model.primary, ...)
17:04:14 config hot reload applied (agents.defaults.model.primary)
17:04:33 agent model: openai-codex/gpt-5.4   ← should still be opus per modelByChannel
RAW_BUFFERClick to expand / collapse

Summary

When agents.defaults.model.primary is changed in openclaw.json, the gateway hot-reload path applies the new default directly to already-running sessions without rechecking channels.modelByChannel. This means a per-channel model override (e.g. pinning a Telegram DM to Opus while the global default is GPT-5.4) gets silently overwritten whenever the global default changes.

Steps to reproduce

  1. Configure channels.modelByChannel.telegram.<chat_id> to anthropic/claude-opus-4-6
  2. Set agents.defaults.model.primary to anthropic/claude-opus-4-6 (so both agree initially)
  3. Start a Telegram DM session — it correctly runs on Opus
  4. Change agents.defaults.model.primary to openai-codex/gpt-5.4 (e.g. to make background/cron jobs cheaper)
  5. The gateway detects the config change and hot-reloads: config hot reload applied (agents.defaults.model.primary)
  6. The running Telegram session switches to openai-codex/gpt-5.4

Expected behavior

The hot reload should re-evaluate channels.modelByChannel for existing sessions and preserve channel-specific overrides. Only sessions without a channel override should pick up the new global default.

Actual behavior

The hot reload pushes the new global default onto the session without consulting modelByChannel. The channel override is silently lost.

Gateway log evidence

17:04:14 config change detected; evaluating reload (agents.defaults.model.primary, ...)
17:04:14 config hot reload applied (agents.defaults.model.primary)
17:04:33 agent model: openai-codex/gpt-5.4   ← should still be opus per modelByChannel

Workaround

Manually set the model override on the affected session via /status model=anthropic/claude-opus-4-6 or the session_status tool after each config change. This is fragile and must be repeated.

Impact

Users who separate expensive models (for interactive DM) from cheap models (for background/cron) via modelByChannel will find their interactive sessions silently downgraded to the cheap model after any config edit that triggers a hot reload. This can cause unexpected cost savings in the wrong direction (degraded quality on the primary interaction surface) or unexpected cost spikes if the change goes the other way.

Environment

  • OpenClaw version: 2026.4.15
  • Channel: Telegram
  • OS: Linux 6.17.0-20-generic (x64)

Labels suggestion

bug, channels, config

extent analysis

TL;DR

The issue can be mitigated by re-evaluating channels.modelByChannel for existing sessions during the hot-reload process to preserve channel-specific overrides.

Guidance

  • Review the hot-reload logic to ensure it checks channels.modelByChannel for existing sessions before applying the new global default model.
  • Consider adding a check to preserve channel-specific overrides when the global default model changes.
  • Verify that the hot-reload process correctly handles sessions with and without channel overrides.
  • Test the fix by reproducing the issue and checking that the channel override is preserved after a config change.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The provided workaround, manually setting the model override on the affected session, is fragile and requires repeated application after each config change. A more robust solution would involve modifying the hot-reload logic to handle channel overrides correctly.

Recommendation

Apply a workaround by modifying the hot-reload logic to re-evaluate channels.modelByChannel for existing sessions, as this will preserve channel-specific overrides and prevent silent downgrades or upgrades of models.

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

The hot reload should re-evaluate channels.modelByChannel for existing sessions and preserve channel-specific overrides. Only sessions without a channel override should pick up the new global default.

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 Hot reload of agents.defaults.model.primary overrides channels.modelByChannel for existing sessions