313
baseRebuildLastEventID := baseMutableState.GetLastCompletedWorkflowTaskStartedEventId()
314
if baseRebuildLastEventID == common.EmptyEventID {
316
>
// - real pending workflow task: anchor at its ScheduledEventID. The resetter
317
>
// rebuilds to that workflow task and fails it (synthesizing a started event if it
318
>
// has not started yet), so the scheduled event is a sufficient anchor whether or
319
>
// not the task already started.
320
>
// - transient (failing, attempt > 1) or speculative pending task: not a usable
321
>
// anchor - it has no persisted WorkflowTaskScheduled event (its ScheduledEventID
322
>
// is a not-yet-written NextEventID placeholder), so skip it.
323
>
// - no workflow task at all: nothing to anchor on.
324
>
if workflowTask := baseMutableState.GetPendingWorkflowTask(); workflowTask != nil &&
325
>
!baseMutableState.IsTransientWorkflowTask() &&
326
>
workflowTask.Type != enumsspb.WORKFLOW_TASK_TYPE_SPECULATIVE {
327
baseRebuildLastEventID = workflowTask.ScheduledEventID
328
}