diff --git a/service/frontend/workflowHandler.go b/service/frontend/workflowHandler.go index 3ff013e03f9..a34fee70e3a 100644 --- a/service/frontend/workflowHandler.go +++ b/service/frontend/workflowHandler.go @@ -959,6 +959,10 @@ func (wh *WorkflowHandler) RespondWorkflowTaskCompleted( return nil, errRequestNotSet } + if len(request.GetIdentity()) > wh.config.MaxIDLengthLimit() { + return nil, errIdentityTooLong + } + taskToken, err := wh.tokenSerializer.Deserialize(request.TaskToken) if err != nil { return nil, err @@ -973,10 +977,6 @@ func (wh *WorkflowHandler) RespondWorkflowTaskCompleted( return nil, err } - if len(request.GetIdentity()) > wh.config.MaxIDLengthLimit() { - return nil, errIdentityTooLong - } - completedResp := &workflowservice.RespondWorkflowTaskCompletedResponse{} if request.GetReturnNewWorkflowTask() && histResp != nil && histResp.StartedResponse != nil { taskToken := &tokenspb.Task{ diff --git a/service/history/workflow/mutable_state_impl.go b/service/history/workflow/mutable_state_impl.go index 6b96eac4206..a641362b969 100644 --- a/service/history/workflow/mutable_state_impl.go +++ b/service/history/workflow/mutable_state_impl.go @@ -3236,7 +3236,15 @@ func (e *MutableStateImpl) ReplicateChildWorkflowExecutionStartedEvent( attributes := event.GetChildWorkflowExecutionStartedEventAttributes() initiatedID := attributes.GetInitiatedEventId() - ci, _ := e.GetChildExecutionInfo(initiatedID) + ci, ok := e.GetChildExecutionInfo(initiatedID) + if !ok { + e.logError( + fmt.Sprintf("unable to find child workflow event ID: %v in mutable state", initiatedID), + tag.ErrorTypeInvalidMutableStateAction, + ) + return ErrMissingChildWorkflowInfo + } + ci.StartedId = event.GetEventId() ci.StartedRunId = attributes.GetWorkflowExecution().GetRunId() e.updateChildExecutionInfos[ci.InitiatedId] = ci