diff --git a/apps/webapp/app/services/runs/performRunExecutionV3.server.ts b/apps/webapp/app/services/runs/performRunExecutionV3.server.ts index 29e4253ec0..ad1c282174 100644 --- a/apps/webapp/app/services/runs/performRunExecutionV3.server.ts +++ b/apps/webapp/app/services/runs/performRunExecutionV3.server.ts @@ -207,6 +207,19 @@ export class PerformRunExecutionV3Service { forceYieldCoordinator.deregisterRun(run.id); + //if the run has been canceled while it's being executed, we shouldn't do anything more + const updatedRun = await this.#prismaClient.jobRun.findUnique({ + select: { + status: true, + }, + where: { + id: run.id, + }, + }); + if (!updatedRun || updatedRun.status === "CANCELED") { + return; + } + if (!response) { return await this.#failRunExecutionWithRetry( run,