@@ -1150,7 +1150,8 @@ private void processStartChildWorkflow(
11501150 long workflowTaskCompletedId ) {
11511151 a = validateStartChildExecutionAttributes (a );
11521152 StateMachine <ChildWorkflowData > child =
1153- StateMachines .newChildWorkflowStateMachine (service , metadata );
1153+ StateMachines .newChildWorkflowStateMachine (
1154+ service , a .getWorkflowId (), a .getWorkflowType ().getName (), metadata );
11541155 childWorkflows .put (ctx .getNextEventId (), child );
11551156 child .action (StateMachines .Action .INITIATE , ctx , a , workflowTaskCompletedId );
11561157 ctx .lockTimer ("processStartChildWorkflow" );
@@ -3253,13 +3254,20 @@ private DescribeWorkflowExecutionResponse describeWorkflowExecutionInsideLock()
32533254 private static PendingChildExecutionInfo constructPendingChildExecutionInfo (
32543255 StateMachine <ChildWorkflowData > sm ) {
32553256 ChildWorkflowData data = sm .getData ();
3256- return PendingChildExecutionInfo .newBuilder ()
3257- .setWorkflowId (data .execution .getWorkflowId ())
3258- .setRunId (data .execution .getRunId ())
3259- .setWorkflowTypeName (data .initiatedEvent .getWorkflowType ().getName ())
3260- .setInitiatedId (data .initiatedEventId )
3261- .setParentClosePolicy (data .initiatedEvent .getParentClosePolicy ())
3262- .build ();
3257+ PendingChildExecutionInfo .Builder builder =
3258+ PendingChildExecutionInfo .newBuilder ()
3259+ .setWorkflowId (data .workflowId )
3260+ .setWorkflowTypeName (data .workflowType );
3261+ // These fields may not be set if the child workflow hasn't been started yet
3262+ if (data .execution != null ) {
3263+ builder .setRunId (data .execution .getRunId ());
3264+ }
3265+ if (data .initiatedEvent != null ) {
3266+ builder
3267+ .setInitiatedId (data .initiatedEventId )
3268+ .setParentClosePolicy (data .initiatedEvent .getParentClosePolicy ());
3269+ }
3270+ return builder .build ();
32633271 }
32643272
32653273 private static PendingActivityInfo constructPendingActivityInfo (
0 commit comments