def leave_tag(workitem)

      unset_variable(h.tagname)

      Ruote::Workitem.new(workitem).send(:remove_tag, h.tagname)

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

      return unless h.full_tagname # for backward compatibility

      r = root

      return unless r && r.variables # might happen

      r.variables.delete(h.full_tagname)

      state = case (h.trigger || h.state)

        when 'on_cancel' then 'cancelled'
        when 'on_error' then 'failed'
        when 'on_timeout' then 'timed out'
        when 'on_re_apply' then nil

        when 'cancelling' then 'cancelled'
        when 'dying' then 'killed'

        else nil
      end

      (r.variables['__past_tags__'] ||= []) << [
        h.full_tagname,
        fei.sid,
        state,
        Ruote.now_to_utc_s,
        Ruote.fulldup(h.variables)
          # not fullduping here triggers a segfault at some point with YAJL
      ]

      r.do_persist unless r.fei == self.fei
    end
def leave_tag(workitem)

      unset_variable(h.tagname)

      Ruote::Workitem.new(workitem).send(:remove_tag, h.tagname)

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

      return unless h.full_tagname # for backward compatibility

      r = root

      return unless r && r.variables # might happen

      r.variables.delete(h.full_tagname)

      state = case (h.trigger || h.state)

        when 'on_cancel' then 'cancelled'
        when 'on_error' then 'failed'
        when 'on_timeout' then 'timed out'
        when 'on_re_apply' then nil

        when 'cancelling' then 'cancelled'
        when 'dying' then 'killed'

        else nil
      end

      (r.variables['__past_tags__'] ||= []) << [
        h.full_tagname,
        fei.sid,
        state,
        Ruote.now_to_utc_s,
        Ruote.fulldup(h.variables)
          # not fullduping here triggers a segfault at some point with YAJL
      ]

      r.do_persist unless r.fei == self.fei
    end
Called when the expression is about to reply to its parent and wants
 to get rid of its tags.