diff --git a/src/daemon/dispatcher.py b/src/daemon/dispatcher.py index 44434f2..75d879d 100644 --- a/src/daemon/dispatcher.py +++ b/src/daemon/dispatcher.py @@ -182,15 +182,21 @@ class Dispatcher: } try: - # [v2.7.1] Mail: spawn 前系统标 working + # [v2.7.1] Mail: 标 working 移到 spawn_full_agent 内部(check 通过后、subprocess 前) is_mail = project_config.get("project_id") == "_mail" if project_config else False if is_mail: db_path = Path(project_config["db_path"]) if project_config and "db_path" in project_config else None - if not db_path or not self._mail_auto_working(task.id, db_path): - self._record_routing(task, decision, "error", "mail working failed", _routing_db) - return {"level": level.value, "agent_id": agent_id, - "session_id": None, "status": "error", - "reason": "mail_auto_working_failed"} + + # on_checks_passed: 所有检查通过后才标 working,检查失败不标 + on_checks_passed = None + if is_mail and db_path: + _task_id = task.id + _mail_db = db_path + _disp = self + def _mail_on_checks_passed(): + if not _disp._mail_auto_working(_task_id, _mail_db): + raise RuntimeError("mail_auto_working_failed") + on_checks_passed = _mail_on_checks_passed # 构建 spawn message message = self._build_spawn_message(task, agent_id, project_config,