Suite à la mise à jour système qui a basculé Dom de Xorg vers Wayland,
les 4 services systemd côté serveur partaient en boucle restart :
pyautogui levait DisplayConnectionError / KeyError(DISPLAY) à l'import
dans 3 modules, mais l'except n'attrapait qu'ImportError → crash fatal.
Le contournement « ajouter DISPLAY=:1 + XAUTHORITY=/run/user/1000/gdm/
Xauthority dans .service » introduit fin avril était fragile : chemin
invalide en Wayland (Mutter utilise un Xauthority à suffixe aléatoire
qui change à chaque login). Le bon fix est de rendre les imports
pyautogui robustes — le serveur n'a aucun usage légitime de pyautogui,
c'est le client Agent V1 Windows qui pilote souris/clavier.
Modifications :
1. Élargi `except ImportError` → `except Exception` pour pyautogui :
- agent_chat/autonomous_planner.py
- core/execution/input_handler.py
- core/execution/observe_reason_act.py
(action_executor.py était déjà robuste avec except Exception.)
2. Retiré DISPLAY/XAUTHORITY des 4 .service (rustines) :
- rpa-streaming.service
- rpa-vision-v3-{api,worker,dashboard}.service
Block grounding (RPA_GROUNDING_SOCKET) préservé (initiative
séparée de partage VRAM, in-flight).
PYAUTOGUI_AVAILABLE=False est désormais attendu côté serveur Linux ;
les chemins aval (action_executor, autonomous_planner) gèrent déjà
ce cas via des branches "actions simulées" / "pyautogui non disponible".
Prépare la roadmap autonome (Léa daemon Linux + VM Windows) qui
tournera headless via systemd au boot, sans dépendre d'aucune
session graphique active.
Tests : 27/27 baseline sprint QW verts.
47 lines
1.3 KiB
Desktop File
47 lines
1.3 KiB
Desktop File
[Unit]
|
|
Description=RPA Vision V3 - Streaming Server (FastAPI, port 5005)
|
|
Documentation=https://lea.labs.laurinebazin.design
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
|
|
# ---- Runtime ----
|
|
User=dom
|
|
Group=dom
|
|
WorkingDirectory=/home/dom/ai/rpa_vision_v3
|
|
EnvironmentFile=/home/dom/ai/rpa_vision_v3/.env.local
|
|
Environment="PYTHONUNBUFFERED=1"
|
|
Environment="RPA_SERVICE_NAME=rpa-streaming"
|
|
# Service grounding persistant — socket + répertoire d'images partagés via /run/rpa/.
|
|
Environment="RPA_GROUNDING_SOCKET=/run/rpa/grounding.sock"
|
|
Environment="RPA_GROUNDING_IMG_DIR=/run/rpa"
|
|
|
|
# Lancement via le module Python (même commande que svc.sh)
|
|
ExecStart=/home/dom/ai/rpa_vision_v3/.venv/bin/python3 -m agent_v0.server_v1.api_stream
|
|
|
|
# ---- Resilience ----
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
TimeoutStopSec=30
|
|
# Envoyer SIGTERM d'abord, puis SIGKILL après TimeoutStopSec
|
|
KillMode=mixed
|
|
KillSignal=SIGTERM
|
|
|
|
# ---- Hardening (raisonnable pour un poste de dev/prod) ----
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
# /run/rpa/ partagé avec rpa-grounding (socket + images)
|
|
RuntimeDirectory=rpa
|
|
RuntimeDirectoryMode=0755
|
|
RuntimeDirectoryPreserve=yes
|
|
|
|
# Logs -> journald
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=rpa-streaming
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|