Cron Model Fix
Diagnose and fix OpenClaw cron job model override issues where configured models are rejected and fall back to agent defaults.
When to Use This Skill
Use when:
- - Cron jobs show
"not allowed, falling back to agent defaults" in gateway logs - Unexpected cloud token burn on cron jobs configured with local models
- Slow cron run times (60-180s) when local models should be used
- Model overrides in cron jobs aren't being applied
- Need to validate agent model allowlist configuration
Quick Start
CODEBLOCK0
Root Cause
OpenClaw has three model configuration layers. ALL must include the model:
Layer 1: Provider Model Definition
Location: models.providers.<provider>.models[]
Purpose: Defines model specs (context, costs, capabilities)
Layer 2: Agent Default Model
Location: agents.defaults.model.primary
Purpose: Default model when none specified
Layer 3: Agent Model Allowlist ← COMMON ISSUE
Location: agents.defaults.models
Purpose: WHICH MODELS ARE PERMITTED for agent/cron use
Problem: Model exists in Layer 1, but missing from Layer 3 (allowlist).
Gateway logs show:
CODEBLOCK1
Diagnosis
Step 1: Check Gateway Logs
CODEBLOCK2
If you see: "payload.model '<model>' not allowed, falling back to agent defaults"
→ Model is missing from agent allowlist
Step 2: Check Agent Allowlist
CODEBLOCK3
Check if your cron model is in the list. If not, it will be rejected.
Step 3: Check Cron Job Configuration
CODEBLOCK4
Verify:
- - Cron job has
model specified in payload - Model format matches allowlist (e.g.,
ollama/qwen3.5:0.8b)
The Fix
Add the model to agents.defaults.models in ~/.openclaw/openclaw.json:
CODEBLOCK5
Manual Fix Steps
- 1. Edit config:
CODEBLOCK6
- 2. Add to
agents.defaults.models:
CODEBLOCK7
- 3. Restart gateway:
CODEBLOCK8
- 4. Verify:
openclaw cron runs --id <job-id> --limit 3
Look for
"model": "qwen3.5:0.8b" instead of INLINECODE11
Automated Fix Script
Use the included script:
CODEBLOCK10
Expected Results
Before Fix
| Metric | Value |
|---|
| Model | Cloud fallback |
| Duration |
60-180 seconds |
| Input Tokens | 200K-600K per run |
| Cost | Cloud token burn |
After Fix
| Metric | Value | Improvement |
|---|
| Model | Local (e.g., qwen3.5:0.8b) | ✅ Free |
| Duration |
1-13 seconds | 5-14x faster |
| Input Tokens | 5K-36K | 85-95% reduction |
| Cost | ZERO | 100% savings |
Validation
After applying fix, verify:
CODEBLOCK11
CODEBLOCK12
Common Issues
Issue: Model still not working after fix
Check:
- 1. Gateway restarted after config change?
- Model format matches exactly? (e.g.,
ollama/qwen3.5:0.8b vs qwen3.5:0.8b) - Model exists in provider config (Layer 1)?
Issue: Invalid JSON after editing
Fix:
CODEBLOCK13
Or restore from backup:
CODEBLOCK14
Related Skills
- -
inbox-optimizer - Optimizes inbox scanning patterns (mesh-specific) - INLINECODE15 - General OpenClaw system health monitoring
References
- - See
references/model-config-layers.md for detailed configuration structure - See
references/troubleshooting-examples.md for real-world case studies
Version
1.0.0 - Initial release (2026-03-30)
Cron模型修复
诊断并修复OpenClaw cron任务模型覆盖问题,即配置的模型被拒绝并回退到代理默认模型。
何时使用此技能
在以下情况下使用:
- - 网关日志中cron任务显示not allowed, falling back to agent defaults
- 配置了本地模型的cron任务出现意外的云token消耗
- 本应使用本地模型时cron运行时间缓慢(60-180秒)
- cron任务中的模型覆盖未生效
- 需要验证代理模型允许列表配置
快速开始
bash
诊断问题
openclaw skill run cron-model-fix --diagnose
应用修复(将缺失的模型添加到允许列表)
openclaw skill run cron-model-fix --fix --model ollama/qwen3.5:0.8b
验证配置
openclaw skill run cron-model-fix --validate
根本原因
OpenClaw有三层模型配置。所有层都必须包含该模型:
第1层:提供商模型定义
位置: models.providers.
.models[]
用途: 定义模型规格(上下文、成本、能力)
第2层:代理默认模型
位置: agents.defaults.model.primary
用途: 未指定时的默认模型
第3层:代理模型允许列表 ← 常见问题
位置: agents.defaults.models
用途: 允许代理/cron使用的模型
问题: 模型存在于第1层,但缺失于第3层(允许列表)。
网关日志显示:
{subsystem:cron}
payload.model ollama/qwen3.5:0.8b not allowed, falling back to agent defaults
诊断
步骤1:检查网关日志
bash
tail -100 /tmp/openclaw/openclaw-*.log | grep -i not allowed\|falling back
如果看到: payload.model not allowed, falling back to agent defaults
→ 模型缺失于代理允许列表
步骤2:检查代理允许列表
bash
cat ~/.openclaw/openclaw.json | python3 -c
import json, sys
config = json.load(sys.stdin)
models = config.get(agents, {}).get(defaults, {}).get(models, {})
print(允许的模型:)
for model in models:
print(f - {model})
检查你的cron模型是否在列表中。 如果不在,它将被拒绝。
步骤3:检查Cron任务配置
bash
openclaw cron list
验证:
- - Cron任务在payload中指定了model
- 模型格式与允许列表匹配(例如,ollama/qwen3.5:0.8b)
修复方法
将模型添加到~/.openclaw/openclaw.json中的agents.defaults.models:
json
{
agents: {
defaults: {
model: {
primary: ollama/qwen3.5:cloud,
fallbacks: [...]
},
models: {
ollama/glm-4.7-flash: {},
ollama/kimi-k2.5:cloud: {},
ollama/qwen2.5vl:7b: {},
ollama/qwen3.5:397b-cloud: {},
ollama/qwen3.5:4b-32K: {},
ollama/qwen3.5:4b-32k: {},
ollama/qwen3.5:9b-128k: {},
ollama/qwen3.5:cloud: {},
ollama/qwen3.5:0.8b: {}, ← 添加此行
ollama/qwen3.5:2b: {} ← 可选
}
}
}
}
手动修复步骤
- 1. 编辑配置:
bash
nano ~/.openclaw/openclaw.json
- 2. 添加到agents.defaults.models:
json
ollama/qwen3.5:0.8b: {},
- 3. 重启网关:
bash
openclaw gateway restart
- 4. 验证:
bash
openclaw cron runs --id --limit 3
查找model: qwen3.5:0.8b而非qwen3.5:cloud
自动修复脚本
使用附带的脚本:
bash
python3 ~/.npm-global/lib/node_modules/openclaw/skills/cron-model-fix/scripts/add-model-allowlist.py --model ollama/qwen3.5:0.8b
预期结果
修复前
60-180秒 |
| 输入Token | 每次运行200K-600K |
| 成本 | 云token消耗 |
修复后
| 指标 | 值 | 改进 |
|---|
| 模型 | 本地(例如,qwen3.5:0.8b) | ✅ 免费 |
| 持续时间 |
1-13秒 | 快5-14倍 |
| 输入Token | 5K-36K | 减少85-95% |
| 成本 | 零 | 节省100% |
验证
应用修复后,验证:
bash
检查模型拒绝警告
tail -50 /tmp/openclaw/openclaw-*.log | grep -i not allowed
应为空(无警告)
bash
检查cron运行历史
openclaw cron runs --id --limit 1
应显示:
model: qwen3.5:0.8b(非cloud)
durationMs: <15000(快速)
input_tokens: <50000(低)
常见问题
问题:修复后模型仍不工作
检查:
- 1. 配置更改后是否重启了网关?
- 模型格式是否完全匹配?(例如,ollama/qwen3.5:0.8b vs qwen3.5:0.8b)
- 模型是否存在于提供商配置中(第1层)?
问题:编辑后JSON无效
修复:
bash
openclaw doctor --fix
或从备份恢复:
bash
cp ~/.openclaw/openclaw.json.backup ~/.openclaw/openclaw.json
相关技能
- - inbox-optimizer - 优化收件箱扫描模式(特定于mesh)
- healthcheck - 通用OpenClaw系统健康监控
参考
- - 参见references/model-config-layers.md了解详细配置结构
- 参见references/troubleshooting-examples.md了解实际案例研究
版本
1.0.0 - 初始版本(2026-03-30)