fix: replay routing — lookup machine_id dans replay_states + auto-inject machine_id

- /replay/next cherche dans replay_states par machine_id (pas seulement machine_replay_target)
- execute-windows auto-détecte la machine Windows connectée
- resolve_target utilise ThreadPool par défaut (pas le GPU executor saturé)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-03-18 12:05:42 +01:00
parent 81d2d016ff
commit 58e8bbafff
2 changed files with 50 additions and 23 deletions

View File

@@ -969,11 +969,26 @@ def execute_windows():
if vwb_type in ('keyboard_shortcut', 'hotkey') and 'keys' in params:
action['keys'] = params['keys']
# Injecter le machine_id pour le ciblage multi-machine
# Chercher la première machine Windows connectée si pas spécifié
if 'machine_id' not in data or not data.get('machine_id'):
try:
machines_resp = req.get('http://localhost:5005/api/v1/traces/stream/machines', timeout=3)
if machines_resp.ok:
machines = machines_resp.json().get('machines', [])
for m in machines:
mid = m.get('machine_id', '')
if mid and mid != 'default' and 'windows' in mid.lower():
data['machine_id'] = mid
break
except Exception:
pass
try:
resp = req.post(
'http://localhost:5005/api/v1/traces/stream/replay/raw',
json=data,
timeout=30, # Augmenté car le template matching peut prendre du temps
timeout=30,
)
return jsonify(resp.json()), resp.status_code
except req.ConnectionError: