Install
openclaw skills install upgrade-guardSafe OpenClaw upgrade workflow with pre-flight config check, automatic backup, post-upgrade migration, and rollback. Three modes: cautious (install first, verify config before restart), openclaw-update (built-in flow with backup safety net), manual (backup only). Use when: upgrading OpenClaw, "gateway won't start after update", config backup before version jumps, config rollback. Triggers on: upgrade openclaw, update openclaw, 升级openclaw, gateway won't start, config broke, config migration, 版本升级.
openclaw skills install upgrade-guardSafe OpenClaw upgrade: backup before touching anything, verify before restarting, rollback if broken.
OpenClaw strictly validates config. If a new version renames or removes a key, Gateway refuses to start. openclaw update installs the new version before checking config compatibility — if something breaks, you're stuck mid-migration. This adds the safety net that's missing: backup first, verify before restart, rollback if broken.
| Mode | Flow | Best for |
|---|---|---|
| cautious | install package → fix config → verify → restart | large version jumps, custom configs |
| openclaw-update | openclaw update → verify health → rollback if needed | routine updates |
| manual | backup + pre-check only | you handle the upgrade yourself |
Default: cautious
Before any upgrade, check:
openclaw config get agents.defaults.workspace — if this fails, config is broken alreadyopenclaw doctor --non-interactive — scan for deprecated keys that will be migratedopenclaw health — confirm current state is good before changing anythingopenclaw --version + node --versionopenclaw update status --jsonAlways backup config before upgrading:
# Create timestamped backup
mkdir -p ~/.openclaw/upgrade-guard
ts=$(date +%Y%m%d-%H%M%S)
ver=$(openclaw --version 2>/dev/null | tr ' ' '_')
mkdir -p "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}"
cp ~/.openclaw/openclaw.json "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}/"
ln -sfn "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}" "$HOME/.openclaw/upgrade-guard/latest"
echo "Backup: $HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}"
Keep max 10 backups:
# Prune old backups (keep newest 10)
cd ~/.openclaw/upgrade-guard && ls -1d pre-* 2>/dev/null | sort | head -n -10 | xargs rm -rf 2>/dev/null; cd -
Step-by-step, verifying at each stage:
npm install --global openclaw@latest
Or for a specific version: npm install --global openclaw@2026.4.1
openclaw doctor --fix --non-interactive
This runs the new version's doctor, which knows the new schema and migration rules.
openclaw config get agents.defaults.workspace
If this fails, do not restart. Restore backup instead:
cp ~/.openclaw/upgrade-guard/latest/openclaw.json ~/.openclaw/openclaw.json
openclaw gateway restart
openclaw health
Repeat every 5 seconds, up to 12 times (60s total). If Gateway doesn't become healthy, restore backup.
Use the built-in flow with backup safety net:
openclaw update --yesopenclaw healthJust backup and pre-check. Print instructions, user handles the rest.
# Restore config from latest backup
cp ~/.openclaw/upgrade-guard/latest/openclaw.json ~/.openclaw/openclaw.json
openclaw gateway restart
# Rollback to specific version
npm install --global openclaw@2026.4.1
openclaw doctor --fix --non-interactive
openclaw gateway restart
Common breaking changes (all handled by doctor --fix):
| Legacy | New |
|---|---|
routing.* | channels.* / messages.* / bindings |
agent.* | agents.defaults.* / tools.* |
messages.tts.openai | messages.tts.providers.openai |
talk.voiceId etc | talk.provider + talk.providers.* |
identity (root) | agents.list[].identity |
browser.driver: "extension" | browser.driver: "existing-session" |
Most config changes apply without restart:
After upgrade, gateway auto-restarts for critical changes (hybrid mode is default).
OpenClaw 对配置严格验证——新版本 schema 不认识旧字段,Gateway 直接拒绝启动。openclaw update 先升级再检查配置,出问题了你就卡在半中间。
Upgrade Guard 补了这个缺口:先备份 → 再升级 → 验证通过才重启 → 失败回滚。
| 模式 | 流程 | 适合谁 |
|---|---|---|
| cautious(默认) | 安装包 → 修配置 → 验证 → 重启 | 大版本升级、自定义配置 |
| openclaw-update | openclaw update → 验证健康 → 需要时回滚 | 日常小版本升级 |
| manual | 只备份+预检 | 自己完全控制升级过程 |
mkdir -p ~/.openclaw/upgrade-guard
ts=$(date +%Y%m%d-%H%M%S)
ver=$(openclaw --version 2>/dev/null | tr ' ' '_')
mkdir -p "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}"
cp ~/.openclaw/openclaw.json "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}/"
ln -sfn "$HOME/.openclaw/upgrade-guard/pre-${ts}-${ver}" "$HOME/.openclaw/upgrade-guard/latest"
openclaw config get agents.defaults.workspace # 配置语法
openclaw doctor --non-interactive # 遗留 key 扫描
openclaw health # Gateway 健康
npm install --global openclaw@latest
openclaw doctor --fix --non-interactive
openclaw config get agents.defaults.workspace # 失败就恢复备份
openclaw gateway restart
openclaw health # 最多等 60 秒
cp ~/.openclaw/upgrade-guard/latest/openclaw.json ~/.openclaw/openclaw.json
openclaw gateway restart
| 旧字段 | 新字段 |
|---|---|
routing.* | channels.* / messages.* |
agent.* | agents.defaults.* / tools.* |
talk.voiceId 等 | talk.provider + talk.providers.* |
identity(根级) | agents.list[].identity |