--- C:\kefu\deploy\review-assistant-20260917\visual-before\protocol\gui_runtime.py +++ C:\wechat_rpa\gui_runtime.py @@ -91,6 +91,30 @@ if normalized in {SEND_MODE_AUTO, SEND_MODE_REVIEW}: return normalized return SEND_MODE_REVIEW if default == SEND_MODE_REVIEW else SEND_MODE_AUTO + + +def cancel_assistant_review_for_state(state, root): + """Close only the explicitly cancelled episode; never start native I/O.""" + if not isinstance(state, dict) or not state.get("assistant_review_id"): + return True + event = state.get("database_event") or {} + account = str(state.get("account") or event.get("account") or "") + if not account: + return False + coordinator = None + try: + from review_assistant import ReviewAssistantCoordinator + coordinator = ReviewAssistantCoordinator(root=root, account=account) + if coordinator.cancel_review(state) is False: + print("[助理审核] 任务已移除,但提醒取消尚未保存,请检查审核提醒状态") + return False + return True + except Exception as exc: + print(f"[助理审核] 任务已移除,但提醒取消失败({type(exc).__name__}),请检查审核提醒状态") + return False + finally: + if coordinator is not None: + coordinator.close() def delete_pending_reply_file(keys, path="", *, handoff=False, confirm_uncertain=False): @@ -180,6 +204,8 @@ result["error"] = str(exc) return result + for _key, state in removed: + cancel_assistant_review_for_state(state, directory) result["deleted"] = [key for key, _state in removed] result["missing"] = sorted(requested.difference(result["deleted"]).difference(result["protected"])) try: @@ -787,6 +813,11 @@ poll_failures = 0 while not self.stop_event.is_set(): self._reply_wakeup.clear() + # Read-only assistant reconciliation remains available while the screen is busy. + try: + bot.poll_review_assistant() + except Exception as exc: + self.target_queue.put(("log", f"[助理审核] 核验暂不可用({type(exc).__name__}),保留审核任务")) if bot.security_verification_required: if not self._visual_verification_complete(bot, bot_module): continue @@ -845,6 +876,11 @@ except Exception: pass self._engine_b = None + if bot is not None: + try: + bot.close_review_assistant() + except Exception: + pass if self._db_source is not None: try: self._db_source.close() @@ -927,6 +963,12 @@ except Exception: pass self._engine_b = None + active_bot = getattr(self, "bot", None) + if active_bot is not None: + try: + active_bot.close_review_assistant() + except Exception: + pass if self._db_source is not None: try: self._db_source.close()