(
owner: WorkflowTaskOwner
)
| 1357 | } |
| 1358 | |
| 1359 | private async getInactiveWorkflowTaskOwner( |
| 1360 | owner: WorkflowTaskOwner |
| 1361 | ): Promise<InactiveWorkflowTaskOwner | null> { |
| 1362 | const workflowTask = owner.workflowTask; |
| 1363 | const parentWorkspaceId = coerceNonEmptyString(owner.workspace.parentWorkspaceId); |
| 1364 | if (!parentWorkspaceId) { |
| 1365 | return { |
| 1366 | ownerTaskId: owner.taskId, |
| 1367 | runId: workflowTask.runId, |
| 1368 | reason: "workflow-owned task is missing its parent workspace", |
| 1369 | }; |
| 1370 | } |
| 1371 | |
| 1372 | try { |
| 1373 | const runStore = new WorkflowRunStore({ |
| 1374 | sessionDir: this.config.getSessionDir(parentWorkspaceId), |
| 1375 | }); |
| 1376 | const run = await runStore.getRun(workflowTask.runId); |
| 1377 | if (run.workspaceId !== parentWorkspaceId) { |
| 1378 | return { |
| 1379 | ownerTaskId: owner.taskId, |
| 1380 | runId: workflowTask.runId, |
| 1381 | status: run.status, |
| 1382 | reason: `workflow run belongs to ${run.workspaceId}, not ${parentWorkspaceId}`, |
| 1383 | }; |
| 1384 | } |
| 1385 | if (isActiveWorkflowRunStatus(run.status)) { |
| 1386 | return null; |
| 1387 | } |
| 1388 | return { |
| 1389 | ownerTaskId: owner.taskId, |
| 1390 | runId: workflowTask.runId, |
| 1391 | status: run.status, |
| 1392 | reason: `workflow run is ${run.status}`, |
| 1393 | }; |
| 1394 | } catch (error: unknown) { |
| 1395 | return { |
| 1396 | ownerTaskId: owner.taskId, |
| 1397 | runId: workflowTask.runId, |
| 1398 | reason: `workflow run is unavailable: ${getErrorMessage(error)}`, |
| 1399 | }; |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | private async getInactiveWorkflowTaskOwnerForRecovery( |
| 1404 | taskId: string, |
no test coverage detected