code: func (r *Supervisor) UpdatableTasksInSlot(ctx context.Context, slot orchestrator.Slot, service *api.Service) orchestrator.Slot {
  	if len(slot) < 1 {
  		return nil
  	}
  
  	var updatable orchestrator.Slot
  	for _, t := range slot {
  		if t.DesiredState <= api.TaskStateRunning {
  			updatable = append(updatable, t)
  		}
  	}
  	if len(updatable) > 0 {
  		return updatable
  	}
  
  	if service.UpdateStatus != nil && service.UpdateStatus.State == api.UpdateStatus_ROLLBACK_STARTED {
  		return nil
  	}
  
  	// Find most recent task
  	byTimestamp := orchestrator.TasksByTimestamp(slot)
  	newestIndex := 0
  	for i := 1; i != len(slot); i++ {
  		if byTimestamp.Less(newestIndex, i) {
  			newestIndex = i
  		}
  	}
  
  	if !r.shouldRestart(ctx, slot[newestIndex], service) {
  		return orchestrator.Slot{slot[newestIndex]}
  	}
  	return nil
  }
docs: // UpdatableTasksInSlot returns the set of tasks that should be passed to the
  // updater from this slot, or an empty slice if none should be.  An updatable
  // slot has either at least one task that with desired state <= RUNNING, or its
  // most recent task has stopped running and should not be restarted. The latter
  // case is for making sure that tasks that shouldn't normally be restarted will
  // still be handled by rolling updates when they become outdated.  There is a
  // special case for rollbacks to make sure that a rollback always takes the
  // service to a converged state, instead of ignoring tasks with the original
  // spec that stopped running and shouldn't be restarted according to the
  // restart policy.