Is there a way to make a herald rule only trigger based on an action not on a state?

Hello, I am trying to make a herald rule that triggers when someone removes a tag from a task. The way that I came up with was to have a herald rule that asserts that the task has the other traits that I want, then have another herald rule that uses the first herald rule as a condition, then check that the tag is missing as the other condition. So I have

Herald Rule A - Checks that a task has other traits I want to the issue to still have
Herald Rule B - Checks that Rule A is true, but also that the tag I want removed is missing.

So this only protects me from the case where someone makes a new task that both matches the conditions of A and B. This is because the task hasn’t been made yet, so it never matches A (even though the task will match A after it has been made. I should say the conditions of A are themselves set by a third different herald rule and that’s why that is true), so in that case, it doesn’t match B and doesn’t do the action in B.

And I thought I was so clever. But then if you made a task that matched A, but also already matched B, it would pass B anytime you make ANY change to that task, not just if you had removed the tag so that it would start matching B. I don’t want that.

I only want my herald rule to pass when it matches A and ONLY when the tag is removed so that it wasn’t matching B before and then starts matching B. If Herald operated on actions and not just states, this would be a lot easier. How can I describe the state to include the state of both before and after whatever action happens that triggers the herald rule?

In the general case, no, Herald can not currently react to a project tag being added or removed.

You may be able to fake your way through this to some degree with Take actions [if this rule did not match the last time]:, but the more reasonable fix is to get [ Added project tags ], [ Modified project tags ], and [ Removed project tags ] added to the upstream as Herald fields.

The way forward on this is open after https://secure.phabricator.com/T13283, which added enough support code to make me comfortable adding more action-based fields to Herald. Historically, Herald has mostly provided only state-based fields because they’re much easier to understand/explain/test, but there’s some additional support for building plausible actions now and recording them in the transcript.