Skip to content

Commit d362cc2

Browse files
committed
fix(tables): type the terminal execution log statuses against the persisted vocabulary
1 parent e19a8ab commit d362cc2

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎apps/sim/lib/workflows/executor/human-in-the-loop-manager.ts‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
terminalExecutionLogFields,
3939
} from '@/lib/logs/execution/cancellation'
4040
import { LoggingSession } from '@/lib/logs/execution/logging-session'
41+
import type { PersistedWorkflowExecutionStatus } from '@/lib/logs/types'
4142
import { cleanupExecutionBase64Cache } from '@/lib/uploads/utils/user-file-base64.server'
4243
import { executeWorkflowCore } from '@/lib/workflows/executor/execution-core'
4344
import {
@@ -88,8 +89,19 @@ const execDb = dbFor('exec')
8889
const logger = createLogger('HumanInTheLoopManager')
8990
const RUN_BUFFER_UNAVAILABLE_ERROR = 'Run buffer temporarily unavailable'
9091
const RESUMABLE_PAUSED_STATUSES = ['paused', 'partially_resumed'] as const
91-
/** Statuses of a finished execution's log; a resume can never claim a log in one of them. */
92-
const TERMINAL_EXECUTION_LOG_STATUSES: readonly string[] = ['cancelled', 'failed', 'completed']
92+
/**
93+
* Statuses of a finished execution's log, the same set the attempt-failure
94+
* `CASE` preserves; a resume can never claim a log in one of them.
95+
*/
96+
const TERMINAL_EXECUTION_LOG_STATUSES = [
97+
'cancelled',
98+
'failed',
99+
'completed',
100+
] as const satisfies readonly PersistedWorkflowExecutionStatus[]
101+
102+
function isTerminalExecutionLogStatus(status: string): boolean {
103+
return (TERMINAL_EXECUTION_LOG_STATUSES as readonly string[]).includes(status)
104+
}
93105
const CANCELLABLE_PAUSED_STATUSES = ['paused', 'partially_resumed'] as const
94106
const AUTOMATIC_RESUME_INTERVENTION_PREFIX = 'Automatic resume requires manual intervention: '
95107
const PAUSED_CANCELLATION_QUEUE_FAILURE_REASON = 'Paused execution cancellation requested'
@@ -2405,7 +2417,7 @@ export class PauseResumeManager {
24052417
pausedExecution !== undefined &&
24062418
isResumablePausedStatus(pausedExecution.status) &&
24072419
executionLog !== undefined &&
2408-
!TERMINAL_EXECUTION_LOG_STATUSES.includes(executionLog.status)
2420+
!isTerminalExecutionLogStatus(executionLog.status)
24092421
)
24102422
})
24112423
}

0 commit comments

Comments
 (0)