Skip to content

Automate browser based workflows with AI

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

Shuchang Zheng93371cd0cd24
diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py
index 2c1c808d6..5090e7c25 100644
--- a/skyvern/services/task_v2_service.py
+++ b/skyvern/services/task_v2_service.py
@@ -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,