diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index f23c2bdccc1..cab0e2bc578 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -2149,6 +2149,9 @@ func (e *historyEngineImpl) RecordChildExecutionCompleted( if !isRunning || ci.StartedId == common.EmptyEventID { return serviceerror.NewNotFound("Pending child execution not found.") } + if ci.GetStartedWorkflowId() != completedExecution.GetWorkflowId() { + return serviceerror.NewNotFound("Pending child execution not found.") + } switch completionEvent.GetEventType() { case enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED: