@@ -38,6 +38,7 @@ import {
3838 terminalExecutionLogFields ,
3939} from '@/lib/logs/execution/cancellation'
4040import { LoggingSession } from '@/lib/logs/execution/logging-session'
41+ import type { PersistedWorkflowExecutionStatus } from '@/lib/logs/types'
4142import { cleanupExecutionBase64Cache } from '@/lib/uploads/utils/user-file-base64.server'
4243import { executeWorkflowCore } from '@/lib/workflows/executor/execution-core'
4344import {
@@ -88,8 +89,19 @@ const execDb = dbFor('exec')
8889const logger = createLogger ( 'HumanInTheLoopManager' )
8990const RUN_BUFFER_UNAVAILABLE_ERROR = 'Run buffer temporarily unavailable'
9091const 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+ }
93105const CANCELLABLE_PAUSED_STATUSES = [ 'paused' , 'partially_resumed' ] as const
94106const AUTOMATIC_RESUME_INTERVENTION_PREFIX = 'Automatic resume requires manual intervention: '
95107const 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