Token导航 LogoToken导航TokenDH.com
效率需要联网clawhub未标认证来源可访问clear审计通过

gateway-auto-rollback网关自动回滚

Agent Skill

gateway-auto-rollback 用于补充效率相关能力,适合在 OpenClaw 中需要让 Agent 承接效率相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

13,304

周安装

533

GitHub Stars

公开资料未说明

下载量

4,307
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gateway-auto-rollback(网关自动回滚)
来源仓库:https://github.com/halfmoon82/gateway-auto-rollback
安装命令:
openclaw skills install gateway-auto-rollback
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install gateway-auto-rollback

简介

gateway-auto-rollback 为 OpenClaw Gateway 提供三层配置保护机制。

  • 包含修改前备份、修改后验证与自动回滚恢复功能。
  • 有效防止误操作导致的服务中断与配置丢失。
  • 安装命令为 openclaw skills install gateway-auto-rollback。
  • 需监控系统日志与磁盘空间以保证备份文件完整性。

SKILL.md

name
gateway-auto-rollback
description
|

Gateway Auto-Rollback

Three-layer configuration protection for OpenClaw Gateway — never break your config again.

What It Does

Automatically protects your OpenClaw configuration files with:

  1. Pre-modification backup — SHA256 content-addressed snapshots before any change
  2. Post-modification validation — JSON syntax check + Gateway health probe
  3. Automatic rollback — instant restore if validation fails

When to Use

  • Before modifying openclaw.json, exec-approvals.json, or skills.json
  • When running automated config changes (cron jobs, scripts)
  • As a background safety net during development
  • When you want peace of mind that a bad config won't take down your agent

Quick Start

One-shot check (before manual edits)

python3 gateway-auto-rollback.py

This initializes the backup directory, validates current config, and logs status.

Watch mode (background daemon)

python3 gateway-auto-rollback.py --watch &

Monitors critical config files every 3 minutes. Auto-exits after 3 consecutive healthy checks (config is stable).

How It Works

Before Modification        During              After Modification
       ↓                    ↓                        ↓
  Backup + Hash  ───→  Execute Change  ───→  JSON Validate + Health Check
       │                                          │
       └──────────────────────────────────────→ Auto-rollback on failure

Protected Files

FileDescription
openclaw.jsonMain Gateway configuration
exec-approvals.jsonCommand execution approvals
skills.jsonSkills registry

Backup Naming

Backups are stored in ~/.openclaw/backup/ with content-addressed names:

openclaw.json.20260301_053612.a1b2c3d4.bak
                 ↑ timestamp    ↑ SHA256 prefix (dedup)

API Reference

Python Functions

from gateway_auto_rollback import (
    pre_modification_check,   # Call before modifying config
    post_modification_verify, # Call after modifying config
    create_backup,            # Manual backup creation
    validate_json,            # JSON syntax validation
    check_gateway_health,     # Gateway health probe
    rollback_to_backup,       # Manual rollback
    watch_config_files,       # Start watch daemon
)

Pre-modification flow

from pathlib import Path

config = Path.home() / ".openclaw" / "openclaw.json"

# Returns backup path on success, False on failure
backup = pre_modification_check(config)

# ... make your changes ...

# Validates and auto-rolls back if needed
success = post_modification_verify(config, backup)

Watch mode details

The watcher:

  • Polls every 3 minutes (gives Gateway time to restart)
  • Detects changes via SHA256 hash comparison
  • Auto-creates backup when change detected
  • Validates JSON + health check after each change
  • Auto-exits after 3 consecutive healthy checks (config stabilized)
  • Logs all events to ~/.openclaw/logs/config-modification.log

Integration with Cron

Set up periodic health checks:

# Cron job example: check every hour
0 * * * * python3 /path/to/gateway-auto-rollback.py

Or use OpenClaw's built-in cron:

{
  "name": "Gateway-Auto-Rollback",
  "schedule": { "kind": "cron", "expr": "0 */6 * * *", "tz": "Asia/Shanghai" },
  "payload": {
    "kind": "agentTurn",
    "message": "Run gateway health check. If unhealthy, rollback to latest backup."
  },
  "sessionTarget": "isolated"
}

Manual Rollback

If you need to manually restore a config:

# List available backups (newest first)
ls -lt ~/.openclaw/backup/ | head -10

# Restore a specific backup
cp ~/.openclaw/backup/openclaw.json.20260301_053612.a1b2c3d4.bak \
   ~/.openclaw/openclaw.json

# Restart Gateway
openclaw gateway restart

# Verify
curl -s http://127.0.0.1:18789/api/health

Testing

Run the included test suite to verify the mechanism works:

bash test-rollback-mechanism.sh

Tests cover:

  • Backup directory existence
  • JSON validation
  • SHA256 hash computation
  • Backup creation and restore
  • Watch daemon status
  • Log file integrity
  • Script permissions

Logs

All events are logged to ~/.openclaw/logs/config-modification.log:

[2026-03-01 05:37:00] INFO: ✅ 备份创建: openclaw.json.20260301_053612.a1b2c3d4.bak
[2026-03-01 05:37:01] INFO: ✅ 修改验证通过
[2026-03-01 05:40:00] WARN: ⚠️ 检测到修改: openclaw.json
[2026-03-01 05:40:01] ERROR: JSON 验证失败 — 触发回滚

Requirements

  • Python 3.8+
  • OpenClaw Gateway running (for health checks)
  • No additional pip packages needed (stdlib only)

File Structure

gateway-auto-rollback/
├── SKILL.md                      # This file
├── _meta.json                    # ClawHub metadata
├── gateway-auto-rollback.py      # Main script (backup/validate/rollback/watch)
└── test-rollback-mechanism.sh    # Test suite

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

89.99%
按下载量换算3,876

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills