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 voice transcriber retries, systemd paths, and backfill gate exit

Cursor Agentcfc091f5e07c
diff --git a/claude-ops/bin/wa-inbox-fresh.sh b/claude-ops/bin/wa-inbox-fresh.sh
index a0e45081..1aaab265 100755
--- a/claude-ops/bin/wa-inbox-fresh.sh
+++ b/claude-ops/bin/wa-inbox-fresh.sh
@@ -56,6 +56,13 @@ before=$(sqlite3 "$DB" "SELECT COALESCE(datetime(MAX(timestamp)),'1970-01-01') F
# 2. force backfill
code=$(curl -fsS -m 20 -X POST -o /dev/null -w "%{http_code}" "$BRIDGE/api/backfill" 2>/dev/null || echo "ERR")
log "wa-fresh: backfill → HTTP ${code}"
+case "$code" in
+ 2*) ;;
+ *)
+ log "wa-fresh: ERROR backfill failed (HTTP ${code}) — store may be stale, do not trust it"
+ exit 2
+ ;;
+esac
# 3. bounded wait for the store to settle (after backfill, before transcription)
new=0
diff --git a/claude-ops/scripts/install-whatsapp-bridge-linux.sh b/claude-ops/scripts/install-whatsapp-bridge-linux.sh
index 21110fd4..12ccd048 100755
--- a/claude-ops/scripts/install-whatsapp-bridge-linux.sh
+++ b/claude-ops/scripts/install-whatsapp-bridge-linux.sh
@@ -151,7 +151,9 @@ if [ "$WITH_BACKFILL_TIMER" -eq 1 ]; then
fi
if [ "$WITH_TRANSCRIBE_TIMER" -eq 1 ]; then
- cp "$WA_ASSETS/systemd/whatsapp-transcribe.service" "$SYSTEMD_DIR/"
+ sed "s|__INSTALL_DIR__|$INSTALL_DIR|g" \
+ "$WA_ASSETS/systemd/whatsapp-transcribe.service" \
+ > "$SYSTEMD_DIR/whatsapp-transcribe.service"
cp "$WA_ASSETS/systemd/whatsapp-transcribe.timer" "$SYSTEMD_DIR/"
# The transcribe service reads OPENAI_API_KEY from this EnvironmentFile.
if [ ! -f "$HOME/.config/systemd/env/mcp-secrets.env" ]; then
diff --git a/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service
index 9df8bc78..a8a9ef6c 100644
--- a/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service
+++ b/claude-ops/scripts/whatsapp/systemd/whatsapp-transcribe.service
@@ -9,11 +9,13 @@ PartOf=whatsapp-bridge.service
Type=oneshot
# Batch may run many Whisper calls; disable the default ~90s start timeout.
TimeoutStartSec=0
+# Relative media paths from /api/download resolve against the bridge cwd.
+WorkingDirectory=__INSTALL_DIR__/whatsapp-bridge
# OPENAI_API_KEY (and other secrets) for the metered Whisper API.
-EnvironmentFile=%h/.config/systemd/env/mcp-secrets.env
+EnvironmentFile=-%h/.config/systemd/env/mcp-secrets.env
# Wait up to 10s for the bridge :8080 before downloading media.
ExecStartPre=/bin/sh -c 'for i in 1 2 3 4 5; do ss -ltn 2>/dev/null | grep -q ":8080" && exit 0; sleep 2; done; exit 0'
-ExecStart=/usr/bin/python3 %h/.local/share/whatsapp-mcp/transcriber/transcribe_voice_notes.py --days 2 --max 80
+ExecStart=/usr/bin/python3 __INSTALL_DIR__/transcriber/transcribe_voice_notes.py --days 2 --max 80
StandardOutput=journal
StandardError=journal
SyslogIdentifier=whatsapp-transcribe
diff --git a/claude-ops/scripts/whatsapp/transcribe_voice_notes.py b/claude-ops/scripts/whatsapp/transcribe_voice_notes.py
index e902041a..badebb33 100755
--- a/claude-ops/scripts/whatsapp/transcribe_voice_notes.py
+++ b/claude-ops/scripts/whatsapp/transcribe_voice_notes.py
@@ -39,7 +39,6 @@ DB = os.path.expanduser(
BRIDGE = "http://127.0.0.1:8080/api/download"
LOCKDIR = "/tmp/.wa-transcribe.lock"
PIDFILE = os.path.join(LOCKDIR, "pid")
-FAIL_MARKER = "[voice] (transcription unavailable)"
def _pid_alive(pid):
@@ -77,15 +76,6 @@ def acquire_lock():
return True
-def mark_unavailable(con, mid, jid):
- con.execute(
- "UPDATE messages SET content=? WHERE id=? AND chat_jid=? "
- "AND (content='' OR content IS NULL)",
- (FAIL_MARKER, mid, jid),
- )
- con.commit()
-
-
def download(msg_id, chat_jid):
body = json.dumps({"message_id": msg_id, "chat_jid": chat_jid}).encode()
req = urllib.request.Request(
@@ -164,13 +154,11 @@ def main():
path = download(mid, jid)
if not path or not os.path.exists(path):
fail += 1
- mark_unavailable(con, mid, jid)
print(f" [{i}] {mid[:8]} download-fail", flush=True)
continue
text = transcribe(path, key)
if not text:
fail += 1
- mark_unavailable(con, mid, jid)
print(f" [{i}] {mid[:8]} transcribe-fail", flush=True)
continue
con.execute(
@@ -183,7 +171,6 @@ def main():
print(f" [{i}] {mid[:8]} ({'me' if mine else 'them'}) ok", flush=True)
except Exception as e:
fail += 1
- mark_unavailable(con, mid, jid)
print(f" [{i}] {mid[:8]} err {e}", flush=True)
time.sleep(0.2)
con.close()