openclaw - 💡(How to fix) Fix [Bug]: Agent-level model config ignored at session initialization (2026.5.7)

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…

Agent-specific model configuration is ignored during session initialization. All sessions use agents.defaults.model.primary instead of the agent's configured model, making multi-agent setups with different models per agent impossible.


Or even more concise:

```markdown
Agent-level model config ignored at session init - all agents use global default model

Pick whichever fits the form character limit! 🐈‍⬛

Error Message

No model_fallback event. No Ollama error. Just instant default override.

Root Cause

Agent-specific model configuration is ignored during session initialization. All sessions use agents.defaults.model.primary instead of the agent's configured model, making multi-agent setups with different models per agent impossible.


Or even more concise:

```markdown
Agent-level model config ignored at session init - all agents use global default model

Pick whichever fits the form character limit! 🐈‍⬛

Fix Action

Fix / Workaround

Workarounds: None viable for production use

  • Separate OpenClaw instances: Too heavy, complex management
  • Global default rotation: Breaks other agents
  • Manual /model overrides: Not persistent across sessions

Severity: High - Documented core feature completely non-functional, blocks entire use case with no practical workaround

Code Example

## Summary

Agent-specific `model` configuration is ignored during session initialization. All sessions use `agents.defaults.model.primary` instead of the agent's configured model, making multi-agent setups with different models per agent impossible.

---

Agent-level model config ignored at session init - all agents use global default model

---

## Steps to Reproduce

1. **Configure global default model:**

---

2. **Create an agent with a different model:**

---

3. **Register the Ollama model in allowlist:**

---

4. **Ensure Ollama is running and model is available:**

---

Should return a valid response.

5. **Bind the agent to a channel** (e.g., Discord):

---

6. **Restart the Gateway:**

---

7. **Send a message to the bound channel:**

---

8. **Check the session file:**

---

9. **Check the trajectory file:**

---

## Expected Result

- Session should use `provider: "ollama"`, `modelId: "qwen2.5-coder:7b"`
- Agent responds: "I'm running Qwen 2.5 Coder 7B"

## Actual Result

- Session shows:

---

- Agent responds: "I'm running Claude Sonnet 4.5 (anthropic/claude-sonnet-4-5)"
- Trajectory shows model set to Anthropic immediately at session creation (no Ollama attempt)

---

## Expected Behavior

When an agent is configured with a specific `model`:

---

**Sessions for that agent should:**
1. Initialize with the agent's configured model (`ollama/qwen2.5-coder:7b`)
2. Have NO `modelOverride` / `providerOverride` fields (or they should be `null`)
3. Only set `modelOverrideSource: "auto"` if a runtime fallback occurs during an actual request

**The agent-level model config should take precedence over `agents.defaults.model.primary`**, per the documented model resolution cascade.

**Trajectory should show:**
- Ollama connection attempt at first request
- If Ollama succeeds: continue with Ollama
- If Ollama fails: fall back to configured fallback (if any), THEN set `modelOverrideSource: "auto"`

**CLI should reflect:**

---

### Actual behavior

---

{
  "modelOverride": "claude-sonnet-4-5",
  "providerOverride": "anthropic",
  "modelOverrideSource": "auto"
}

---

T+0.000s: Session created
T+0.258s: Model set to "anthropic/claude-sonnet-4-5" (immediately)

---

$ openclaw status
Sessions:
│ agent:test-agent:discord:... │ group │ 1m ago │ claude-sonnet-4-5                                                   ^^^^^^^^^^^^^^^^^^
                                                   Should be: ollama/qwen2.5-coder:7b

---

I'm running Claude Sonnet 4.5 (anthropic/claude-sonnet-4-5).
The default model for this setup is ollama/qwen2.5-coder:7b, but this session is using Sonnet 4.5.

---

## Additional Provider/Model Setup Details

### Ollama Provider Configuration

---

**Ollama status:**
- Running locally on port 11434
- Models loaded with `-1` keep-alive (never unload)
- Verified working via direct API test:

---

### Anthropic Provider Configuration

---

**Auth profile:** `anthropic:default` (API key configured, working)

### Model Registration (Allowlist)

---

### Agent Configuration Tested
Both string and object forms exhibit the same bug:

**String form:**

---

**Object form:**

---

### Default Model Configuration

---

**This is what all agents incorrectly fall back to, regardless of their individual config.**

---



---

## Impact

**High** - Core multi-agent functionality is blocked

**Affects:**
- All multi-agent setups attempting to use different models per agent
- Privacy-sensitive deployments requiring local-only models for specific agents
- Budget management strategies (local models for high-volume, cloud for quality)
- Any deployment relying on documented per-agent model configuration

