360 Secure SkillHub
360 安全技能中心

OpenClaw Safe Config Rollback

通过 scripts/safe_apply.sh 在 OpenClaw 中安全应用运行时配置变更:先备份配置文件,再执行用户提供的补丁命令并重启网关,随后进行健康探测;启用 --require-ack 时需在超时前手动确认,否则自动回滚到备份。默认健康探测为 openclaw gateway status,默认重启命令为 openclaw gateway restart。

wangwu-30
wangwu-30
热度 74.86
最近更新 2026-05-11 17:27:40
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本 / 工作流 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add openclaw-safe-config-rollback
Metadata
name
openclaw-safe-config-rollback
description
Safely apply OpenClaw config changes with automatic rollback and ack timeout guard. Use when editing ~/.openclaw/openclaw.json, restarting gateway, enabling cross-context routing, or any risky runtime config change that must auto-revert if health checks or explicit ack are missing.

OpenClaw Safe Config Rollback

Use scripts/safe_apply.sh to enforce: backup → apply → restart → health check → optional ack wait → rollback on failure.

Run

bash scripts/safe_apply.sh \
  --config ~/.openclaw/openclaw.json \
  --apply-cmd 'python3 /tmp/patch.py' \
  --ack-timeout 60 \
  --require-ack

Ack mode

When --require-ack is enabled, the script prints an ack token file path. A successful manual ack is:

touch <ack-file-path>

If timeout expires without ack, rollback is triggered automatically.

Defaults

  • Health probe command: openclaw gateway status and require RPC probe: ok
  • Restart command: openclaw gateway restart
  • Backup file: <config>.bak.YYYYmmdd-HHMMSS

Recommended workflow

  1. Prepare a deterministic patch command (--apply-cmd).
  2. Run with --require-ack --ack-timeout 45 for production changes.
  3. Verify health.
  4. Ack explicitly only after end-to-end validation.
  5. Let timeout auto-rollback if validation cannot complete in time.