From d514e09dc4ab7345dcfbb8a79191898163510aa9 Mon Sep 17 00:00:00 2001 From: lgoyal6 Date: Fri, 21 Aug 2026 08:48:21 -0700 Subject: [PATCH] logreader: read segments in order, not discovery order auto_source accumulates valid_files across the filename and source loops, pruning needed_seg_idxs each pass, so segments resolved by a later pass land at the end of the dict. Returning .values() gave insertion order, so a route whose segments come from mixed sources was read out of order and logMonoTime moved backwards across segment boundaries. sort_by_time does not cover this; it sorts within one file. Return the files ordered by segment index. seg_idxs is always ascending, since a descending slice always evaluates to empty. --- openpilot/tools/lib/logreader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpilot/tools/lib/logreader.py b/openpilot/tools/lib/logreader.py index 805e411b53adb5..b611ea72d27c7d 100755 --- a/openpilot/tools/lib/logreader.py +++ b/openpilot/tools/lib/logreader.py @@ -179,7 +179,7 @@ def auto_source(identifier: str, sources: list[Source], default_mode: ReadMode) # We've found all files, return them if len(needed_seg_idxs) == 0: - return list(valid_files.values()) + return [valid_files[idx] for idx in sorted(valid_files)] else: raise FileNotFoundError(f"Did not find {fn} for seg idxs {needed_seg_idxs} of {sr.route_name}")