Herald "send an email to" action not firing when revisions leave draft

I appear to still be having this or a very similar issue.

Given a Herald Rule:

When any of these conditions are met:
 - Affected files contains foo.ext
 - Affected files contains bar.ext
 - Affected files contains baz.ext
 - Affected files contains qwerty.ext
Take these actions the first time this rule matches:
- Send an email to: user1, user2, user3

(I also tried w/ “every time this rule matches”, which is what the users actually want for their rule, but I figured maybe it didn’t work properly.)

I create a Revision via normal arc diff command.

The following “actions” are listed on the Revision:

Tue, Jul 2, 19:10
 - mribau created this revision.
Tue, Jul 2, 19:10
- Owners added a reviewer: O4: REDACTED owned. 
Tue, Jul 2, 19:10
- Herald added a reviewer: REDACTED. · View Herald Transcript
- Herald added projects: REDACTED. · View Herald Transcript
Tue, Jul 2, 19:10
- mribau requested review of this revision.
Tue, Jul 2, 19:10
- Harbormaster completed remote builds in B56785: Diff 115987.

When viewing the Herald Transcript for the rule above, the following is shown:

H21 PFRs: Email Users - Logging REDACTED
Forbidden	Object state prevented rule evaluation.
Action: Send an email to	
Forbidden	This revision is still an unsubmitted draft, so mail will not be sent yet.

Based on the linked Task in prior comments, it looks like Herald is supposed to run a second time and actually process the rule? It doesn’t seem to be happening for me. Did I misunderstand how this is supposed to be working?

Version Info:

5cf820bd35bf859c85e588f6fee2471ba06083e8 (Tue, Jun 18) 
(branched from 683647f1fb9091b8928056d068be7bb954c127c9 on upstream) 

36a397de12d07ad2093f2299c418a178502d1747 (Thu, Jun 13) 
(branched from 2234c8cacc21ce61c9c10e8e5918b6a63cc38fc8 on upstream) 

phutil 1fcc3a2d3799581453584c90d621329a7ed5c00d (Tue, Jun 11) 
(branched from e4f8b70e73faff0edeb3a310c0ff1d10b4b54949 on upstream)

I split this from https://discourse.phabricator-community.org/t/differential-drafts-and-herald-events/809/.

When reporting an issue, please prefer to file a new topic over bumping an old one.

I can’t reproduce this. Here’s what I did:

I created this Herald rule, similar to your rule:

Then, I created a revision affecting a file named quack.txt.

This created three entries in the Herald transcript, because there are three updates which Herald can act on:

These updates are:

  • creation of the revision;
  • promotion of the revision for review; and
  • builds passing.

In this case, these run in that order (which is normal if you do not have server-sdie builds configured). It looks like this is also the order in your environment. In other cases, the build event may before the promotion event.

The first transcript (for revision creation) is similar to the transcript you transcribed:

However, in the second transcript (for promotion), the rule passes and the email sends:

The email can be found in bin/mail list-outbound and examined with bin/mail show-outbound --id:

$ ./bin/mail show-outbound --id 5207
ID: 5207
Status: void
Related PHID: PHID-DREV-q4ok2qwiyxu426jkezpr
Message: No mailers are configured.

subject: D88: Revision for "Send an Email To"

epriestley created this revision.
epriestley requested review of this revision.




To: epriestley
Cc: bailey

Aha! I think the “bug”/confusion may be that the additional two transcripts are not showing up on the Revision’s history itself. I found the appropriate two extra transcripts in Herald’s history. The transcript links in the Revision’s history both only go to the first transcript. Perhaps these additional transcripts need to somehow be also referred to from the Revision?

Herald History:

Revision’s History:

(Also, sorry about necro-posting. I thought since it was a very similar bug it would help to be related to the prior.)

Transcripts are only linked from the revision when they cause actions. The links to the transcripts on the revision are “explain why this happened”, not “review everything Herald has done”. To review every execution of Herald against an object, find transcripts in Herald > Transcripts.

If we did it the way you suggest, we’d often have timelines like this:

epriestley added a comment.
blah blah blah
Herald didn’t take any actions. ( View Transcript )

alice added a subscriber: josephine.
Herald didn’t take any actions. ( View Transcript )

…and so on.

In this case, both “added a reviewer” and “added projects” were presumably caused by the same evaluation phase in Herald, so both link to the same transcript.

Agreed. Hmm. It looks like my specific example ended up not taking any actions for the two extra runs. And that’s why they’re not there in the Revision history in any form. Got it. Thank you very much for the explanations and hopefully these will save others some time in figuring out their Herald rules.