Files
html/wiki/session-V111-token-health-orchestrator.md
opus 5e98086e7b
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
AUTO-BACKUP 20260421-1030
2026-04-21 10:30:03 +02:00

5.5 KiB

V111 - token_health Orchestrator agent + findings 3 expired - 2026-04-21

Objectif

Ajouter un agent token_health default=true dans __orch_registry pour que WEVIA Master remonte automatiquement l'état de santé des 11 API tokens.

Cohérent avec V110 fpm_monitor (observabilité continue) et pattern "honnêteté KPI" de V9.61 (Ollama port fix) / V9.62 (autonomy refresh).

Finding critique V111

Probe live via token-health-real.php (V9.48, test probe avec GET /models):

Provider Status HTTP Length Notes
sambanova OK 200 36
openrouter OK 200 73
cerebras OK 200 52
groq EXPIRED 400 56 à renouveler
gemini OK 200 39
mistral OK 200 32
deepseek OK 200 35
huggingface OK 200 37
alibaba EXPIRED 401 35 auth refusé
anthropic OK 200 108 Claude API key
github EXPIRED 403 80 GitHub PAT expired 15-avr confirmé

Health global: 8/11 OK = 72.7%

Architecture écosystème tokens (V9.57-V9.59-V111)

Endpoint Rôle Status
/api/token-update.php Reçoit nouveaux tokens de Blade Selenium ✓ Exists
/api/token-health-real.php Probe live par provider ✓ Exists (V9.48)
/api/token-updates-pending/ Queue dir pour tokens reçus ⚠ Créé lazy
token-apply.sh cron Apply queue → secrets.env MANQUANT
/api/scripts/token-health-monitor.sh Script pour Orchestrator V111 créé

GAP identifié: le loop tokens est incomplet. Blade Selenium POSTe un token → reçoit OK → queue JSON file. Mais aucun cron n'applique la queue à /etc/weval/secrets.env. Donc les tokens reçus s'accumulent sans être effectivement appliqués.

Décision V111 (doctrine respect): je NE crée PAS token-apply.sh maintenant. Secrets.env écriture = acte critique qui nécessite validation Yacine explicite. Je me limite à l'observation (token_health agent).

Solution V111

Script: /var/www/html/api/scripts/token-health-monitor.sh

#!/bin/bash
TH=$(curl -sk --max-time 30 "http://127.0.0.1/api/token-health-real.php" -H "Host: weval-consulting.com")
echo "$TH" | python3 -c "
import json, sys
d = json.load(sys.stdin)
r = d.get('results', [])
ok = sum(1 for p in r if p.get('status') == 'OK')
total = len(r)
expired = total - ok
pct = int(ok * 100 / total) if total else 0
expired_list = ','.join(p['provider'] for p in r if p.get('status') != 'OK')
print(f'providers={total} ok={ok} expired={expired} health={pct}% expired_list={expired_list}')
"

Execution autonome: providers=11 ok=8 expired=3 health=72% expired_list=groq,alibaba,github

Agent: Orchestrator token_health

/var/www/html/api/wevia-autonomous.php — inséré après fpm_monitor (V110):

"token_health" => ["cmd"=>"bash /var/www/html/api/scripts/token-health-monitor.sh 2>/dev/null", 
                   "default"=>true, "timeout"=>35],

GOLD vault: /opt/wevads/vault/wevia-autonomous.php.GOLD-V110-20260421-101658

Validation live

Query "multiagent bilan complet tokens health"

### plan: 14 agents (was 13 avant V111)
### token_health
providers=11 ok=8 expired=3 health=72% expired_list=groq,alibaba,github
### fpm_monitor
load=1.73 2.90 3.38 fpm_workers=73/150 mem_used=38% connections=168
### architecture_quality
orphans_count: 0 pages [ok]
...

Impact

Yacine (ou tout admin) peut maintenant via une seule requête Master "multiagent bilan complet" :

  • Voir santé orphans (V100+V108 zero orphans)
  • Voir FPM load/workers/mem (V110)
  • Voir quels tokens sont expirés et à renouveler (V111)

3 tokens à action :

  • github (ghp_Z0WDEn expired 15-avr confirmed by 403)
  • groq (400 - tier limit dépassé ou rotated)
  • alibaba (401 - auth refusé)

L99 NonReg post V111

153/153 PASS | 0 FAIL | 100% | 56.5s
TS: 20260421_102743

Chain V96→V111

Version Commit Sujet
V96-V108 cd86b19f9 Orphans Rescue ecosystem (ZERO ORPHANS)
V110 ede9a5197 fpm_monitor Orchestrator agent
V111 TBD token_health Orchestrator agent

Autres Claudes récents

  • V9.63 678ab0975: CrowdSec self-ban fix (502 transients resolved)
  • V9.62 5765ba28d: autonomy-controller force refresh
  • V9.59 6564274db: Blade MCP WhatsApp/GitHub/Groq task format

Doctrines appliquées

  • Doctrine 0: Root cause (visibilité tokens manquante dans multi-agent)
  • Doctrine 2: Zero écrasement (agent additif, pas de modif existant)
  • Doctrine 3: Zero suppression
  • Doctrine 4: Honnêteté KPI (token expiry reflété immédiatement)
  • Doctrine 14: Test-driven (script + live multi-agent validation)
  • Doctrine 16: Script externe (pattern V110 éprouvé)
  • Doctrine 54: chattr unlock/lock
  • Doctrine 60: UX premium (bilan one-query include tokens)
  • Doctrine 95: Traçabilité wiki + vault
  • Doctrine 100: Train release

Action requise Yacine (non-automatique)

  • Renouveler GitHub PAT (expired 15-avr) via GitHub UI + POST vers /api/token-update.php
  • Vérifier Groq account tier (probablement rate-limit plutôt qu'expired)
  • Alibaba API key régénération
  • (Optionnel) Autoriser création token-apply.sh pour fermer le loop queue → secrets.env

Next V112+ pending

  • V86 Auth Guard HMAC E2E test (Playwright auth cookie persistence)
  • CloudFlare rate-limit monitor agent (complément de fpm_monitor)
  • NPS Pharma Cloud (Yacine validation requise, ZERO send mail)
  • Huawei Cloud / Vistex business