Don't miss-detect double headers

We've seen some recent log files where double headers were being
detected, but really, they were fine because the logger no longer
generates double header log files.  This was manifesting itself as:

Check failed: sorter.old_parts.empty() != sorter.parts_list.empty() (0 vs. 0) : Can't have a mix of old and new parts.

For log files we know are new enough (version field is a pretty good
hint...), the check does more harm than good, so don't do it.

Change-Id: I8e32d7c64bcab6363e3842441c48a1c86f40ad5e
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index a76c1a8..342cf8b 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -987,7 +987,13 @@
     return std::nullopt;
   }
 
-  if (FLAGS_workaround_double_headers) {
+  // We only know of busted headers in the versions of the log file header
+  // *before* the logger_sha1 field was added.  At some point before that point,
+  // the logic to track when a header has been written was rewritten in such a
+  // way that it can't happen anymore.  We've seen some logs where the body
+  // parses as a header recently, so the simple solution of always looking is
+  // failing us.
+  if (FLAGS_workaround_double_headers && !result.message().has_logger_sha1()) {
     while (true) {
       absl::Span<const uint8_t> maybe_header_data = span_reader->PeekMessage();
       if (maybe_header_data == absl::Span<const uint8_t>()) {