fix: serialize ready diagnostic close and exact native prompt handling

This commit is contained in:
阿白叔 committed 2026-11-17 04:20:05 +08:00
1 parent eaff46e50e
commit fd50805380
6 files changed
+233 -16

No files matched your search

+17 -2
View File
@@ -412,6 +412,14 @@ def phase_for_event(event, current=None):
return mapping.get(stage, current or DialogPhase.PCB_STARTING)
def _diagnostic_close_event(job, event, target_pid):
return (job.get('diagnostic_only') is True and event.get('stage') == 'diagnostic_wm_close'
and target_pid is not None and event.get('pcb_pid') == target_pid
and type(event.get('hwnd')) is int and event['hwnd'] > 0
and bool(job.get('operation_id')) and event.get('operation_id') == job['operation_id']
and all(event.get(key) == job.get(key) for key in ('project', 'pcb', 'desktop')))
def classify_verify_dispatch(*, verify_invoked, invoke_returned, target_pid, observation):
"""Classify a returned Verify command that never started its PCB.
@@ -951,6 +959,7 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
events = root/'events.jsonl'
offset = 0
target_pid = None
diagnostic_closing = False
launcher_pid = None
lm_pid = None
verify_invoked = False
@@ -1002,7 +1011,7 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
dialog_supervisor = DialogSupervisor(
AgentDialogBackend(dialog_agent, pids=lambda: {
int(pid) for pid in (target_pid, lm_pid, launcher_pid) if pid}),
rules=load_rules(default_rules_path()),
rules=load_rules(default_rules_path(), diagnostic_only=request.diagnostic_only),
)
else:
dialog_supervisor = DialogSupervisor(Win32DialogBackend(
@@ -1045,6 +1054,8 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
except json.JSONDecodeError:
break
timing.record(event)
if _diagnostic_close_event(job, event, target_pid):
diagnostic_closing = True
if event.get('pcb_pid'): target_pid = event['pcb_pid']
if event.get('launcher_pid'): launcher_pid = event['launcher_pid']
if event.get('lm_pid'): lm_pid = event['lm_pid']
@@ -1083,7 +1094,11 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
except Exception as error:
observation = {'error': str(error)}
last_post_verify_observation = observation
if dialog_agent is not None and target_pid is None:
if diagnostic_closing:
# The exact diagnostic worker owns its bounded close/No sequence.
from .dialog_supervisor import DialogPollResult
dialog_result = DialogPollResult(activity=False)
elif dialog_agent is not None and target_pid is None:
# The Library Manager Verify route starts its own window
# before it launches Expedition PCB. Do not feed that
# large MFC main window to the PCB dialog probe; it can