When workflow is completed, mark as failed steps still running (#15030)

As title.
This commit is contained in:
Thomas Trompette
2025-10-10 17:44:12 +02:00
committed by GitHub
parent 938debd83e
commit d4b81dd20f
@@ -198,11 +198,40 @@ export class WorkflowRunWorkspaceService {
workspaceId,
});
const updatedStepInfos = Object.entries(
workflowRunToUpdate.state?.stepInfos ?? {},
)
.map(([stepId, step]) => {
if (
step.status === StepStatus.RUNNING ||
step.status === StepStatus.PENDING
) {
return {
[stepId]: {
...step,
status: StepStatus.FAILED,
error: 'Workflow has been ended before this step was completed',
},
};
}
return {
[stepId]: step,
};
})
.reduce((acc, current) => {
return {
...acc,
...current,
};
}, {});
const partialUpdate = {
status,
endedAt: new Date().toISOString(),
state: {
...workflowRunToUpdate.state,
stepInfos: updatedStepInfos,
workflowRunError: error,
},
};