Gateway Health Monitor
/install 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 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":
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):
\x3Ckey>ProcessType\x3C/key>
\x3Cstring>Interactive\x3C/string>
\x3Ckey>LowPriorityBackgroundIO\x3C/key>
\x3Cfalse/>
Then reload:
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:
\x3Ckey>ExitTimeOut\x3C/key>
\x3Cinteger>10\x3C/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:
# 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 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:
{
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" |
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install gateway-health-monitor - 安装完成后,直接呼叫该 Skill 的名称或使用
/gateway-health-monitor触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Gateway Health Monitor 是什么?
Monitor and auto-fix OpenClaw gateway stability issues. Diagnoses launchd throttling, plugin restart loops, hung shutdowns, and macOS power management interf... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 82 次。
如何安装 Gateway Health Monitor?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install gateway-health-monitor」即可一键安装,无需额外配置。
Gateway Health Monitor 是免费的吗?
是的,Gateway Health Monitor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Gateway Health Monitor 支持哪些平台?
Gateway Health Monitor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Gateway Health Monitor?
由 JimmyClanker(@jimmyclanker)开发并维护,当前版本 v1.0.0。