Skip to content

Automate browser based workflows with AI

fix missing recording for task v2 block (#3304)

LawyZhengdd21c3a707ab
diff --git a/skyvern/forge/sdk/db/client.py b/skyvern/forge/sdk/db/client.py
index a8df2b185..425ebc7b0 100644
--- a/skyvern/forge/sdk/db/client.py
+++ b/skyvern/forge/sdk/db/client.py
@@ -1245,9 +1245,9 @@ class AgentDB:
LOG.error("UnexpectedError", exc_info=True)
raise
- async def get_artifact_for_workflow_run(
+ async def get_artifact_for_run(
self,
- workflow_run_id: str,
+ run_id: str,
artifact_type: ArtifactType,
organization_id: str | None = None,
) -> Artifact | None:
@@ -1256,8 +1256,7 @@ class AgentDB:
artifact = (
await session.scalars(
select(ArtifactModel)
- .join(TaskModel, TaskModel.task_id == ArtifactModel.task_id)
- .filter(TaskModel.workflow_run_id == workflow_run_id)
+ .filter(ArtifactModel.run_id == run_id)
.filter(ArtifactModel.artifact_type == artifact_type)
.filter(ArtifactModel.organization_id == organization_id)
.order_by(ArtifactModel.created_at.desc())
diff --git a/skyvern/forge/sdk/routes/scripts.py b/skyvern/forge/sdk/routes/scripts.py
index 5de010c36..c782a3e0d 100644
--- a/skyvern/forge/sdk/routes/scripts.py
+++ b/skyvern/forge/sdk/routes/scripts.py
@@ -170,7 +170,6 @@ async def deploy_script(
script_id=script_id,
file_count=len(data.files) if data.files else 0,
)
- raise HTTPException(status_code=400, detail="Not implemented")
try:
# Get the latest version of the script
@@ -259,7 +258,6 @@ async def run_script(
current_org: Organization = Depends(org_auth_service.get_current_org),
) -> None:
"""Run a script."""
- raise HTTPException(status_code=400, detail="Not implemented")
# await script_service.execute_script(
# script_id=script_id,
# organization_id=current_org.organization_id,
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index 3dc36cec1..9b2426edf 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -1197,8 +1197,8 @@ class WorkflowService:
screenshot_urls = await app.ARTIFACT_MANAGER.get_share_links(screenshot_artifacts)
recording_url = None
- recording_artifact = await app.DATABASE.get_artifact_for_workflow_run(
- workflow_run_id=workflow_run_id,
+ recording_artifact = await app.DATABASE.get_artifact_for_run(
+ run_id=task_v2.observer_cruise_id if task_v2 else workflow_run_id,
artifact_type=ArtifactType.RECORDING,
organization_id=organization_id,
)