From ce3329b3e5bda2a55ab6cdefbf8c6ec8fa1b5484 Mon Sep 17 00:00:00 2001 From: anais Date: Wed, 17 Jun 2026 22:33:52 -0700 Subject: [PATCH] address app-server review feedback --- codex-rs/rollout/src/recorder.rs | 20 +++++++++++--------- codex-rs/thread-store/src/local/helpers.rs | 5 +++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/codex-rs/rollout/src/recorder.rs b/codex-rs/rollout/src/recorder.rs index 0c251b0344..9a53aecac2 100644 --- a/codex-rs/rollout/src/recorder.rs +++ b/codex-rs/rollout/src/recorder.rs @@ -3,6 +3,7 @@ use std::collections::HashSet; use std::fs; use std::fs::File; +use std::io::BufRead; use std::io::Error as IoError; use std::path::Path; use std::path::PathBuf; @@ -959,14 +960,15 @@ impl RolloutRecorder { fn load_plain_rollout_items_blocking( path: &Path, ) -> std::io::Result<(Vec, Option, usize)> { - let contents = std::fs::read_to_string(path)?; + let reader = std::io::BufReader::new(File::open(path)?); let mut items: Vec = Vec::new(); let mut thread_id: Option = None; let mut parse_errors = 0usize; let mut saw_non_empty_line = false; - for line in contents.lines() { + for line in reader.lines() { + let line = line?; parse_rollout_item_line( - line, + line.as_str(), &mut items, &mut thread_id, &mut parse_errors, @@ -1875,6 +1877,10 @@ impl From for ThreadsPage { } fn thread_item_from_state_list_item(item: codex_state::ThreadListItem) -> ThreadItem { + let source = serde_json::from_str(item.source.as_str()) + .or_else(|_| serde_json::from_value(Value::String(item.source))) + .unwrap_or(SessionSource::Unknown); + let parent_thread_id = source.parent_thread_id(); ThreadItem { path: item.rollout_path, thread_id: Some(item.id), @@ -1885,12 +1891,8 @@ fn thread_item_from_state_list_item(item: codex_state::ThreadListItem) -> Thread git_branch: item.git_branch, git_sha: item.git_sha, git_origin_url: item.git_origin_url, - source: Some( - serde_json::from_str(item.source.as_str()) - .or_else(|_| serde_json::from_value(Value::String(item.source))) - .unwrap_or(SessionSource::Unknown), - ), - parent_thread_id: None, + source: Some(source), + parent_thread_id, agent_nickname: item.agent_nickname, agent_role: item.agent_role, model_provider: Some(item.model_provider), diff --git a/codex-rs/thread-store/src/local/helpers.rs b/codex-rs/thread-store/src/local/helpers.rs index 22be500482..1f76a66920 100644 --- a/codex-rs/thread-store/src/local/helpers.rs +++ b/codex-rs/thread-store/src/local/helpers.rs @@ -210,6 +210,7 @@ pub(super) fn stored_thread_from_state_list_item( } else { model_provider }; + let source = parse_session_source(&source); let created_at = truncate_datetime_to_seconds(created_at); let updated_at = truncate_datetime_to_millis(updated_at); let recency_at = truncate_datetime_to_millis(recency_at); @@ -219,7 +220,7 @@ pub(super) fn stored_thread_from_state_list_item( extra_config: None, rollout_path: Some(rollout_path), forked_from_id: None, - parent_thread_id, + parent_thread_id: parent_thread_id.or_else(|| source.parent_thread_id()), preview, name, model_provider, @@ -231,7 +232,7 @@ pub(super) fn stored_thread_from_state_list_item( archived_at: archived.then_some(updated_at), cwd, cli_version, - source: parse_session_source(&source), + source, thread_source: None, agent_nickname, agent_role,