From b0049ab644f99eb94529a991e99d8946a70ff01e Mon Sep 17 00:00:00 2001 From: Owen Lin Date: Tue, 20 Jan 2026 13:39:31 -0800 Subject: [PATCH] fix(core): don't update the file's mtime on resume (#9553) Remove `FileTimes::new().set_modified(SystemTime::now())` when resuming a thread. Context: It's awkward in UI built on top of app-server that resuming a thread bumps the `updated_at` timestamp, even if no message is sent. So if you open a thread (perhaps to just view its contents), it automatically reorders it to the top which is almost certainly not what you want. --- codex-rs/core/src/rollout/recorder.rs | 28 ++++++++------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/codex-rs/core/src/rollout/recorder.rs b/codex-rs/core/src/rollout/recorder.rs index 8c2efcf4e..c5bd14b3c 100644 --- a/codex-rs/core/src/rollout/recorder.rs +++ b/codex-rs/core/src/rollout/recorder.rs @@ -1,12 +1,10 @@ //! Persist Codex session rollouts (.jsonl) so sessions can be replayed or inspected later. use std::fs::File; -use std::fs::FileTimes; use std::fs::{self}; use std::io::Error as IoError; use std::path::Path; use std::path::PathBuf; -use std::time::SystemTime; use codex_protocol::ThreadId; use codex_protocol::models::BaseInstructions; @@ -197,17 +195,14 @@ impl RolloutRecorder { }), ) } - RolloutRecorderParams::Resume { path } => { - touch_rollout_file(&path)?; - ( - tokio::fs::OpenOptions::new() - .append(true) - .open(&path) - .await?, - path, - None, - ) - } + RolloutRecorderParams::Resume { path } => ( + tokio::fs::OpenOptions::new() + .append(true) + .open(&path) + .await?, + path, + None, + ), }; // Clone the cwd for the spawned task to collect git info asynchronously @@ -392,13 +387,6 @@ fn create_log_file(config: &Config, conversation_id: ThreadId) -> std::io::Resul }) } -fn touch_rollout_file(path: &Path) -> std::io::Result<()> { - let file = fs::OpenOptions::new().append(true).open(path)?; - let times = FileTimes::new().set_modified(SystemTime::now()); - file.set_times(times)?; - Ok(()) -} - async fn rollout_writer( file: tokio::fs::File, mut rx: mpsc::Receiver,