Integrated: 1058: The mlbridge bot occasionally posts the same comments twice on Github

Erik Joelsson erikj at
Fri Jul 16 07:05:33 UTC 2021

On Thu, 15 Jul 2021 13:30:57 GMT, Erik Joelsson <erikj at> wrote:

> This patch (hopefully) fixes an issue where sometimes the mlbridge bot would post the same email as comment twice in a PR. This happens because two instances of the CommentPosterWorkItem are running at the same time for the same PullRequest.
> This is supposed to be protected by the method "concurrentWith(WorkItem other)". In this particular case, the check is faulty. It checks if the PullRequest object in this WorkItem is equal to the object in the other WorkItem. This is default Object equality, and there is definitely no guarantee that they both contain the exact same object.
> Looking around in other implementations of this method, there is mix of how stringent the checks are, some only check if the field is the same, but most also check something about the HostedRepository to which the PR belongs (either name or url). I think calculating the url seems a bit expensive for an equals check.
> I propose a new method on the PullRequest interface: "isSame(PullRequest other)". This isn't trying to be an equals, as that's a bit hard to define (and I don't want to get into implementing hashCode at this time), but will just return true if both PullRequest instances are logically referring to the same hosted pull request. I have replaced all uses of PullRequest.equals() and with this new method for consistency.

This pull request has now been integrated.

Changeset: fd42d900
Author:    Erik Joelsson <erikj at>
Stats:     38 lines in 10 files changed: 9 ins; 18 del; 11 mod

1058: The mlbridge bot occasionally posts the same comments twice on Github

Reviewed-by: kcr



More information about the skara-dev mailing list