[Bug] Cron isolated session model parameter ignored, falls back to default agent model
Bug Type
Regression / Configuration Issue
Summary
When using sessionTarget: "isolated" with payload.kind: "agentTurn" in cron jobs, the payload.model parameter is ignored at runtime. The job always uses agents.defaults.model.primary (e.g., claude-sonnet-4-5) instead of the specified model (e.g., claude-haiku-4).
This prevents cost optimization for cron jobs, as cheaper models cannot be selected per-job.
Expected Behavior
When a cron job is configured with:
{
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "...",
"model": "anthropic/claude-haiku-4",
"timeoutSeconds": 300
}
}
The isolated session should use Claude Haiku 4 as specified.
Actual Behavior
The isolated session uses the default agent model (anthropic/claude-sonnet-4-5) instead, ignoring the payload.model parameter entirely.
Evidence from cron run logs:
{
"status": "ok",
"model": "claude-sonnet-4-5", // <-- Wrong model!
"provider": "anthropic",
"usage": {
"input_tokens": 16,
"output_tokens": 493
}
}
Steps to Reproduce
1. Ensure target model is enabled
Add anthropic/claude-haiku-4 to agent's enabled models:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-5"
},
"models": {
"anthropic/claude-sonnet-4-5": {},
"anthropic/claude-haiku-4": {}
}
}
}
}
2. Create isolated cron job with model override
openclaw cron add \
--name "Test Model Override" \
--every 1h \
--session isolated \
--message "Run a simple test script and report results" \
--model "anthropic/claude-haiku-4" \
--timeout-seconds 300 \
--announce \
--channel discord \
--to <channel-id>
3. Run job manually
openclaw cron run <job-id>
4. Check run logs
openclaw cron runs --id <job-id> --limit 1
Observe: "model": "claude-sonnet-4-5" instead of "model": "claude-haiku-4"
Configuration Used
OpenClaw Version: 2026.4.2 (d74a122)
Job Configuration:
{
"id": "730648b9-7854-4b2b-b02b-b13b6fa63c57",
"name": "Discord Security Real-Time Monitor",
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "Run enhanced Discord security monitoring...",
"model": "anthropic/claude-haiku-4",
"timeoutSeconds": 300
},
"delivery": {
"mode": "announce",
"channel": "discord",
"to": "1485243052418138172"
}
}
Agent Config:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-5"
},
"models": {
"anthropic/claude-sonnet-4-5": {},
"anthropic/claude-haiku-4": {}
}
}
}
}
Test Results
Multiple test runs with different model specifications:
| Test # |
Config Model |
Runtime Model |
Result |
| 1 |
anthropic/claude-haiku-4 |
claude-sonnet-4-5 |
❌ Wrong |
| 2 |
claude-haiku-4 (no prefix) |
claude-sonnet-4-5 |
❌ Wrong |
| 3 |
ollama/qwen2.5:3b |
(timeout - separate issue) |
❌ Timeout |
Conclusion: Model parameter is completely ignored for isolated cron sessions.
Impact & Severity
Affected: Users attempting cost optimization via cheaper models in cron jobs
Severity: Medium (functional workaround exists, but blocks cost optimization)
Frequency: Every isolated cron job with custom model parameter
Consequence:
- Cannot use budget models (Haiku, GPT-4o-mini, etc.) for cron automation
- Forces expensive models (Sonnet 4-5) for simple tasks
- Blocks 90%+ cost reduction for automated jobs
Cost impact example:
- Sonnet 4-5: $3 input / $15 output per 1M tokens
- Haiku 4: $0.25 input / $1.25 output per 1M tokens
- Savings blocked: ~92% per run
Environment
- OS: Linux 6.12.57+deb13-amd64 (Debian 13, Docker/Umbrel)
- Node.js: v22.22.2
- OpenClaw: 2026.4.2 (d74a122)
- Install method: Umbrel app (npm global equivalent)
- Agent: main (default)
- Provider: Anthropic (API key configured)
Workarounds Attempted
❌ Model name format variations
anthropic/claude-haiku-4 → Ignored
claude-haiku-4 → Ignored
- Result: Format doesn't matter, parameter is ignored
❌ Free local models (Ollama)
ollama/qwen2.5:3b → Timeout (separate issue)
ollama/qwen2.5:14b → Not tested (likely same timeout)
- Result: Works but too slow (600s+ timeout needed)
✅ Revert to main session (systemEvent)
sessionTarget: "main", payload.kind: "systemEvent"
- Result: Works but no model override capability
- Cost optimization: Frequency reduction only (75% savings)
Suggested Fix
The payload.model parameter should be respected for isolated cron sessions, similar to how sessions_spawn with runtime: "subagent" respects the model parameter.
Possible implementation:
- Pass
payload.model to isolated session spawn
- Override session model before agent turn execution
- Validate model is in enabled models list
- Fall back to default only if model unavailable
Related Issues
- Potentially related to sessions_spawn model handling
- May share code path with subagent model override logic
Additional Context
Use case: Security monitoring cron jobs
- Simple script execution + log checking
- No complex reasoning required
- Perfect candidate for budget models
- Current forced use of Sonnet 4-5 is wasteful
Desired outcome:
- Enable per-job model selection
- Allow cost optimization for automated tasks
- Maintain reliable execution
Reporter: User via OpenClaw agent
Date: 2026-04-04
Priority: Medium (blocks cost optimization feature)
[Bug] Cron isolated session
modelparameter ignored, falls back to default agent modelBug Type
Regression / Configuration Issue
Summary
When using
sessionTarget: "isolated"withpayload.kind: "agentTurn"in cron jobs, thepayload.modelparameter is ignored at runtime. The job always usesagents.defaults.model.primary(e.g.,claude-sonnet-4-5) instead of the specified model (e.g.,claude-haiku-4).This prevents cost optimization for cron jobs, as cheaper models cannot be selected per-job.
Expected Behavior
When a cron job is configured with:
{ "sessionTarget": "isolated", "payload": { "kind": "agentTurn", "message": "...", "model": "anthropic/claude-haiku-4", "timeoutSeconds": 300 } }The isolated session should use Claude Haiku 4 as specified.
Actual Behavior
The isolated session uses the default agent model (
anthropic/claude-sonnet-4-5) instead, ignoring thepayload.modelparameter entirely.Evidence from cron run logs:
{ "status": "ok", "model": "claude-sonnet-4-5", // <-- Wrong model! "provider": "anthropic", "usage": { "input_tokens": 16, "output_tokens": 493 } }Steps to Reproduce
1. Ensure target model is enabled
Add
anthropic/claude-haiku-4to agent's enabled models:{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-sonnet-4-5" }, "models": { "anthropic/claude-sonnet-4-5": {}, "anthropic/claude-haiku-4": {} } } } }2. Create isolated cron job with model override
3. Run job manually
4. Check run logs
Observe:
"model": "claude-sonnet-4-5"instead of"model": "claude-haiku-4"Configuration Used
OpenClaw Version:
2026.4.2 (d74a122)Job Configuration:
{ "id": "730648b9-7854-4b2b-b02b-b13b6fa63c57", "name": "Discord Security Real-Time Monitor", "sessionTarget": "isolated", "payload": { "kind": "agentTurn", "message": "Run enhanced Discord security monitoring...", "model": "anthropic/claude-haiku-4", "timeoutSeconds": 300 }, "delivery": { "mode": "announce", "channel": "discord", "to": "1485243052418138172" } }Agent Config:
{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-sonnet-4-5" }, "models": { "anthropic/claude-sonnet-4-5": {}, "anthropic/claude-haiku-4": {} } } } }Test Results
Multiple test runs with different model specifications:
anthropic/claude-haiku-4claude-sonnet-4-5claude-haiku-4(no prefix)claude-sonnet-4-5ollama/qwen2.5:3bConclusion: Model parameter is completely ignored for isolated cron sessions.
Impact & Severity
Affected: Users attempting cost optimization via cheaper models in cron jobs
Severity: Medium (functional workaround exists, but blocks cost optimization)
Frequency: Every isolated cron job with custom model parameter
Consequence:
Cost impact example:
Environment
Workarounds Attempted
❌ Model name format variations
anthropic/claude-haiku-4→ Ignoredclaude-haiku-4→ Ignored❌ Free local models (Ollama)
ollama/qwen2.5:3b→ Timeout (separate issue)ollama/qwen2.5:14b→ Not tested (likely same timeout)✅ Revert to main session (systemEvent)
sessionTarget: "main",payload.kind: "systemEvent"Suggested Fix
The
payload.modelparameter should be respected for isolated cron sessions, similar to howsessions_spawnwithruntime: "subagent"respects themodelparameter.Possible implementation:
payload.modelto isolated session spawnRelated Issues
Additional Context
Use case: Security monitoring cron jobs
Desired outcome:
Reporter: User via OpenClaw agent
Date: 2026-04-04
Priority: Medium (blocks cost optimization feature)