Skip to content

Commit aa5b26e

Browse files
committed
Update chat_service.py
1 parent be79ee2 commit aa5b26e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

backend/app/service/chat_service.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,18 +474,22 @@ async def run_decomposition():
474474
if stream_state["subtasks"]:
475475
sub_tasks = stream_state["subtasks"]
476476
state_holder["sub_tasks"] = sub_tasks
477+
logger.info(f"[NEW-QUESTION] ✅ Task decomposed into {len(sub_tasks)} subtasks")
477478
try:
478479
setattr(task_lock, "decompose_sub_tasks", sub_tasks)
479480
except Exception:
480481
pass
481482

483+
logger.info(f"[NEW-QUESTION] Generating task summary")
482484
summary_task_agent = task_summary_agent(options)
483485
try:
484486
summary_task_content = await asyncio.wait_for(
485487
summary_task(summary_task_agent, camel_task), timeout=10
486488
)
487489
task_lock.summary_generated = True
490+
logger.info("[NEW-QUESTION] ✅ Summary generated successfully", extra={"project_id": options.project_id})
488491
except asyncio.TimeoutError:
492+
logger.warning("summary_task timeout", extra={"project_id": options.project_id, "task_id": options.task_id})
489493
task_lock.summary_generated = True
490494
fallback_name = "Task"
491495
content_preview = camel_task.content if hasattr(camel_task, "content") else ""
@@ -511,6 +515,8 @@ async def run_decomposition():
511515
setattr(task_lock, "summary_task_content", summary_task_content)
512516
except Exception:
513517
pass
518+
logger.info(f"[NEW-QUESTION] 📤 Sending to_sub_tasks SSE to frontend (task card)")
519+
logger.info(f"[NEW-QUESTION] to_sub_tasks data: task_id={camel_task.id}, summary={summary_task_content[:50]}..., subtasks_count={len(camel_task.subtasks)}")
514520
payload = {
515521
"project_id": options.project_id,
516522
"task_id": options.task_id,
@@ -520,6 +526,7 @@ async def run_decomposition():
520526
"summary_task": summary_task_content,
521527
}
522528
await task_lock.put_queue(ActionDecomposeProgressData(data=payload))
529+
logger.info(f"[NEW-QUESTION] ✅ to_sub_tasks SSE sent")
523530
except Exception as e:
524531
logger.error(f"Error in background decomposition: {e}", exc_info=True)
525532

0 commit comments

Comments
 (0)