From e326f8d31132761bce727ad4fb5394bb8e4d36b5 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Mon, 10 Aug 2026 17:36:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=AE=8C=E5=B7=A5/=E7=BB=93=E6=9D=9F=20500=20+=20=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E5=9F=BA=E5=9B=A0=E7=BB=A7=E6=89=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 task.child_tasks 的 ORM 属性直接赋值(导致 SQLAlchemy 状态机崩溃) - complete_task 创建 next_task 时补上 task_type=task.task_type 基因继承 --- backend/app/services/task_service.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/app/services/task_service.py b/backend/app/services/task_service.py index 962cdcb..34947da 100644 --- a/backend/app/services/task_service.py +++ b/backend/app/services/task_service.py @@ -872,12 +872,6 @@ async def complete_task( """ task = await _get_task_or_404(db, task_id) - # 注入子任务数据到当前对象以便后续检查 - children_result = await db.execute( - select(Task).where(Task.parent_task_id == task_id) - ) - task.child_tasks = children_result.scalars().all() - # --- 1. 幂等检查 --- if task.status == TASK_STATUS_COMPLETED: raise HTTPException( @@ -914,6 +908,7 @@ async def complete_task( task_name=request.next_task_name, assignee_id=request.next_assignee_id, status=TASK_STATUS_PENDING, + task_type=task.task_type, # 🚀 继承父任务基因:主线→主线,协助→协助 notify_parent_on_complete=False, ) db.add(next_task)