gateway-watchdog
Auto-detect and recover from stuck ZeptoClaw gateway sessions.
- License 许可
- MIT
- 最近更新
- 2026-10-31
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- gateway-watchdog
- version
- 1.0.0
- metadata
- { "zeptoclaw": { "emoji": "?" } }
- description
- Auto-detect and recover from stuck ZeptoClaw gateway sessions.
02 资源文件 3
- 参考文档README.md1.7 KB
- 参考文档references/outline-starter.md211 B
- 其他skill.zig6.6 KB
03 SKILL.md 正文
Gateway Watchdog Skill
Automated monitoring and recovery for ZeptoClaw gateway stuck sessions.
The Problem
Barvis (running inside ZeptoClaw) cannot detect when it is stuck. Common causes:
- Hung tool calls -
web_fetch,daedra, or MCP tools that never return - Image poisoning - GIF files embedded in conversation history
- API timeouts - GitHub Copilot/Claude API hangs
- WhatsApp connection issues - Blocking the gateway event loop
When stuck, the gateway shows:
[diagnostic] stuck session: sessionId=xxx state=processing age=286s
But Barvis cannot see this from inside the stuck session.
The Solution
An external watchdog that:
- Monitors gateway logs for stuck sessions
- Auto-restarts if stuck > 10 minutes (configurable)
- Logs recovery attempts for post-mortem analysis
- Notifies via Cloudflare worker (optional)
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ EXTERNAL WATCHDOG (systemd timer, every 2 min) │
│ - Runs gateway-watchdog.zig │
│ - Checks journalctl for "stuck session" messages │
│ - If age > threshold, restarts gateway │
│ - Logs to ~/.zeptoclaw/logs/gateway-watchdog.log │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ ZEPTOCLAW GATEWAY (systemd service) │
│ - Runs Barvis sessions │
│ - Logs "stuck session" diagnostics │
└─────────────────────────────────────────────────────────────────┘
Triggers
command: /gateway-watchdog command: /watchdog-status command: /watchdog-check scheduled: */2 * * * *
Configuration
stuck_threshold_minutes (integer): Minutes before considering a session stuck (default: 10) log_path (string): Path to watchdog log file (default: ~/.zeptoclaw/logs/gateway-watchdog.log) gateway_service (string): Systemd service name for gateway (default: zeptoclaw-gateway.service) enable_auto_restart (boolean): Whether to auto-restart stuck gateway (default: true) notification_url (string): Optional Cloudflare worker URL for notifications (default: null)
Usage
Check watchdog status
/gateway-watchdog status
Manual check for stuck sessions
/gateway-watchdog check
View recent logs
/gateway-watchdog logs
Configure threshold
/gateway-watchdog threshold 15
Implementation Notes
The watchdog skill runs as a scheduled task every 2 minutes. It:
- Queries systemd journal for "stuck session" messages
- Parses session age from log entries
- If age > threshold, restarts the gateway service
- Logs all actions to the watchdog log file
- Optionally sends notifications to Cloudflare worker
Dependencies
- systemd (for journalctl and service management)
- zig (for watchdog implementation)
04 同仓库更多 Skills
zig-dev
Zig development workflow — build, test, WASM, benchmarks, release. Baala's primary language.
wsl-troubleshooting
WSL2 troubleshooting — DNS fixes, systemd, Windows interop, networking issues.
web-qa
Web app debugging — Chrome headless screenshots, CDN issues, SRI hash fixes, Canvas quirks.
semantic-search
Local semantic search for memory using Ollama embeddings.
rust-cargo
Rust/Cargo workflow — build, test, publish to crates.io, benchmarks, cross-compile.
planckeon-sites
Deploy planckeon physics sites — Zola static sites, GitHub Pages, LaTeX/KaTeX rendering.