handle unexpected llm error in task v2 runner and clean up browser (#2100)

This commit is contained in:
Shuchang Zheng
2025-04-03 21:51:38 -04:00
committed by GitHub
parent b0b4862c2a
commit 93371cd0cd

View File

@@ -278,6 +278,12 @@ async def run_task_v2(
organization_id=organization_id,
)
finally:
if task_v2.workflow_id and not workflow:
workflow = await app.WORKFLOW_SERVICE.get_workflow(task_v2.workflow_id, organization_id=organization_id)
if task_v2.workflow_run_id and not workflow_run:
workflow_run = await app.WORKFLOW_SERVICE.get_workflow_run(
task_v2.workflow_run_id, organization_id=organization_id
)
if workflow and workflow_run and workflow_run.parent_workflow_run_id is None:
await app.WORKFLOW_SERVICE.clean_up_workflow(
workflow=workflow,