Do you know why you added this part?  Checking for the message already being present seems sound/good from a correctness perspective, but I'm a little worried that a test in which this matters is a test that might have issues.  (Specifically, under all existing sync idioms, there's no way you should see a header until you trigger the sync yourself.)