360 Secure SkillHub
360 安全技能中心

Gateway Restore

核心功能:支持回滚Slack/Discord网关至已知良好配置,或标记当前配置为已知良好;回滚时自动备份当前配置,执行带健康检查的安全重启,失败则自动回滚。典型场景:网关配置变更故障需快速回滚,或配置更新成功后标记可靠版本。输入为/restore系列命令或自然语言请求,输出为操作确认及执行日志。

halfdeadcat
halfdeadcat
热度 31.51
最近更新 2026-05-18 11:43:47
分类:自动化依赖:代码执行应用场景:自动化脚本 / 任务管理

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add gateway-restore
Metadata
name
restore
description
Restore a gateway to its last known-good configuration, or tag the current config as known-good. Use when a gateway config change breaks something and you need to roll back fast. Responds to /restore slash command.
user-invocable
true

Gateway Restore

Roll back a gateway config to the last known-good state, then restart safely with health checks and automatic rollback on failure.

Usage (as slash command or natural language)

  • /restore — restore the Slack gateway to known-good
  • /restore discord — restore the Discord gateway to known-good
  • /restore tag — tag the current Slack config as known-good
  • /restore tag discord — tag the current Discord config as known-good

How It Works

  1. Backs up the current (broken) config with a timestamped filename
  2. Copies the known-good.json over the live config
  3. Runs the appropriate safe restart script (safe-slack-restart.sh or safe-gateway-restart.sh)
  4. The safe restart script validates health and rolls back if the gateway doesn't come up

Tagging Known-Good

After any successful config change + restart, tag the current config:

bash skills/gateway-restore/scripts/gateway-restore.sh slack --tag-current
bash skills/gateway-restore/scripts/gateway-restore.sh discord --tag-current

This saves it as config-backups/known-good.json. Old tagged versions are also kept as known-good-TIMESTAMP.json.

Script Location

skills/gateway-restore/scripts/gateway-restore.sh

When Invoked via Slash Command

The command-bypass hook handles /restore slash commands automatically — the script runs detached without LLM involvement. You do NOT need to execute the script.

If the hook fires, simply reply confirming the restore is in progress. Do not call exec.

When Invoked via Natural Language

If the user asks to restore via natural language (not a slash command), THEN run the script:

setsid bash /home/swabby/repos/swabby-brain/skills/gateway-restore/scripts/gateway-restore.sh [slack|discord] [--tag-current] > /tmp/restore-output.log 2>&1 &
sleep 2 && cat /tmp/restore-output.log

Parse the request:

  • "restore" / "rollback" → slack gateway
  • "restore discord" → discord gateway
  • "restore tag" → tag current slack config as known-good

If the gateway restarts mid-exec (SIGTERM), that's expected — the restart succeeded.