From 280ab9412aff2cb53556dd21e57572e2ee0addea Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Sat, 30 May 2026 18:50:04 -0300 Subject: [PATCH] test(core): canonicalize selected plugin skill paths --- codex-rs/core/src/session/turn.rs | 20 ++------------------ codex-rs/core/tests/suite/plugins.rs | 2 +- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/codex-rs/core/src/session/turn.rs b/codex-rs/core/src/session/turn.rs index 35ec7ae403..26774d12bc 100644 --- a/codex-rs/core/src/session/turn.rs +++ b/codex-rs/core/src/session/turn.rs @@ -26,7 +26,6 @@ use crate::hook_runtime::run_pending_session_start_hooks; use crate::hook_runtime::run_turn_stop_hooks; use crate::injection::ToolMentionKind; use crate::injection::app_id_from_path; -use crate::injection::extract_tool_mentions; use crate::injection::tool_kind_for_path; use crate::mcp_skill_dependencies::maybe_prompt_and_install_mcp_dependencies; use crate::mcp_tool_exposure::build_mcp_tool_exposure; @@ -511,8 +510,7 @@ async fn build_skills_and_plugins( ) .await; let structured_skill_may_reference_apps = - skill_injections_may_reference_apps(&skill_injections) - || structured_skill_inputs_may_reference_apps(&structured_skill_input).await; + skill_injections_may_reference_apps(&skill_injections); // Plain text skill mentions can collide with app slugs, so preserve their // existing app-inventory resolution behavior. let text_skill_input = user_input @@ -804,22 +802,8 @@ fn skill_injections_may_reference_apps( .any(|skill| skill_contents_may_reference_apps(&skill.contents)) } -async fn structured_skill_inputs_may_reference_apps(inputs: &[UserInput]) -> bool { - for input in inputs { - let UserInput::Skill { path, .. } = input else { - continue; - }; - if let Ok(contents) = tokio::fs::read_to_string(path).await - && skill_contents_may_reference_apps(&contents) - { - return true; - } - } - false -} - fn skill_contents_may_reference_apps(contents: &str) -> bool { - let mentions = extract_tool_mentions(contents); + let mentions = crate::injection::extract_tool_mentions(contents); mentions.plain_names().next().is_some() || mentions .paths() diff --git a/codex-rs/core/tests/suite/plugins.rs b/codex-rs/core/tests/suite/plugins.rs index c7e330d52f..e77eb6f46f 100644 --- a/codex-rs/core/tests/suite/plugins.rs +++ b/codex-rs/core/tests/suite/plugins.rs @@ -64,7 +64,7 @@ fn write_plugin_skill_plugin(home: &TempDir) -> std::path::PathBuf { "---\ndescription: inspect sample data\n---\n\n# body\n", ) .expect("write plugin skill"); - skill_dir.join("SKILL.md") + std::fs::canonicalize(skill_dir.join("SKILL.md")).expect("canonicalize plugin skill") } fn write_plugin_mcp_plugin(home: &TempDir, command: &str) {