Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
fix(daemon): Linux/systemd status detection + real bridge PID reporting (#524)
Aurora Capitalb0e4baba778d
diff --git a/claude-ops/scripts/daemon-services.default.json b/claude-ops/scripts/daemon-services.default.jsonindex 879934a4..0a08202a 100644--- a/claude-ops/scripts/daemon-services.default.json+++ b/claude-ops/scripts/daemon-services.default.json@@ -17,6 +17,7 @@"enabled": true,"command": "${CLAUDE_PLUGIN_ROOT}/scripts/lib/whatsapp-bridge-up.sh","health_check": "lsof -i :8080 | grep LISTEN",+ "pid_probe": "lsof -ti :8080 -sTCP:LISTEN 2>/dev/null | head -1","restart_delay": 60,"max_restarts": 10,"_note": "Cross-platform bridge starter. Looks at uname: macOS → launchctl kickstart gui/$UID/com.${USER}.whatsapp-bridge ; Linux → systemctl --user restart whatsapp-bridge.service. Install via `bash scripts/install-whatsapp-bridge-linux.sh --wa-phone <E.164>` on Linux hosts; on macOS the legacy launchctl plist still applies. Bridge source: github.com/lharries/whatsapp-mcp (with claude-ops patches applied by install script — see scripts/whatsapp/apply-patches.py)."diff --git a/claude-ops/scripts/ops-daemon-manager.sh b/claude-ops/scripts/ops-daemon-manager.shindex 48ec7a34..1058a8da 100755--- a/claude-ops/scripts/ops-daemon-manager.sh+++ b/claude-ops/scripts/ops-daemon-manager.sh@@ -368,6 +368,35 @@ cmd_status() {fifi;;+ linux|wsl)+ # The daemon runs as a systemd --user unit here, not a launchd plist, so+ # the plist-based detection above never fires. Probe the unit instead:+ # installed = unit file exists (loaded by systemd)+ # running = unit is active + MainPID is alive+ # script_path= ExecStart's ops-daemon.sh path (the live source path)+ # version_match = that script path still exists on disk (Linux's analog+ # of "plist points at current version"; systemd tracks+ # whatever ExecStart points at, so staleness = missing file)+ local unit="claude-ops-daemon.service"+ if systemctl --user cat "$unit" >/dev/null 2>&1; then+ installed=true+ local exec_path+ exec_path="$(systemctl --user show -p ExecStart --value "$unit" 2>/dev/null \+ | grep -oE '/[^ ]*ops-daemon\.sh' | head -1)"+ if [[ -n "$exec_path" ]]; then+ script_path="$exec_path"+ [[ -f "$exec_path" ]] && plist_version_match=true+ fi+ if systemctl --user is-active "$unit" >/dev/null 2>&1; then+ local p+ p="$(systemctl --user show -p MainPID --value "$unit" 2>/dev/null || echo 0)"+ if [[ -n "$p" ]] && [[ "$p" != "0" ]] && kill -0 "$p" 2>/dev/null; then+ pid="$p"+ running=true+ fi+ fi+ fi+ ;;esacif [[ -f "$HEALTH_FILE" ]]; thendiff --git a/claude-ops/scripts/ops-daemon.sh b/claude-ops/scripts/ops-daemon.shindex 1532ffd5..e75576f7 100755--- a/claude-ops/scripts/ops-daemon.sh+++ b/claude-ops/scripts/ops-daemon.sh@@ -455,9 +455,26 @@ print(json.dumps(sys.argv[1]))if [[ -n "$hc_cmd" ]]; then# Command-supervised service: liveness was already determined by# check_health via the configured probe. The tracked PID is an- # ephemeral launcher and not meaningful — report status as-is with a- # null pid; do NOT downgrade running→dead on a dead wrapper PID.+ # ephemeral launcher and not meaningful — never use it for liveness or+ # downgrade running→dead on a dead wrapper PID.+ #+ # For OBSERVABILITY only, if the service registry defines a `pid_probe`+ # command, resolve the REAL externally-supervised PID (e.g. the process+ # LISTENing on the bridge port, owned by whatsapp-bridge.service) and+ # report it. This is strictly reporting — it is never fed back into the+ # restart/liveness path, so it cannot reintroduce the false-dead churn.pid_val="null"+ if [[ "$status" == "running" ]]; then+ local pid_probe_cmd real_pid+ pid_probe_cmd=$(get_service_field "$name" "pid_probe")+ if [[ -n "$pid_probe_cmd" ]]; then+ if real_pid=$(eval "$pid_probe_cmd" 2>/dev/null | head -1 | tr -dc '0-9' | head -c 12); then+ if [[ -n "$real_pid" ]] && kill -0 "$real_pid" 2>/dev/null; then+ pid_val="$real_pid"+ fi+ fi+ fi+ fielif [[ "$pid" == "null" ]] || [[ -z "$pid" ]]; thenpid_val="null"# No PID tracked — status cannot be "running"