# File lib/ruote/exp/flowexpression.rb, line 228
    def reply_to_parent (workitem, delete=true)

      if h.tagname

        unset_variable(h.tagname)

        @context.storage.put_msg(
          'left_tag', 'tag' => h.tagname, 'fei' => h.fei)
      end

      if h.timeout_schedule_id && h.state != 'timing_out'

        @context.storage.delete_schedule(h.timeout_schedule_id)
      end

      if h.state == 'failing' # on_error is implicit (#fail got called)

        trigger('on_error', workitem)

      elsif (h.state == 'cancelling') and h.on_cancel

        trigger('on_cancel', workitem)

      elsif (h.state == 'timing_out') and h.on_timeout

        trigger('on_timeout', workitem)

      else # vanilla reply

        #unpersist_or_raise if delete
        #try_unpersist if delete
        if delete
          do_unpersist || return
        end

        if h.parent_id

          @context.storage.put_msg(
            'reply',
            'fei' => h.parent_id,
            'workitem' => workitem.merge!('fei' => h.fei),
            'updated_tree' => h.updated_tree) # nil most of the time
        else

          @context.storage.put_msg(
            h.forgotten ? 'ceased' : 'terminated',
            'wfid' => h.fei['wfid'],
            'fei' => h.fei,
            'workitem' => workitem)
        end
      end
    end