Auto-Updater Pro
Enhanced auto-updater with detailed logging, missed run recovery, and Gateway restart protection.
Version: 1.1.0 (Updated 2026-02-22)
What's New:
- - ✅ Detailed logging at each step (prevents state loss on restart)
- ✅ Missed run recovery (auto-runs if Gateway was offline)
- ✅ 30-second delay after updates (prevents interruption)
- ✅ Email report support (less intrusive than chat messages)
- ✅ Better error handling and retry logic
Note: This is an enhanced version of the original auto-updater skill with production-ready features.
What It Does
This skill sets up a daily cron job that:
- 1. Updates Clawdbot itself (via
clawdbot doctor or package manager) - Updates all installed skills (via
clawdhub update --all) - Messages you with a summary of what was updated
- New: Logs every step to prevent state loss on Gateway restart
- New: Auto-recovers if the scheduled time was missed
Setup
Quick Start
Ask Clawdbot to set up the auto-updater:
CODEBLOCK0
Or manually add the cron job:
CODEBLOCK1
Recommended Configuration (v1.1.0+)
For production use, add these settings to your cron job:
CODEBLOCK2
Key Settings:
- -
missedRunPolicy: "run-immediately" - Auto-runs if Gateway was offline at scheduled time - INLINECODE4 - Allow 10 minutes for updates to complete
- INLINECODE5 - Set to your timezone
Configuration Options
| Option | Default | Description |
|---|
| Time | 4:00 AM | When to run updates (use --cron to change) |
| Timezone |
System default | Set with
--tz |
| Delivery | Main session | Where to send the update summary |
| Timeout | 300s | Recommended: 600s for npm updates |
| Missed Run | None | Recommended:
run-immediately |
How Updates Work
Clawdbot Updates
For npm/pnpm/bun installs:
CODEBLOCK3
For source installs (git checkout):
CODEBLOCK4
Always run clawdbot doctor after updating to apply migrations.
Skill Updates
CODEBLOCK5
This checks all installed skills against the registry and updates any with new versions available.
Update Summary Format
After updates complete, you'll receive a message like:
CODEBLOCK6
Detailed Logging (v1.1.0+)
To prevent state loss during Gateway restarts, the update process logs every step:
Log File Location
CODEBLOCK7
Log Format
CODEBLOCK8
Six-Phase Update Process
Phase 1: Preparation
- - Record start time
- Check current version
- Write to log file immediately
Phase 2: Check for Updates
- - Check latest version (npm view)
- Append to log file
- Compare versions
Phase 3: Execute Update
- - Record update start
- Run
openclaw update run or INLINECODE11 - Immediately log completion
- Verify new version
Phase 4: Persist State
- - Append full results to log
- Wait 3 seconds for disk sync
Phase 5: Send Report
- - Send email/chat report
- Log delivery status
Phase 6: Delay Restart (Critical!)
- - Wait 30 seconds before any Gateway restart
- Ensures npm processes complete
- Prevents state loss
Manual Commands
Check for updates without applying:
CODEBLOCK9
View current skill versions:
CODEBLOCK10
Check Clawdbot version:
clawdbot --version
Troubleshooting
Updates Not Running
- 1. Verify cron is enabled: check
cron.enabled in config - Confirm Gateway is running continuously
- Check cron job exists: INLINECODE13
- Check if missed run policy is set: INLINECODE14
Update Failures
If an update fails, the summary will include the error. Common fixes:
- - Permission errors: Ensure the Gateway user can write to skill directories
- Network errors: Check internet connectivity
- Package conflicts: Run
clawdbot doctor to diagnose - Gateway restart interruption: Check log file for partial completion
Gateway Restart During Update
If Gateway restarts during update (common with npm installs):
- 1. Check log file: INLINECODE16
- Verify version: INLINECODE17
- Manually send report if needed (log file has all info)
Disabling Auto-Updates
Remove the cron job:
CODEBLOCK12
Or disable temporarily in config:
{
"cron": {
"enabled": false
}
}
Best Practices
1. Schedule During Low Activity
Choose a time when you're unlikely to be using the system:
CODEBLOCK14
2. Enable Missed Run Recovery
Prevents missing updates if Gateway is offline:
CODEBLOCK15
3. Use Email for Reports
Less intrusive than chat messages:
- - Configure email-163-com or similar skill
- Send plain text reports
- Include log file path
4. Log Everything
Always write to log file before sending reports:
- - Prevents state loss
- Enables debugging
- Provides audit trail
5. Wait After Updates
Add 30-second delay before any Gateway restart:
sleep 30
Resources
Version History
v1.1.0 (2026-02-22)
Improvements:
- - ✅ Added detailed logging at each step
- ✅ Added missed run recovery policy
- ✅ Added 30-second delay after updates
- ✅ Added email report support
- ✅ Improved error handling
Bug Fixes:
- - 🐛 Fixed state loss on Gateway restart
- 🐛 Fixed missed scheduled runs
- 🐛 Fixed report delivery failures
v1.0.0 (2026-01-13)
- - ✅ Initial release
- ✅ Basic daily update check
- ✅ Simple report format
Published: 2026-02-22
Maintainer: OpenClaw Team
License: MIT
Auto-Updater Pro
增强版自动更新器,具备详细日志记录、遗漏运行恢复和网关重启保护功能。
版本:1.1.0(更新于 2026-02-22)
新特性:
- - ✅ 每一步均有详细日志记录(防止重启时状态丢失)
- ✅ 遗漏运行恢复(若网关离线则自动运行)
- ✅ 更新后延迟30秒(防止中断)
- ✅ 支持邮件报告(比聊天消息更少干扰)
- ✅ 更好的错误处理和重试逻辑
注意:这是原始 auto-updater 技能的增强版本,具备生产级功能。
功能说明
此技能设置一个每日定时任务,用于:
- 1. 更新 Clawdbot 自身(通过 clawdbot doctor 或包管理器)
- 更新所有已安装的技能(通过 clawdhub update --all)
- 向您发送更新摘要消息
- 新增:记录每一步以防止网关重启时状态丢失
- 新增:若错过预定时间则自动恢复
设置
快速开始
请 Clawdbot 设置自动更新器:
为自己和所有技能设置每日自动更新。
或手动添加定时任务:
bash
clawdbot cron add \
--name 每日自动更新 \
--cron 0 4 * \
--tz America/Los_Angeles \
--session isolated \
--wake now \
--deliver \
--message 运行每日自动更新:检查 Clawdbot 更新并更新所有技能。报告更新内容。
推荐配置(v1.1.0+)
生产环境使用,请将以下设置添加到定时任务中:
json
{
schedule: {
expr: 0 4 *,
kind: cron,
tz: Asia/Shanghai
},
missedRunPolicy: run-immediately,
payload: {
kind: agentTurn,
message: ...,
timeoutSeconds: 600
}
}
关键设置:
- - missedRunPolicy: run-immediately - 若网关在预定时间离线则自动运行
- timeoutSeconds: 600 - 允许10分钟完成更新
- tz: Asia/Shanghai - 设置为您的时区
配置选项
| 选项 | 默认值 | 描述 |
|---|
| 时间 | 凌晨4:00 | 运行更新的时间(使用 --cron 更改) |
| 时区 |
系统默认 | 使用 --tz 设置 |
| 投递方式 | 主会话 | 发送更新摘要的位置 |
| 超时时间 | 300秒 | 推荐:npm 更新设为600秒 |
| 遗漏运行 | 无 | 推荐:run-immediately |
更新工作原理
Clawdbot 更新
对于 npm/pnpm/bun 安装:
bash
npm update -g clawdbot@latest
或:pnpm update -g clawdbot@latest
或:bun update -g clawdbot@latest
对于 源码安装(git checkout):
bash
clawdbot update
更新后始终运行 clawdbot doctor 以应用迁移。
技能更新
bash
clawdhub update --all
此命令检查所有已安装技能与注册表的版本,并更新有可用新版本的技能。
更新摘要格式
更新完成后,您将收到如下消息:
🔄 每日自动更新完成
Clawdbot:已更新至 v2026.1.10(原为 v2026.1.9)
已更新技能(3个):
- - prd:2.0.3 → 2.0.4
- browser:1.2.0 → 1.2.1
- nano-banana-pro:3.1.0 → 3.1.2
已是最新技能(5个):
gemini, sag, things-mac, himalaya, peekaboo
未遇到任何问题。
详细日志记录(v1.1.0+)
为防止网关重启期间状态丢失,更新过程会记录每一步:
日志文件位置
~/.openclaw/workspace/memory/openclaw-update-YYYY-MM-DD.md
日志格式
markdown
OpenClaw 更新日志 YYYY-MM-DD
更新前
- - 开始时间:HH:mm:ss
- 当前版本:x.x.x
- 最新版本:x.x.x
更新中
- - 更新开始:HH:mm:ss
- 更新命令:...
- 更新完成:HH:mm:ss
- 验证版本:x.x.x
更新后
- - 状态:已是最新 / 已更新 / 更新失败
- 报告发送:成功 / 失败
- 完成时间:HH:mm:ss
更新内容
(从 CHANGELOG 或 npm 获取)
六阶段更新流程
阶段一:准备
阶段二:检查更新
- - 检查最新版本(npm view)
- 追加到日志文件
- 比较版本
阶段三:执行更新
- - 记录更新开始
- 运行 openclaw update run 或 npm install -g openclaw@latest
- 立即记录完成
- 验证新版本
阶段四:持久化状态
阶段五:发送报告
阶段六:延迟重启(关键!)
- - 在任何网关重启前等待30秒
- 确保 npm 进程完成
- 防止状态丢失
手动命令
检查更新但不应用:
bash
clawdhub update --all --dry-run
查看当前技能版本:
bash
clawdhub list
检查 Clawdbot 版本:
bash
clawdbot --version
故障排除
更新未运行
- 1. 验证定时任务已启用:检查配置中的 cron.enabled
- 确认网关持续运行
- 检查定时任务是否存在:clawdbot cron list
- 检查是否设置了遗漏运行策略:missedRunPolicy: run-immediately
更新失败
如果更新失败,摘要将包含错误信息。常见修复方法:
- - 权限错误:确保网关用户对技能目录有写入权限
- 网络错误:检查互联网连接
- 包冲突:运行 clawdbot doctor 进行诊断
- 网关重启中断:检查日志文件以确认部分完成情况
更新期间网关重启
如果在更新期间网关重启(npm 安装时常见):
- 1. 检查日志文件:~/.openclaw/workspace/memory/openclaw-update-*.md
- 验证版本:openclaw --version
- 如有需要手动发送报告(日志文件包含所有信息)
禁用自动更新
移除定时任务:
bash
clawdbot cron remove 每日自动更新
或在配置中临时禁用:
json
{
cron: {
enabled: false
}
}
最佳实践
1. 在低活动时段安排
选择您不太可能使用系统的时间:
json
expr: 0 4 * // 凌晨4:00
2. 启用遗漏运行恢复
防止网关离线时错过更新:
json
missedRunPolicy: run-immediately
3. 使用邮件发送报告
比聊天消息更少干扰:
- - 配置 email-163-com 或类似技能
- 发送纯文本报告
- 包含日志文件路径
4. 记录所有内容
在发送报告前始终写入日志文件:
5. 更新后等待
在任何网关重启前添加30秒延迟:
bash
sleep 30
资源
版本历史
v1.1.0(2026-02-22)
改进: