debug: add logging to move endpoint to trace execution creation

This commit is contained in:
Gan, Jimmy
2026-04-02 10:33:48 +08:00
parent f275e52843
commit 9fcbeca264
+6 -1
View File
@@ -211,6 +211,7 @@ async def move_task(
# Handle automatic time tracking # Handle automatic time tracking
if old_status != "in_progress" and move.status == "in_progress": 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( await opc_db.start_time_entry(
task_id=task_id, task_id=task_id,
project_id=current_task.get("project_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 # Auto-assign to default agent (PM) if not already assigned
if not current_task.get("assigned_to"): 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_to"] = "pm"
updates["assigned_type"] = "agent" updates["assigned_type"] = "agent"
# Create agent execution record # Create agent execution record
await opc_db.create_agent_execution( execution_id = await opc_db.create_agent_execution(
task_id=task_id, task_id=task_id,
agent_id="pm", agent_id="pm",
actor=user.username 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": if old_status == "in_progress" and move.status != "in_progress":
await opc_db.stop_time_entry(task_id=task_id) await opc_db.stop_time_entry(task_id=task_id)