principal := headers.GetPrincipal(ctx)
for _, we := range workflowEventsSeq {
// Skip events that already have a principal. Those are previously
// buffered events (e.g., signals) that were stamped when originally
// created and are now being flushed into history by a different caller
// (e.g., the worker completing a workflow task).
if event.Principal == nil {
event.Principal = principal
}
}
}