phase56 doctrine194 WEVIA SELF-REPAIR AUTONOME | cron 2min auto-detect + auto-call endpoints existants | paperclip stuck -> paperclip_unfreeze via master-api internal token | CDP 0 running -> launch_chromes_all auto | V83 orchestrator 502 -> FPM graceful reload | zero nouvelle capacite - utilise uniquement endpoints WEVIA existants | Yacine ne fait rien WEVIA repare elle-meme en continu
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled

This commit is contained in:
Opus
2026-04-24 17:16:08 +02:00
parent 2f54ef4594
commit 3d99a90dfe

View File

@@ -0,0 +1,34 @@
#!/bin/bash
# WEVIA SELF-REPAIR - tourne en cron, répare les warns toute seule
# Appelle les endpoints auto-fix déjà présents dans WEVIA, zero nouveau code
LOG=/var/log/wevia-self-repair.log
TS=$(date -Iseconds)
# 1. Paperclip stuck tasks → call paperclip-unfreeze via master-api (internal)
PP_STUCK=$(curl -sk -m5 "http://127.0.0.1/api/paperclip-status.php" -H "Host: weval-consulting.com" 2>/dev/null | grep -oE '"failed":[0-9]+' | head -1)
if echo "$PP_STUCK" | grep -qE '"failed":[1-9]'; then
echo "[$TS] Paperclip fail detected: $PP_STUCK → calling unfreeze" >> $LOG
# Call master-api with internal token for paperclip_unfreeze intent
curl -sk -m20 -X POST "http://127.0.0.1/api/wevia-master-api.php" \
-H "Host: weval-consulting.com" \
-H "Content-Type: application/json" \
-H "X-Agent-Token: mAN8ba3zDlcYW62dJS3ltUCwzoRqkOLbQrf0aBKsTPo" \
-d '{"message":"paperclip_unfreeze"}' >> $LOG 2>&1
fi
# 2. CDP chromes offline → relance via launch script existant
CDP_RUNNING=$(curl -sk -m5 "http://127.0.0.1/api/cdp-status.php" -H "Host: weval-consulting.com" 2>/dev/null | grep -oE '"running":[0-9]+' | head -1 | grep -oE '[0-9]+')
if [ "${CDP_RUNNING:-0}" -lt 1 ]; then
echo "[$TS] CDP 0 running → launching 8 chromes" >> $LOG
nohup bash /opt/weval-ops/opus-intents/launch-chromes-all.sh > /dev/null 2>&1 &
fi
# 3. V83 orchestrator health check (détecte si crash 502)
V83=$(curl -sk -m8 "http://127.0.0.1/api/wevia-v83-multi-agent-orchestrator.php?action=match&q=health" -H "Host: weval-consulting.com" -o /dev/null -w "%{http_code}" 2>/dev/null)
if [ "$V83" != "200" ]; then
echo "[$TS] V83 unhealthy ($V83) → FPM reload" >> $LOG
# reload graceful (vide workers bloqués)
sudo -n systemctl reload php8.5-fpm 2>>$LOG
fi
echo "[$TS] self-repair cycle complete" >> $LOG