**Cannot:**
- Build agent crews with specialized models (e.g., local for email/finance, cloud for creative)
- Enforce privacy boundaries (all agents fall back to cloud default)
- Test/implement documented agent model configuration features

**Workarounds:** None viable for production use
- Separate OpenClaw instances: Too heavy, complex management
- Global default rotation: Breaks other agents
- Manual `/model` overrides: Not persistent across sessions

**Severity:** High - Documented core feature completely non-functional, blocks entire use case with no practical workaround
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

## Summary

Agent-specific `model` configuration is ignored during session initialization. All sessions use `agents.defaults.model.primary` instead of the agent's configured model, making multi-agent setups with different models per agent impossible.

Or even more concise:

Agent-level model config ignored at session init - all agents use global default model

Pick whichever fits the form character limit! 🐈‍⬛

Steps to reproduce

## Steps to Reproduce

1. **Configure global default model:**
   ```json
   {
     "agents": {
       "defaults": {
         "model": {
           "primary": "anthropic/claude-sonnet-4-5"
         }
       }
     }
   }
  1. Create an agent with a different model:

    {
      "agents": {
        "list": [
          {
            "id": "test-agent",
            "name": "test-agent",
            "workspace": "~/.openclaw/workspace-test",
            "model": "ollama/qwen2.5-coder:7b"
          }
        ]
      }
    }
  2. Register the Ollama model in allowlist:

    {
      "agents": {
        "defaults": {
          "models": {
            "ollama/qwen2.5-coder:7b": {}
          }
        }
      }
    }
  3. Ensure Ollama is running and model is available:

    curl -s http://localhost:11434/api/generate -X POST \
      -d '{"model":"qwen2.5-coder:7b","prompt":"test","stream":false}'

    Should return a valid response.

  4. Bind the agent to a channel (e.g., Discord):

    {
      "bindings": [
        {
          "agentId": "test-agent",
          "match": {
            "channel": "discord",
            "peer": {
              "kind": "channel",
              "id": "YOUR_CHANNEL_ID"
            }
          }
        }
      ]
    }
  5. Restart the Gateway:

    openclaw gateway restart
  6. Send a message to the bound channel:

    what model are you running?
  7. Check the session file:

    cat ~/.openclaw/agents/test-agent/sessions/sessions.json | grep -A 2 "modelOverride"
  8. Check the trajectory file:

    head -5 ~/.openclaw/agents/test-agent/sessions/*.jsonl

Expected Result

  • Session should use provider: "ollama", modelId: "qwen2.5-coder:7b"
  • Agent responds: "I'm running Qwen 2.5 Coder 7B"

Actual Result

  • Session shows:
    "modelOverride": "claude-sonnet-4-5",
    "providerOverride": "anthropic",
    "modelOverrideSource": "auto"
  • Agent responds: "I'm running Claude Sonnet 4.5 (anthropic/claude-sonnet-4-5)"
  • Trajectory shows model set to Anthropic immediately at session creation (no Ollama attempt)

Clean, reproducible steps that anyone can follow! 🐈‍⬛

### Expected behavior

```markdown
## Expected Behavior

When an agent is configured with a specific `model`:

```json
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-sonnet-4-5"
      }
    },
    "list": [
      {
        "id": "test-agent",
        "model": "ollama/qwen2.5-coder:7b"
      }
    ]
  }
}

Sessions for that agent should:

  1. Initialize with the agent's configured model (ollama/qwen2.5-coder:7b)
  2. Have NO modelOverride / providerOverride fields (or they should be null)
  3. Only set modelOverrideSource: "auto" if a runtime fallback occurs during an actual request

The agent-level model config should take precedence over agents.defaults.model.primary, per the documented model resolution cascade.

Trajectory should show:

  • Ollama connection attempt at first request
  • If Ollama succeeds: continue with Ollama
  • If Ollama fails: fall back to configured fallback (if any), THEN set modelOverrideSource: "auto"

CLI should reflect:

$ openclaw status
Sessions:
│ agent:test-agent:discord:... │ group │ 1m ago │ ollama/qwen2.5-coder:7b │

Actual behavior

## Actual Behavior

Sessions are created with `agents.defaults.model.primary` regardless of agent-specific `model` config:

```json
{
  "modelOverride": "claude-sonnet-4-5",
  "providerOverride": "anthropic",
  "modelOverrideSource": "auto"
}

What happens:

  1. Session is created for the agent
  2. Model is immediately set to the global default (Anthropic) at session initialization
  3. modelOverrideSource: "auto" is set without any runtime fallback occurring
  4. Agent's configured model (ollama/qwen2.5-coder:7b) is never attempted
  5. No Ollama connection attempt is visible in trajectory logs

