Skip to content

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.

fix(whatsapp): honor shared restart-floor in bridge-up + ops-autofix to stop restart churn (#452)

Aurora Capital386405143e1d
diff --git a/claude-ops/bin/ops-autofix b/claude-ops/bin/ops-autofix
index 24efb592..f2d6282c 100755
--- a/claude-ops/bin/ops-autofix
+++ b/claude-ops/bin/ops-autofix
@@ -96,7 +96,14 @@ fix_bridge_fts() {
if [ -f "$BRIDGE_BIN" ] && ! grep -qa "fts5" "$BRIDGE_BIN" 2>/dev/null; then
if command -v go >/dev/null 2>&1; then
if ( cd "$(dirname "$BRIDGE_BIN")" && CGO_ENABLED=1 go build -tags "sqlite_fts5" -o whatsapp-bridge . ) 2>/dev/null; then
+ # This restart is mandatory (the freshly-built binary must be loaded) and rare
+ # (only when the binary lacks fts5), so we don't floor-SKIP it — but we DO stamp
+ # the shared cross-caller restart floor afterwards so other callers
+ # (wa-bridge-keepalive.sh, wa-inbox-fresh.sh, whatsapp-bridge-up.sh) back off for
+ # 180s and don't pile on. whatsmeow can't re-fetch phone-sent messages on
+ # reconnect, so coordinated restarts prevent dropping the user's own sends.
systemctl --user restart whatsapp-bridge.service 2>/dev/null || true
+ date +%s > "$HOME/.claude/.once.whatsapp-bridge-restart.last" 2>/dev/null || true
log_fix "bridge-fts: rebuilt bridge binary with -tags sqlite_fts5 (was missing fts5 module)"
else
log_fail "bridge-fts: binary lacks fts5 and rebuild failed — skipping migration (triggers would break message storage)"
diff --git a/claude-ops/scripts/lib/whatsapp-bridge-up.sh b/claude-ops/scripts/lib/whatsapp-bridge-up.sh
index 5cc741b3..ec340d6a 100755
--- a/claude-ops/scripts/lib/whatsapp-bridge-up.sh
+++ b/claude-ops/scripts/lib/whatsapp-bridge-up.sh
@@ -25,7 +25,24 @@ case "$OS" in
;;
Linux)
if command -v systemctl >/dev/null && systemctl --user cat whatsapp-bridge.service >/dev/null 2>&1; then
- systemctl --user restart whatsapp-bridge.service
+ # Shared cross-caller restart floor — the SAME stamp wa-bridge-keepalive.sh and
+ # wa-inbox-fresh.sh use ($HOME/.claude/.once.whatsapp-bridge-restart.last). One
+ # bridge restart / 180s max across ALL callers. whatsmeow CANNOT re-fetch your own
+ # phone-sent messages on reconnect, so each uncoordinated restart is a window where
+ # outbound you typed on your phone is dropped permanently. Without this floor,
+ # parallel ops health-checks calling this wrapper churn the bridge (observed: 4
+ # restarts in 1 second) and silently lose sends. If a restart happened <180s ago the
+ # bridge is already coming up — skip and let the wait loop below confirm :8080.
+ _wa_floor="$HOME/.claude/.once.whatsapp-bridge-restart.last"
+ _wa_skip=0
+ if [ -f "$_wa_floor" ]; then
+ _wa_last="$(cat "$_wa_floor" 2>/dev/null || echo 0)"
+ if [ "$(( $(date +%s) - ${_wa_last:-0} ))" -lt 180 ]; then _wa_skip=1; fi
+ fi
+ if [ "$_wa_skip" = 0 ]; then
+ systemctl --user restart whatsapp-bridge.service
+ date +%s > "$_wa_floor" 2>/dev/null || true
+ fi
else
echo "claude-ops/whatsapp-bridge-up: no whatsapp-bridge.service installed on this Linux host." >&2
echo "Run: bash \$CLAUDE_PLUGIN_ROOT/scripts/install-whatsapp-bridge-linux.sh --wa-phone <E.164>" >&2