@@ -375,21 +375,30 @@ async function rollbackPausedCancellationAfterAbort(args: {
375375} ) : Promise < boolean > {
376376 if ( ! args . abortSignal ?. aborted ) return false
377377
378- if ( args . stage . kind === 'active_resume' ) {
379- const rolledBack = await PauseResumeManager . rollbackActiveResumeCancellation (
380- args . executionId ,
381- args . workflowId ,
382- args . stage . target . resumeEntryId
383- )
384- if ( ! rolledBack ) {
385- logger . warn ( 'Aborted cancellation could not be rolled back; completing cancellation' , {
386- executionId : args . executionId ,
387- activeResumeEntryId : args . stage . target . resumeEntryId ,
388- } )
389- return false
378+ try {
379+ if ( args . stage . kind === 'active_resume' ) {
380+ const rolledBack = await PauseResumeManager . rollbackActiveResumeCancellation (
381+ args . executionId ,
382+ args . workflowId ,
383+ args . stage . target . resumeEntryId
384+ )
385+ if ( ! rolledBack ) {
386+ logger . warn ( 'Aborted cancellation could not be rolled back; completing cancellation' , {
387+ executionId : args . executionId ,
388+ activeResumeEntryId : args . stage . target . resumeEntryId ,
389+ } )
390+ return false
391+ }
392+ } else if ( args . stage . kind === 'idle' ) {
393+ await PauseResumeManager . clearPausedCancellationIntent ( args . executionId , args . workflowId )
390394 }
391- } else if ( args . stage . kind === 'idle' ) {
392- await PauseResumeManager . clearPausedCancellationIntent ( args . executionId , args . workflowId )
395+ } catch ( error ) {
396+ logger . warn ( 'Failed to roll back aborted cancellation; completing cancellation' , {
397+ executionId : args . executionId ,
398+ stageKind : args . stage . kind ,
399+ error : toError ( error ) . message ,
400+ } )
401+ return false
393402 }
394403
395404 return true
0 commit comments