fix(ORA): overlay = minimiser la fenêtre devant, pas juste chercher OK
Some checks failed
security-audit / Bandit (scan statique) (push) Successful in 14s
security-audit / pip-audit (CVE dépendances) (push) Successful in 10s
security-audit / Scan secrets (grep) (push) Successful in 9s
tests / Lint (ruff + black) (push) Successful in 14s
tests / Tests unitaires (sans GPU) (push) Failing after 15s
tests / Tests sécurité (critique) (push) Has been skipped

Quand la pré-vérification dit NO et qu'aucun pattern de dialogue n'est
détecté, c'est une fenêtre quelconque qui masque la cible (Chrome, etc).
xdotool windowminimize pour la dégager.

Classification améliorée : pré-check rejeté → OVERLAY_BLOCKING
(avant c'était ELEMENT_NOT_FOUND → scroll inutile).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-22 17:03:18 +02:00
parent 6829ad8e79
commit d71d5df4a8

View File

@@ -759,20 +759,21 @@ Règles:
Returns:
ErrorType constant.
"""
# Si l'action a échoué avant même de cliquer, c'est ELEMENT_NOT_FOUND
if not act_success:
print(f"🔎 [ORA/classify] → {ErrorType.ELEMENT_NOT_FOUND} (action non exécutée)")
return ErrorType.ELEMENT_NOT_FOUND
# Vérifier si un dialogue/popup bloque
# Vérifier TOUJOURS si un dialogue/popup/fenêtre bloque
try:
from core.execution.input_handler import check_screen_for_patterns
pattern = check_screen_for_patterns()
if pattern:
print(f"🔎 [ORA/classify] → {ErrorType.OVERLAY_BLOCKING} (pattern={pattern.get('pattern', '?')})")
return ErrorType.OVERLAY_BLOCKING
except Exception as e:
logger.debug(f"[ORA/classify] check_screen_for_patterns échoué: {e}")
except Exception:
pass
# Si l'action a échoué (pré-vérification NO) → probablement une fenêtre devant
if not act_success:
# Le VLM a dit "ce n'est pas le bon élément" → une fenêtre masque la cible
print(f"🔎 [ORA/classify] → {ErrorType.OVERLAY_BLOCKING} (pré-check rejeté = fenêtre devant)")
return ErrorType.OVERLAY_BLOCKING
# Vérifier si l'écran a changé du tout
distance = self._phash_distance(pre.phash, post.phash)
@@ -908,32 +909,25 @@ Règles:
try:
from core.execution.input_handler import check_screen_for_patterns, handle_detected_pattern
# --- Étape 1 : Détecter et identifier le dialogue ---
# --- Étape 1 : Détecter un dialogue connu ---
pattern = check_screen_for_patterns()
if not pattern:
# Le pattern a peut-être disparu entre la classification et ici
return RecoveryAttempt(
error_type=ErrorType.OVERLAY_BLOCKING,
strategy="pattern_vanished",
success=True,
detail="Le dialogue a disparu spontanément"
)
print(f"🔧 [ORA/recovery/overlay] Pattern détecté: {pattern.get('pattern', '?')} → action={pattern.get('action', '?')}")
# --- Étape 2 : Gérer le dialogue (cliquer OK/Fermer) ---
if pattern:
print(f"🔧 [ORA/recovery/overlay] Pattern détecté: {pattern.get('pattern', '?')}")
handled = handle_detected_pattern(pattern)
if not handled:
print(f"⚠️ [ORA/recovery/overlay] Impossible de gérer le pattern automatiquement")
return RecoveryAttempt(
error_type=ErrorType.OVERLAY_BLOCKING,
strategy="handle_failed",
success=False,
detail=f"Pattern '{pattern.get('pattern', '?')}' détecté mais non géré"
)
if handled:
print(f"✅ [ORA/recovery/overlay] Dialogue fermé")
time.sleep(0.5)
else:
print(f"⚠️ [ORA/recovery/overlay] Pattern non géré, minimisation fenêtre")
subprocess.run(['xdotool', 'getactivewindow', 'windowminimize'],
capture_output=True, timeout=2)
time.sleep(0.5)
else:
# Pas de dialogue connu → fenêtre quelconque devant → minimiser
print(f"🔧 [ORA/recovery/overlay] Aucun dialogue connu — minimisation de la fenêtre active")
subprocess.run(['xdotool', 'getactivewindow', 'windowminimize'],
capture_output=True, timeout=2)
time.sleep(0.5)
# --- Étape 3 : Retry l'action originale ---
act_ok = self.act(decision, step_params)