fix: Edge format normalization and nullable workflow_id
Fixes: 1. Edge Format Mismatch: - graph_data uses React Flow format (source/target) - WorkflowEdge expects backend format (from/to) - Added normalization in parse_workflow_graph() 2. UUID Validation Error: - workflow_id can be None when using graph_data (Phase 5) - save_execution_state now accepts Optional[str] - ExecutionResult uses "N/A" placeholder when None Changes: - workflow_engine.py: normalize edges before Pydantic validation - workflow_executor.py: Optional[str] for workflow_id parameter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe28cce921
commit
c95b4e185d
2 files changed
+20
-4
No files matched your search
@@ -201,7 +201,7 @@ async def execute_workflow(
|
||||
completed_at = datetime.utcnow().isoformat()
|
||||
save_execution_state(
|
||||
execution_id=execution_id,
|
||||
workflow_id=workflow_id or "", # Empty string if None (when graph_data is used)
|
||||
workflow_id=workflow_id, # Can be None when graph_data is used
|
||||
profile_id=profile_id,
|
||||
node_states=node_states if 'node_states' in locals() else [],
|
||||
status="failed",
|
||||
@@ -212,7 +212,7 @@ async def execute_workflow(
|
||||
|
||||
return ExecutionResult(
|
||||
execution_id=execution_id,
|
||||
workflow_id=workflow_id or "", # Empty string if None (when graph_data is used)
|
||||
workflow_id=workflow_id or "N/A", # ExecutionResult requires string, use placeholder
|
||||
status="failed",
|
||||
node_states=node_states if 'node_states' in locals() else [],
|
||||
aggregated_result={},
|
||||
@@ -840,7 +840,7 @@ def aggregate_results(node_states: List[NodeExecutionState]) -> Dict[str, Any]:
|
||||
|
||||
def save_execution_state(
|
||||
execution_id: str,
|
||||
workflow_id: str,
|
||||
workflow_id: Optional[str], # None when using graph_data directly (Phase 5)
|
||||
profile_id: str,
|
||||
node_states: List[NodeExecutionState],
|
||||
status: str,
|
||||
@@ -853,7 +853,7 @@ def save_execution_state(
|
||||
|
||||
Args:
|
||||
execution_id: UUID der Execution
|
||||
workflow_id: UUID des Workflows
|
||||
workflow_id: UUID des Workflows (None wenn graph_data direkt verwendet wird)
|
||||
profile_id: UUID des Profils
|
||||
node_states: Liste aller NodeExecutionState
|
||||
status: 'completed' | 'failed' | 'partial'
|
||||
|
||||
Reference in new issue
Block a user