From d3c28a6ee929f7f73fcae860334a2fd5360ce9f8 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 13 Apr 2026 13:05:11 +0200 Subject: [PATCH] fix: Include node_states in SSE execution_complete and execution_failed events - Serialize NodeExecutionState models to dict for JSON transmission - Add node_states to execution_complete event for debug panel - Add node_states to execution_failed event for partial progress visibility - Enables WorkflowDebugPanel to display per-node debug information Fixes: WorkflowDebugPanel not appearing due to missing node_states in SSE stream --- backend/workflow_executor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index 809b40a..1833e9f 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -216,6 +216,7 @@ async def execute_workflow( "execution_id": execution_id, "status": "completed", "aggregated_result": aggregated, + "node_states": [ns.model_dump() for ns in node_states], # Serialize Pydantic models "total_nodes": len(node_states), "completed_nodes": len([ns for ns in node_states if ns.status == NodeStatus.EXECUTED]), "skipped_nodes": len([ns for ns in node_states if ns.status == NodeStatus.SKIPPED]), @@ -238,12 +239,16 @@ async def execute_workflow( # NEW: Progress-Callback für Fehler if progress_callback: - await progress_callback("execution_failed", { + error_data = { "execution_id": execution_id, "status": "failed", "error": str(e), "completed_at": datetime.utcnow().isoformat() - }) + } + # Include node_states if available (to show partial progress) + if 'node_states' in locals() and node_states: + error_data["node_states"] = [ns.model_dump() for ns in node_states] + await progress_callback("execution_failed", error_data) # Speichere Failed State completed_at = datetime.utcnow().isoformat()