public run endpoint with error code (#3512)

This commit is contained in:
LawyZheng
2025-09-24 14:49:20 +08:00
committed by GitHub
parent ad731f6175
commit b2848ceaf2
5 changed files with 8 additions and 0 deletions

View File

@@ -1592,6 +1592,7 @@ class WorkflowService:
totp_url=workflow_run.totp_verification_url or None,
totp_identifier=workflow_run.totp_identifier,
),
errors=workflow_run_status_response.errors,
)
payload_dict = json.loads(workflow_run_status_response.model_dump_json())
workflow_run_response_dict = json.loads(workflow_run_response.model_dump_json())

View File

@@ -427,6 +427,10 @@ class BaseRunResponse(BaseModel):
default=None,
description="The script run result",
)
errors: list[dict[str, Any]] | None = Field(
default=None,
description="The errors for the run",
)
class TaskRunResponse(BaseRunResponse):

View File

@@ -69,6 +69,7 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
error_code_mapping=task_v1_response.request.error_code_mapping,
max_screenshot_scrolls=task_v1_response.request.max_screenshot_scrolls,
),
errors=task_v1_response.errors,
)
elif run.task_run_type == RunType.task_v2:
task_v2 = await app.DATABASE.get_task_v2(run.run_id, organization_id=organization_id)

View File

@@ -1711,6 +1711,7 @@ async def build_task_v2_run_response(task_v2: TaskV2) -> TaskRunResponse:
data_extraction_schema=task_v2.extracted_information_schema,
error_code_mapping=task_v2.error_code_mapping,
),
errors=workflow_run_resp.errors if workflow_run_resp else None,
)

View File

@@ -138,4 +138,5 @@ async def get_workflow_run_response(
browser_address=workflow_run.browser_address,
# TODO: add browser session id
),
errors=workflow_run_resp.errors,
)