diff --git a/dashboard/backend/routers/opc_tasks.py b/dashboard/backend/routers/opc_tasks.py index 2eba819..6dbb5a5 100644 --- a/dashboard/backend/routers/opc_tasks.py +++ b/dashboard/backend/routers/opc_tasks.py @@ -211,6 +211,7 @@ async def move_task( # Handle automatic time tracking if old_status != "in_progress" and move.status == "in_progress": + print(f"[Move] Task {task_id} moving to in_progress, old_status={old_status}") await opc_db.start_time_entry( task_id=task_id, project_id=current_task.get("project_id"), @@ -219,14 +220,18 @@ async def move_task( # Auto-assign to default agent (PM) if not already assigned if not current_task.get("assigned_to"): + print(f"[Move] Task {task_id} not assigned, auto-assigning to PM agent") updates["assigned_to"] = "pm" updates["assigned_type"] = "agent" # Create agent execution record - await opc_db.create_agent_execution( + execution_id = await opc_db.create_agent_execution( task_id=task_id, agent_id="pm", actor=user.username ) + print(f"[Move] Created agent execution {execution_id} for task {task_id}") + else: + print(f"[Move] Task {task_id} already assigned to {current_task.get('assigned_to')}") if old_status == "in_progress" and move.status != "in_progress": await opc_db.stop_time_entry(task_id=task_id)