From 81969e48b8a50f1bb1b8f4aeeb1b91dff19ce707 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 25 May 2026 19:42:17 +0100 Subject: [PATCH] fix(codex): sort usage files before loading Sort Codex session files after recursive discovery so single-threaded and parallel event loading operate from a stable path order instead of filesystem read_dir order. This matches the Claude loader ordering and makes the existing parallel loader regression test deterministic without changing token parsing, dedupe keys, or aggregation semantics. Fixes #1105 --- rust/crates/ccusage/src/adapter/codex/loader.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/crates/ccusage/src/adapter/codex/loader.rs b/rust/crates/ccusage/src/adapter/codex/loader.rs index c5cbd6c87..6a2660d03 100644 --- a/rust/crates/ccusage/src/adapter/codex/loader.rs +++ b/rust/crates/ccusage/src/adapter/codex/loader.rs @@ -18,6 +18,7 @@ pub(crate) fn load_codex_events_from_directory( ) -> Result> { let mut files = Vec::new(); collect_usage_files(sessions_dir, &mut files); + files.sort_by_cached_key(|path| path.to_string_lossy().into_owned()); let mut events = if single_thread { files .iter()