From bdeaa7ccea6bdcdddc1a9ebd2105e80b0f0984b4 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Thu, 2 Apr 2026 21:20:10 +0800 Subject: [PATCH] fix: serialize datetime objects before JSON encoding in create_agent_execution --- dashboard/backend/db/opc_db.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dashboard/backend/db/opc_db.py b/dashboard/backend/db/opc_db.py index f74423f..3b0da62 100644 --- a/dashboard/backend/db/opc_db.py +++ b/dashboard/backend/db/opc_db.py @@ -537,8 +537,14 @@ async def create_agent_execution( raise ValueError("Task or agent not found") # Build input context + # Prepare input context with serialized datetimes + task_for_context = dict(task) + for key in ["created_at", "updated_at", "completed_at", "due_date"]: + if task_for_context.get(key): + task_for_context[key] = task_for_context[key].isoformat() if hasattr(task_for_context[key], 'isoformat') else task_for_context[key] + input_context = { - "task": dict(task), + "task": task_for_context, "agent": dict(agent), "timestamp": datetime.utcnow().isoformat() }