fix: preserve handoff cleanup and ICDB cancellation bindings

This commit is contained in:
阿白叔 committed 2026-11-18 09:05:22 +08:00
1 parent b4737b5102
commit fa1f662e1d
6 files changed
+169 -10

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ def native_backup_target(request, *, mode='versions', target_database=None):
values = re.findall(r'^KEY iCDBDir "([^"\r\n]+)"\s*$', _project_text(config), re.M)
if len(values) != 1 or not values[0] or PureWindowsPath(values[0]).root or PureWindowsPath(values[0]).drive:
if config == project or target_database is None:
raise ValueError('NATIVE_TARGET_UNCONFIRMED: 主 PRJ 的 iCDBDir 未唯一绑定')
raise ValueError('NATIVE_TARGET_UNCONFIRMED: 主 PRJ 的 iCDBDir 必须唯一且为工程内相对路径,不支持绝对路径或多条记录')
continue
database = (config.parent/values[0]).resolve()
if not database.is_relative_to(project.parent.resolve()):
+10 -8
View File
@@ -336,11 +336,13 @@ def _supervise_repair(command, desktop, cancel, root, timeout_seconds, progress,
worker.request_stop()
raise
finally:
if entered:
native.__exit__(None, None, None)
if worker.poll() is None and getattr(worker, 'session_record_path', None):
from .session_record import handoff_session
from .operation_queue import hold_native_handoff
handoff_session(worker.session_record_path, evidence_root=root, process=worker)
hold_native_handoff(worker, worker.session_record_path)
worker.close()
try:
if entered:
native.__exit__(None, None, None)
if worker.poll() is None and getattr(worker, 'session_record_path', None):
from .session_record import handoff_session
from .operation_queue import hold_native_handoff
handoff_session(worker.session_record_path, evidence_root=root, process=worker)
hold_native_handoff(worker, worker.session_record_path)
finally:
worker.close()
+1
View File
@@ -1111,6 +1111,7 @@ class MainWindow(QWidget):
self._current_job = previous_job
self._jobs.pop(job.context.operation_id, None)
job.context = task.context
self.stop = task.stop
self._jobs[job.context.operation_id] = job
task.ui_job = job
task.revision = self._view_revision
+7 -1
View File
@@ -1010,7 +1010,7 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
from .desktop_worker import DesktopWorker
from .dialog_supervisor import AgentDialogBackend, DialogSupervisor, Win32DialogBackend
from .dialog_models import DialogPhase
from .operation_queue import check_active, native_channel
from .operation_queue import TaskHandoff, check_active, native_channel
check_active()
worker_launch_attempted = False
native = native_channel()
@@ -1322,6 +1322,12 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
'detail': '已转后台观察,可查看状态'})
from .operation_queue import hold_native_handoff
hold_native_handoff(process, process.session_record_path)
except TaskHandoff as error:
handoff_result = _handoff_verify_result(error)
if handoff_result.evidence_path:
_write_optional_evidence(handoff_result.evidence_path,
{'block_name': request.block_name, **asdict(handoff_result)})
raise
except Exception as error:
close_errors.append(str(error))
if 'process' in locals():