I saw this message was asked before but I didn't see any solution.
The scenario is: we use the sent event to get the message id that was sent and we save it to our server. In addition, each message view that being created, we save the data of this message. This message view can be of an incoming message but it can be of an outgoing message too. When the user is sending an inline reply, right after the sent event a message view with the same message is created, so we need to make sure we don't save the message twice.
Recently we saw that sometimes the message id's in both places are not equal so we get a duplicate message in our server. In the message view I see the id that returned from messageView.getMessageIDAsync(), but the id returned from the sent event is somewhere in an hidden html. After refreshing the page, the id in the html of the message view returns to be the same as the one from the sent event, and the message id of the message view doesn't exist anymore in the html.
This doesn't happen always but most of the times an inline reply is sent.
This may look like a gmail bug. If you extract the message id from the message view html, there may be a workaround to get it by calling the "view original" page and get the message id from there.
Thanks