Remove obsolete plugin skill discovery helpers (#37832)

## What changed

- Remove the path-only `effective_skill_roots` API and its type-erasing trait in favor of `effective_plugin_skill_roots`, which preserves plugin metadata.
- Remove skill-path ancestor lookup helpers and keep namespace resolution scoped to an explicit plugin root.
- Update plugin manager and namespace tests to exercise the retained APIs directly.

GitOrigin-RevId: 507bf43bc6147bb5ab2deba4fa176bea2535159c
This commit is contained in:
felixxia-oai
2026-08-10 14:25:13 +00:00
committed by copyberry
parent d109393270
commit bfb7790eb3
5 changed files with 24 additions and 66 deletions
+17 -29
View File
@@ -2,7 +2,6 @@
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server_protocol::DISCOVERABLE_PLUGIN_MANIFEST_PATHS;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
use std::path::Path;
use std::path::PathBuf;
@@ -100,38 +99,15 @@ pub async fn plugin_namespace_for_root_uri(
)
}
/// Returns the plugin manifest `name` for the nearest ancestor of `path` that contains a valid
/// plugin manifest (same `name` rules as full manifest loading in codex-core).
pub async fn plugin_namespace_for_skill_path(
fs: &dyn ExecutorFileSystem,
path: &AbsolutePathBuf,
) -> Option<String> {
plugin_namespace_for_skill_uri(fs, &PathUri::from_abs_path(path)).await
}
/// Returns the plugin manifest `name` for the nearest URI ancestor of `path`.
pub async fn plugin_namespace_for_skill_uri(
fs: &dyn ExecutorFileSystem,
path: &PathUri,
) -> Option<String> {
let mut ancestor = Some(path.clone());
while let Some(path) = ancestor {
if let Some(name) = plugin_namespace_for_root_uri(fs, &path).await {
return Some(name);
}
ancestor = path.parent();
}
None
}
#[cfg(test)]
mod tests {
use super::AGENT_PLUGIN_MANIFEST_RELATIVE_PATH;
use super::AGENT_PLUGIN_SCHEMA_URI;
use super::find_plugin_manifest_path;
use super::plugin_namespace_for_skill_path;
use super::plugin_namespace_for_root_uri;
use codex_exec_server::LOCAL_FS;
use codex_utils_absolute_path::test_support::PathBufExt;
use codex_utils_path_uri::PathUri;
use std::fs;
use tempfile::tempdir;
@@ -154,7 +130,11 @@ mod tests {
fs::write(&skill_path, "---\ndescription: search\n---\n").expect("write skill");
assert_eq!(
plugin_namespace_for_skill_path(LOCAL_FS.as_ref(), &skill_path.abs()).await,
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,
Some("sample".to_string())
);
}
@@ -173,7 +153,11 @@ mod tests {
fs::write(&skill_path, "---\ndescription: search\n---\n").expect("write skill");
assert_eq!(
plugin_namespace_for_skill_path(LOCAL_FS.as_ref(), &skill_path.abs()).await,
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,
Some("sample".to_string())
);
assert_eq!(find_plugin_manifest_path(&plugin_root), Some(manifest_path));
@@ -193,7 +177,11 @@ mod tests {
fs::write(&skill_path, "---\ndescription: search\n---\n").expect("write skill");
assert_eq!(
plugin_namespace_for_skill_path(LOCAL_FS.as_ref(), &skill_path.abs()).await,
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,
Some("sample".to_string())
);
assert_eq!(find_plugin_manifest_path(&plugin_root), Some(manifest_path));