Skip to content

Commit 1f7c652

Browse files
committed
fix(logging): scope completeWithCancellation and completeWithPause reads by workflowId
Both SELECT queries that check execution status before writing a terminal result were only filtering on executionId. Adds workflowId to the WHERE clause so all seven reads and writes in LoggingSession consistently scope by (workflowId, executionId).
1 parent 102cf76 commit 1f7c652

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

apps/sim/lib/logs/execution/logging-session.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,12 @@ export class LoggingSession {
671671
const currentLog = await db
672672
.select({ status: workflowExecutionLogs.status })
673673
.from(workflowExecutionLogs)
674-
.where(eq(workflowExecutionLogs.executionId, this.executionId))
674+
.where(
675+
and(
676+
eq(workflowExecutionLogs.workflowId, this.workflowId),
677+
eq(workflowExecutionLogs.executionId, this.executionId)
678+
)
679+
)
675680
.limit(1)
676681
.then((rows) => rows[0])
677682

@@ -770,7 +775,12 @@ export class LoggingSession {
770775
const currentLog = await db
771776
.select({ status: workflowExecutionLogs.status })
772777
.from(workflowExecutionLogs)
773-
.where(eq(workflowExecutionLogs.executionId, this.executionId))
778+
.where(
779+
and(
780+
eq(workflowExecutionLogs.workflowId, this.workflowId),
781+
eq(workflowExecutionLogs.executionId, this.executionId)
782+
)
783+
)
774784
.limit(1)
775785
.then((rows) => rows[0])
776786

0 commit comments

Comments
 (0)