From f27c2cd92d9f9d20ce9ce11c9b172673ef8143ea Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Tue, 3 Jun 2025 02:10:30 -0700 Subject: [PATCH] fix selfhost streaming issue (#2576) Co-authored-by: lawyzheng --- .gitignore | 1 + skyvern/forge/sdk/executor/async_executor.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index be4e4da5..6b5fc49b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ log.txt log-ingestion.txt logs *.log +current.json # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/skyvern/forge/sdk/executor/async_executor.py b/skyvern/forge/sdk/executor/async_executor.py index 2d1b0f30..c466e78d 100644 --- a/skyvern/forge/sdk/executor/async_executor.py +++ b/skyvern/forge/sdk/executor/async_executor.py @@ -13,6 +13,7 @@ from skyvern.forge.sdk.schemas.tasks import TaskStatus from skyvern.forge.sdk.workflow.models.workflow import WorkflowRunStatus from skyvern.schemas.runs import RunEngine, RunType from skyvern.services import task_v2_service +from skyvern.utils.files import initialize_skyvern_state_file LOG = structlog.get_logger() @@ -106,6 +107,7 @@ class BackgroundTaskExecutor(AsyncExecutor): context.max_steps_override = max_steps_override if background_tasks: + await initialize_skyvern_state_file(task_id=task_id, organization_id=organization_id) background_tasks.add_task( app.agent.execute_step, organization, @@ -135,6 +137,9 @@ class BackgroundTaskExecutor(AsyncExecutor): ) if background_tasks: + await initialize_skyvern_state_file( + workflow_run_id=workflow_run_id, organization_id=organization.organization_id + ) background_tasks.add_task( app.WORKFLOW_SERVICE.execute_workflow, workflow_run_id=workflow_run_id, @@ -178,6 +183,9 @@ class BackgroundTaskExecutor(AsyncExecutor): ) if background_tasks: + await initialize_skyvern_state_file( + workflow_run_id=task_v2.workflow_run_id, organization_id=organization_id + ) background_tasks.add_task( task_v2_service.run_task_v2, organization=organization,