code: public static PvmExecutionImpl determinePropagatingExecutionOnEnd(PvmExecutionImpl propagatingExecution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) {
      if (!propagatingExecution.isScope()) {
        // non-scope executions may end in the "wrong" flow scope
        return propagatingExecution;
      }
      else {
        // superfluous scope executions won't be contained in the activity-execution mapping
        if (activityExecutionMapping.values().contains(propagatingExecution)) {
          return propagatingExecution;
        }
        else {
          // skip one scope
          propagatingExecution.remove();
          PvmExecutionImpl parent = propagatingExecution.getParent();
          parent.setActivity(propagatingExecution.getActivity());
          return propagatingExecution.getParent();
        }
      }
    }
docs: Tolerates the broken execution trees fixed with CAM-3727 where there may be more
  ancestor scope executions than ancestor flow scopes;
  
  In that case, the argument execution is removed, the parent execution of the argument
  is returned such that one level of mismatch is corrected.
  
  Note that this does not necessarily skip the correct scope execution, since
  the broken parent-child relationships may be anywhere in the tree (e.g. consider a non-interrupting
  boundary event followed by a subprocess (i.e. scope), when the subprocess ends, we would
  skip the subprocess's execution).