@@ -17,7 +17,8 @@ import {
1717 loadWorkflowFromNormalizedTables ,
1818} from '@/lib/workflows/persistence/utils'
1919import { getWorkflowById } from '@/lib/workflows/utils'
20- import { type ExecutionMetadata , ExecutionSnapshot } from '@/executor/execution/snapshot'
20+ import { ExecutionSnapshot } from '@/executor/execution/snapshot'
21+ import type { ExecutionMetadata } from '@/executor/execution/types'
2122import type { ExecutionResult } from '@/executor/types'
2223import { Serializer } from '@/serializer'
2324import { mergeSubblockState } from '@/stores/workflows/server-utils'
@@ -268,14 +269,25 @@ async function executeWebhookJobInternal(
268269 logger . error ( `[${ requestId } ] Missing snapshot seed for paused execution` , {
269270 executionId,
270271 } )
272+ await loggingSession . markAsFailed ( 'Missing snapshot seed for paused execution' )
271273 } else {
272- await PauseResumeManager . persistPauseResult ( {
273- workflowId : payload . workflowId ,
274- executionId,
275- pausePoints : executionResult . pausePoints || [ ] ,
276- snapshotSeed : executionResult . snapshotSeed ,
277- executorUserId : executionResult . metadata ?. userId ,
278- } )
274+ try {
275+ await PauseResumeManager . persistPauseResult ( {
276+ workflowId : payload . workflowId ,
277+ executionId,
278+ pausePoints : executionResult . pausePoints || [ ] ,
279+ snapshotSeed : executionResult . snapshotSeed ,
280+ executorUserId : executionResult . metadata ?. userId ,
281+ } )
282+ } catch ( pauseError ) {
283+ logger . error ( `[${ requestId } ] Failed to persist pause result` , {
284+ executionId,
285+ error : pauseError instanceof Error ? pauseError . message : String ( pauseError ) ,
286+ } )
287+ await loggingSession . markAsFailed (
288+ `Failed to persist pause state: ${ pauseError instanceof Error ? pauseError . message : String ( pauseError ) } `
289+ )
290+ }
279291 }
280292 } else {
281293 await PauseResumeManager . processQueuedResumes ( executionId )
@@ -509,14 +521,25 @@ async function executeWebhookJobInternal(
509521 logger . error ( `[${ requestId } ] Missing snapshot seed for paused execution` , {
510522 executionId,
511523 } )
524+ await loggingSession . markAsFailed ( 'Missing snapshot seed for paused execution' )
512525 } else {
513- await PauseResumeManager . persistPauseResult ( {
514- workflowId : payload . workflowId ,
515- executionId,
516- pausePoints : executionResult . pausePoints || [ ] ,
517- snapshotSeed : executionResult . snapshotSeed ,
518- executorUserId : executionResult . metadata ?. userId ,
519- } )
526+ try {
527+ await PauseResumeManager . persistPauseResult ( {
528+ workflowId : payload . workflowId ,
529+ executionId,
530+ pausePoints : executionResult . pausePoints || [ ] ,
531+ snapshotSeed : executionResult . snapshotSeed ,
532+ executorUserId : executionResult . metadata ?. userId ,
533+ } )
534+ } catch ( pauseError ) {
535+ logger . error ( `[${ requestId } ] Failed to persist pause result` , {
536+ executionId,
537+ error : pauseError instanceof Error ? pauseError . message : String ( pauseError ) ,
538+ } )
539+ await loggingSession . markAsFailed (
540+ `Failed to persist pause state: ${ pauseError instanceof Error ? pauseError . message : String ( pauseError ) } `
541+ )
542+ }
520543 }
521544 } else {
522545 await PauseResumeManager . processQueuedResumes ( executionId )
0 commit comments