append complete action (for validation) to the end of every task block (#3726)

This commit is contained in:
Shuchang Zheng
2025-10-15 17:12:51 -07:00
committed by GitHub
parent c78b80ab89
commit cfaef5a8bb
6 changed files with 92 additions and 40 deletions

View File

@@ -807,12 +807,16 @@ async def _fallback_to_ai_run(
# Update block status to completed if workflow block was created
if workflow_run_block_id:
# refresh the task
failure_reason = None
refreshed_task = await app.DATABASE.get_task(task_id=task_id, organization_id=organization_id)
if refreshed_task:
task = refreshed_task
if task.status in [TaskStatus.terminated, TaskStatus.failed]:
failure_reason = task.failure_reason
await _update_workflow_block(
workflow_run_block_id,
BlockStatus(task.status.value),
failure_reason=failure_reason,
label=cache_key,
)