diff --git a/codex-rs/app-server/src/codex_message_processor.rs b/codex-rs/app-server/src/codex_message_processor.rs index 0676c66ee9..14eee2f3e3 100644 --- a/codex-rs/app-server/src/codex_message_processor.rs +++ b/codex-rs/app-server/src/codex_message_processor.rs @@ -3208,6 +3208,9 @@ impl CodexMessageProcessor { Some(None) => Some(None), None => None, }; + let clears_git_info = matches!(git_sha, Some(None)) + || matches!(git_branch, Some(None)) + || matches!(git_origin_url, Some(None)); let updated = match state_db_ctx .update_thread_git_info( @@ -3236,6 +3239,18 @@ impl CodexMessageProcessor { .await; return; } + if clears_git_info + && let Err(err) = state_db_ctx + .touch_thread_updated_at(thread_uuid, Utc::now()) + .await + { + self.send_internal_error( + request_id, + format!("failed to touch thread metadata for {thread_uuid}: {err}"), + ) + .await; + return; + } let Some(summary) = read_summary_from_state_db_context_by_thread_id(Some(&state_db_ctx), thread_uuid).await diff --git a/codex-rs/thread-store/src/local/read_thread.rs b/codex-rs/thread-store/src/local/read_thread.rs index cbedb73e56..83cba57f1a 100644 --- a/codex-rs/thread-store/src/local/read_thread.rs +++ b/codex-rs/thread-store/src/local/read_thread.rs @@ -114,6 +114,8 @@ async fn read_thread_from_rollout_path( } if let Some(git_info) = git_info_from_metadata(&metadata) { thread.git_info = Some(git_info); + } else if metadata.updated_at > thread.updated_at { + thread.git_info = None; } } if !found_sqlite_title