@@ -768,6 +768,35 @@ async function handleBlockOperationTx(
768768 break
769769 }
770770
771+ case BLOCK_OPERATIONS . UPDATE_RETRY : {
772+ if ( ! payload . id || payload . retry === undefined ) {
773+ throw new Error ( 'Missing required fields for update retry operation' )
774+ }
775+
776+ const updateResult = await tx
777+ . update ( workflowBlocks )
778+ . set ( {
779+ /**
780+ * Persisted verbatim, including a disabled policy, so the numbers a
781+ * builder configured survive switching retry off and back on. NULL stays
782+ * reserved for a block that never had a policy at all; whether a stored
783+ * policy actually runs is decided by `resolveBlockRetryConfig` at
784+ * execution time, never by the column being present.
785+ */
786+ retry : payload . retry ,
787+ updatedAt : new Date ( ) ,
788+ } )
789+ . where ( and ( eq ( workflowBlocks . id , payload . id ) , eq ( workflowBlocks . workflowId , workflowId ) ) )
790+ . returning ( { id : workflowBlocks . id } )
791+
792+ if ( updateResult . length === 0 ) {
793+ throw new Error ( `Block ${ payload . id } not found in workflow ${ workflowId } ` )
794+ }
795+
796+ logger . debug ( `Updated block retry: ${ payload . id } -> ${ payload . retry . enabled } ` )
797+ break
798+ }
799+
771800 case BLOCK_OPERATIONS . UPDATE_CANONICAL_MODE : {
772801 if ( ! payload . id || ! payload . canonicalId || ! payload . canonicalMode ) {
773802 throw new Error ( 'Missing required fields for update canonical mode operation' )
@@ -962,6 +991,7 @@ async function handleBlocksOperationTx(
962991 advancedMode : ( block . advancedMode as boolean ) ?? false ,
963992 triggerMode : ( block . triggerMode as boolean ) ?? false ,
964993 errorEnabled : ( block . errorEnabled as boolean ) ?? false ,
994+ retry : ( block . retry as Record < string , unknown > | undefined ) ?? null ,
965995 height : ( block . height as number ) || 0 ,
966996 locked : ( block . locked as boolean ) ?? false ,
967997 }
@@ -981,6 +1011,7 @@ async function handleBlocksOperationTx(
9811011 horizontalHandles : sql `excluded.horizontal_handles` ,
9821012 advancedMode : sql `excluded.advanced_mode` ,
9831013 triggerMode : sql `excluded.trigger_mode` ,
1014+ retry : sql `excluded.retry` ,
9841015 locked : sql `excluded.locked` ,
9851016 height : sql `excluded.height` ,
9861017 subBlocks : sql `excluded.sub_blocks` ,
@@ -2172,6 +2203,7 @@ async function handleWorkflowOperationTx(
21722203 positionX : block . position . x ,
21732204 positionY : block . position . y ,
21742205 errorEnabled : block . errorEnabled ?? false ,
2206+ retry : block . retry ?? null ,
21752207 data : block . data || { } ,
21762208 subBlocks : block . subBlocks || { } ,
21772209 outputs : block . outputs || { } ,
0 commit comments