Trajectory timeline:

T+0.000s: Session created
T+0.258s: Model set to "anthropic/claude-sonnet-4-5" (immediately)

No model_fallback event. No Ollama error. Just instant default override.

CLI shows wrong model:

$ openclaw status
Sessions:
│ agent:test-agent:discord:... │ group │ 1m ago │ claude-sonnet-4-5 │
                                                   ^^^^^^^^^^^^^^^^^^
                                                   Should be: ollama/qwen2.5-coder:7b

Agent confirms it's using wrong model:

I'm running Claude Sonnet 4.5 (anthropic/claude-sonnet-4-5).
The default model for this setup is ollama/qwen2.5-coder:7b, but this session is using Sonnet 4.5.

Result: Agent-level model config is loaded (visible in trajectory config snapshot) but completely ignored during session initialization.

OpenClaw version

2026.5.7

Operating system

macOS 12.7.4

Install method

Installation Method - Method: npm (global install via nvm) - Command: npm install -g openclaw - Node: v24.15.0 (managed by nvm) - Location: ~/.nvm/versions/node/v24.15.0/lib/node_modules/openclaw

Model

Model Intended: ollama/qwen2.5-coder:7b (configured for agent) Actual: anthropic/claude-sonnet-4-5 (what sessions used due to bug) Both models are relevant to this issue: - Agent was configured to use Ollama - Sessions were created with Anthropic (the bug)

Provider / routing chain

Provider / Routing Chain DiscordOpenClaw GatewayAgent bindingSession initialization (where bug occurs) Specific routing: ```json { "bindings": [ { "agentId": "homie", "match": { "channel": "discord", "peer": { "kind": "channel", "id": "1502419400232407122" } } } ] }

Additional provider/model setup details

## Additional Provider/Model Setup Details

### Ollama Provider Configuration
```json
{
  "models": {
    "providers": {
      "ollama": {
        "baseUrl": "http://127.0.0.1:11434",
        "api": "ollama",
        "apiKey": "",
        "enabled": true
      }
    }
  }
}

Ollama status:

  • Running locally on port 11434
  • Models loaded with -1 keep-alive (never unload)
  • Verified working via direct API test:
    curl -s http://localhost:11434/api/generate -X POST \
      -d '{"model":"qwen2.5-coder:7b","prompt":"test","stream":false}'
    # Returns valid response

Anthropic Provider Configuration

{
  "models": {
    "providers": {
      "anthropic": {
        "enabled": true
      }
    }
  }
}

Auth profile: anthropic:default (API key configured, working)

Model Registration (Allowlist)

{
  "agents": {
    "defaults": {
      "models": {
        "anthropic/claude-sonnet-4-5": {},
        "anthropic/claude-opus-4-7": {},
        "anthropic/claude-haiku-4": {},
        "ollama/qwen2.5-coder:7b": {},
        "ollama/qwen2.5:7b": {},
        "ollama/qwen2.5:3b": {}
      }
    }
  }
}

Agent Configuration Tested

Both string and object forms exhibit the same bug:

String form:

{
  "id": "homie",
  "model": "ollama/qwen2.5-coder:7b"
}

Object form:

{
  "id": "homie",
  "model": {
    "primary": "ollama/qwen2.5-coder:7b",
    "fallbacks": []
  }
}

Default Model Configuration

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-sonnet-4-5",
        "fallbacks": ["anthropic/claude-opus-4-7"]
      }
    }
  }
}

This is what all agents incorrectly fall back to, regardless of their individual config.


Complete technical context! 🐈‍⬛

### Logs, screenshots, and evidence

```shell

Impact and severity

## Impact

**High** - Core multi-agent functionality is blocked

**Affects:**
- All multi-agent setups attempting to use different models per agent
- Privacy-sensitive deployments requiring local-only models for specific agents
- Budget management strategies (local models for high-volume, cloud for quality)
- Any deployment relying on documented per-agent model configuration

**Cannot:**
- Build agent crews with specialized models (e.g., local for email/finance, cloud for creative)
- Enforce privacy boundaries (all agents fall back to cloud default)
- Test/implement documented agent model configuration features

**Workarounds:** None viable for production use
- Separate OpenClaw instances: Too heavy, complex management
- Global default rotation: Breaks other agents
- Manual `/model` overrides: Not persistent across sessions

**Severity:** High - Documented core feature completely non-functional, blocks entire use case with no practical workaround

Additional information

bug-report-agent-model-ignored.md

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

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 [Bug]: Agent-level model config ignored at session initialization (2026.5.7)