返回顶部
g

gateway-health-monitor

Monitor and auto-fix OpenClaw gateway stability issues. Diagnoses launchd throttling, plugin restart loops, hung shutdowns, and macOS power management interference. Use when the gateway keeps disconnecting, restarting, or staying down for long periods. Triggers on "gateway down", "gateway keeps restarting", "disconnected", "gateway unstable", "launchd throttling", "gateway won't start".

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
50
下载量
0
收藏
概述
安装方式
版本历史

gateway-health-monitor

# Gateway Health Monitor Diagnose and fix OpenClaw gateway stability issues on macOS. Covers the most common failure modes that cause extended downtime. ## Quick Diagnosis Run the diagnostic script: ```bash bash scripts/diagnose.sh ``` This checks: process state, launchd classification, restart count, plist config, power management, and plugin resolve loops. ## Common Failure Modes ### 1. Plugin Restart Loop (most common) **Symptoms**: Gateway restarts every 5-7 minutes. Log shows `restartReason=config.patch` with `plugins.installs.*.resolvedAt`. **Cause**: Plugins re-resolve on every boot → write new timestamps to `openclaw.json` → config watcher detects "change" → triggers deferred restart → SIGTERM → repeat. **Fix**: Set `gateway.reload.mode` to `"hot"`: ```bash openclaw config set gateway.reload.mode '"hot"' ``` In `hot` mode, safe changes hot-apply instantly. Critical changes (like plugin timestamps) only log a warning — no auto-restart. This breaks the loop. **Verify**: `grep "reload" ~/.openclaw/logs/gateway.log | tail -5` should show `config change applied (dynamic reads)` instead of `restart`. ### 2. macOS Throttling ("inefficient" classification) **Symptoms**: Gateway goes down and stays down for 30-60+ minutes. `launchctl print` shows `immediate reason = inefficient`. **Cause**: After many restarts (10+/day), macOS marks the job as low-priority and delays restarts via App Nap / Power Nap logic. **Fix**: Add these keys to the launchd plist (`~/Library/LaunchAgents/ai.openclaw.gateway.plist`): ```xml <key>ProcessType</key> <string>Interactive</string> <key>LowPriorityBackgroundIO</key> <false/> ``` Then reload: ```bash launchctl bootout gui/$(id -u)/ai.openclaw.gateway launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist ``` **Note**: `openclaw gateway start` overwrites the plist. Use the patcher script (below) to auto-reapply. ### 3. Hung Shutdown **Symptoms**: Gateway receives SIGTERM but doesn't exit. launchd can't restart because old PID still alive. **Fix**: Set `ExitTimeOut` in the plist: ```xml <key>ExitTimeOut</key> <integer>10</integer> ``` After 10 seconds, launchd sends SIGKILL. ### 4. Power Nap Interference **Symptoms**: Gateway goes down during Mac sleep/wake cycles. **Check**: `pmset -g | grep powernap` **Fix**: `sudo pmset -a powernap 0` ## Plist Auto-Patcher Since `openclaw gateway start` overwrites the plist, use `scripts/patch-plist.sh` as a launchd WatchPaths agent: ```bash # Install the patcher bash scripts/install-patcher.sh ``` This creates a launchd agent that watches the gateway plist and re-adds `ExitTimeOut`, `ProcessType`, and `LowPriorityBackgroundIO` within seconds of any overwrite. ## Monitoring ### One-liner health check ```bash bash scripts/health-check.sh ``` Returns exit code 0 if healthy, 1 if issues detected. Suitable for cron or heartbeat integration. ### Continuous monitoring (cron integration) Add to your OpenClaw cron: ``` Check gateway health: bash ~/path/to/scripts/health-check.sh && echo "Gateway healthy" || echo "ALERT: Gateway issues detected" ``` ## Recommended Configuration For maximum stability on macOS: ```json5 { gateway: { reload: { mode: "hot" }, }, } ``` Plus plist keys: `ExitTimeOut=10`, `ProcessType=Interactive`, `LowPriorityBackgroundIO=false`, `ThrottleInterval=1`, `KeepAlive=true`. ## Troubleshooting Reference | Symptom | Check | Fix | |---------|-------|-----| | Restarts every 5-7 min | `grep restartReason gateway.log` | `reload.mode = "hot"` | | Down 30-60+ min | `launchctl print` → "inefficient" | ProcessType=Interactive | | Won't exit on SIGTERM | `ps -p PID` after SIGTERM | ExitTimeOut=10 | | Down after sleep | `pmset -g \| grep powernap` | `pmset -a powernap 0` | | Plugin timestamps changing | `grep resolvedAt openclaw.json` | `reload.mode = "hot"` |

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gateway-health-monitor-1775928678 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gateway-health-monitor-1775928678 技能

通过命令行安装

skillhub install gateway-health-monitor-1775928678

下载 Zip 包

⬇ 下载 gateway-health-monitor v1.0.0

文件大小: 6.63 KB | 发布时间: 2026-4-12 10:04

v1.0.0 最新 2026-4-12 10:04
Initial release: diagnose and fix OpenClaw gateway stability issues on macOS (launchd throttling, plugin restart loops, hung shutdowns, power management)

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部