From 87b35e30eb7bd0e0916681e791aafc3d7087415c Mon Sep 17 00:00:00 2001 From: canvrno-oai Date: Fri, 29 May 2026 11:40:49 -0700 Subject: [PATCH] fix --- codex-rs/tui/src/app.rs | 3 +-- codex-rs/tui/src/app/tests.rs | 12 ++++++++++++ codex-rs/tui/src/app/thread_routing.rs | 23 ++++++++++++----------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index ff652b802e..f63ebf3e26 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -456,13 +456,12 @@ fn rollout_path_is_resumable(rollout_path: &Path) -> bool { std::fs::metadata(rollout_path).is_ok_and(|metadata| metadata.is_file() && metadata.len() > 0) } -fn errors_for_cwd(cwd: &Path, response: &SkillsListResponse) -> Vec { +fn errors_for_cwd(cwd: &Path, response: &SkillsListResponse) -> Option> { response .data .iter() .find(|entry| entry.cwd.as_path() == cwd) .map(|entry| entry.errors.clone()) - .unwrap_or_default() } #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/codex-rs/tui/src/app/tests.rs b/codex-rs/tui/src/app/tests.rs index 55132cb7ac..ee55737c98 100644 --- a/codex-rs/tui/src/app/tests.rs +++ b/codex-rs/tui/src/app/tests.rs @@ -2313,6 +2313,18 @@ async fn repeated_skill_load_warnings_emit_once_until_errors_clear() { rendered, ); + app.handle_skills_list_response(codex_app_server_protocol::SkillsListResponse { + data: vec![codex_app_server_protocol::SkillsListEntry { + cwd: test_path_buf("/tmp/other-project"), + skills: Vec::new(), + errors: Vec::new(), + }], + }); + assert!(drain_insert_history_cells(&mut app_event_rx).is_empty()); + + app.handle_skills_list_response(response.clone()); + assert!(drain_insert_history_cells(&mut app_event_rx).is_empty()); + app.handle_skills_list_response(codex_app_server_protocol::SkillsListResponse { data: vec![codex_app_server_protocol::SkillsListEntry { cwd, diff --git a/codex-rs/tui/src/app/thread_routing.rs b/codex-rs/tui/src/app/thread_routing.rs index 8fbb7f4fca..91b5666491 100644 --- a/codex-rs/tui/src/app/thread_routing.rs +++ b/codex-rs/tui/src/app/thread_routing.rs @@ -1339,17 +1339,18 @@ impl App { #[allow(clippy::too_many_arguments)] pub(super) fn handle_skills_list_response(&mut self, response: SkillsListResponse) { - let cwd = self.chat_widget.config_ref().cwd.clone(); - let errors = errors_for_cwd(&cwd, &response); - if errors.is_empty() { - self.skill_load_warnings_by_cwd.remove(&cwd); - } else if !self - .skill_load_warnings_by_cwd - .get(&cwd) - .is_some_and(|previous_errors| previous_errors == &errors) - { - emit_skill_load_warnings(&self.app_event_tx, &errors); - self.skill_load_warnings_by_cwd.insert(cwd, errors); + let cwd = self.chat_widget.config_ref().cwd.to_path_buf(); + if let Some(errors) = errors_for_cwd(&cwd, &response) { + if errors.is_empty() { + self.skill_load_warnings_by_cwd.remove(&cwd); + } else if !self + .skill_load_warnings_by_cwd + .get(&cwd) + .is_some_and(|previous_errors| previous_errors == &errors) + { + emit_skill_load_warnings(&self.app_event_tx, &errors); + self.skill_load_warnings_by_cwd.insert(cwd, errors); + } } self.chat_widget.handle_skills_list_response(response);