Skip to content

Commit 798de22

Browse files
[codex-backend] Prefer state git metadata in filtered thread lists (#19874)
### Summary - `thread/list` filtered filesystem results already overlay state DB metadata, but the existing merge only filled missing git fields. - Prefer non-null SQLite git metadata over stale non-null rollout values so persisted branch/SHA/origin updates are reflected in filtered thread lists. - Update the focused merge test to cover stale filesystem git metadata being replaced by state-backed values. ### Testing now getting expected icons <img width="426" height="913" alt="Screenshot 2026-04-27 at 1 45 45 PM" src="https://github.com/user-attachments/assets/027fb7e7-f54d-4353-8423-cb76f3c8f5ac" />
1 parent c5e2921 commit 798de22

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

codex-rs/rollout/src/recorder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,13 +1046,13 @@ fn fill_missing_thread_item_metadata(item: &mut ThreadItem, state_item: ThreadIt
10461046
if item.cwd.is_none() {
10471047
item.cwd = cwd;
10481048
}
1049-
if item.git_branch.is_none() {
1049+
if git_branch.is_some() {
10501050
item.git_branch = git_branch;
10511051
}
1052-
if item.git_sha.is_none() {
1052+
if git_sha.is_some() {
10531053
item.git_sha = git_sha;
10541054
}
1055-
if item.git_origin_url.is_none() {
1055+
if git_origin_url.is_some() {
10561056
item.git_origin_url = git_origin_url;
10571057
}
10581058
if item.source.is_none() {

codex-rs/rollout/src/recorder_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ async fn list_threads_metadata_filter_overlays_state_db_list_metadata() -> std::
779779
}
780780

781781
#[test]
782-
fn fill_missing_thread_item_metadata_preserves_filesystem_identity() {
782+
fn fill_missing_thread_item_metadata_preserves_identity_and_prefers_state_git_fields() {
783783
let filesystem_thread_id = ThreadId::new();
784784
let state_thread_id = ThreadId::new();
785785
let filesystem_path = PathBuf::from("/tmp/filesystem-rollout.jsonl");
@@ -789,9 +789,9 @@ fn fill_missing_thread_item_metadata_preserves_filesystem_identity() {
789789
thread_id: Some(filesystem_thread_id),
790790
first_user_message: Some("filesystem message".to_string()),
791791
cwd: None,
792-
git_branch: None,
793-
git_sha: None,
794-
git_origin_url: None,
792+
git_branch: Some("filesystem-branch".to_string()),
793+
git_sha: Some("filesystem-sha".to_string()),
794+
git_origin_url: Some("https://example.com/filesystem.git".to_string()),
795795
source: None,
796796
agent_nickname: None,
797797
agent_role: None,

0 commit comments

Comments
 (0)