Route skill discovery and loading through EnvironmentAccess (#46293)

## What changed

Use `EnvironmentAccess` for skill discovery, environment skill loading, and plugin namespace resolution, replacing direct `ExecutorFileSystem` calls with explicit `None` sandbox arguments.

Wrap existing host and executor filesystems with `FileSystemEnvironmentAccessor::unrestricted` to preserve their current access behavior. Update discovery, loading, and namespace tests to use the same adapter.

GitOrigin-RevId: d68168cc0ee19dc303ef4ee726cf1de1a8db81e0
This commit is contained in:
Adam Perry @ OpenAI
2026-09-17 19:52:03 +00:00
committed by copyberry
parent 93321c88d8
commit 47fc8d661e
10 changed files with 62 additions and 61 deletions
+9 -15
View File
@@ -1,6 +1,7 @@
//! Resolve plugin namespace from skill file paths by walking ancestors for `plugin.json`.
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server::EnvironmentAccess;
use codex_exec_server::EnvironmentAccessExt;
use codex_exec_server::GetMetadataOptions;
use codex_exec_server::ReadFileOptions;
use codex_exec_server_protocol::DISCOVERABLE_PLUGIN_MANIFEST_PATHS;
@@ -87,18 +88,14 @@ struct RawPluginManifestName {
/// Returns the plugin manifest `name` defined directly below `plugin_root`.
pub async fn plugin_namespace_for_root_uri(
fs: &dyn ExecutorFileSystem,
fs: &dyn EnvironmentAccess,
plugin_root: &PathUri,
) -> Option<String> {
let mut manifest_path = None;
for relative_path in DISCOVERABLE_PLUGIN_MANIFEST_PATHS {
let candidate = plugin_root.join(relative_path).ok()?;
match fs
.get_metadata(
&candidate,
GetMetadataOptions::default(),
/*sandbox*/ None,
)
.get_metadata(&candidate, GetMetadataOptions::default())
.await
{
Ok(metadata) if metadata.is_file => {
@@ -109,11 +106,7 @@ pub async fn plugin_namespace_for_root_uri(
}
}
let contents = fs
.read_file_text(
&manifest_path?,
ReadFileOptions::default(),
/*sandbox*/ None,
)
.read_file_text(&manifest_path?, ReadFileOptions::default())
.await
.ok()?;
let RawPluginManifestName { name: raw_name } = serde_json::from_str(&contents).ok()?;
@@ -131,6 +124,7 @@ mod tests {
use super::AGENT_PLUGIN_SCHEMA_URI;
use super::find_plugin_manifest_path;
use super::plugin_namespace_for_root_uri;
use codex_exec_server::FileSystemEnvironmentAccessor;
use codex_exec_server::LOCAL_FS;
use codex_utils_absolute_path::test_support::PathBufExt;
use codex_utils_path_uri::PathUri;
@@ -157,7 +151,7 @@ mod tests {
assert_eq!(
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&FileSystemEnvironmentAccessor::unrestricted(&LOCAL_FS),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,
@@ -180,7 +174,7 @@ mod tests {
assert_eq!(
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&FileSystemEnvironmentAccessor::unrestricted(&LOCAL_FS),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,
@@ -204,7 +198,7 @@ mod tests {
assert_eq!(
plugin_namespace_for_root_uri(
LOCAL_FS.as_ref(),
&FileSystemEnvironmentAccessor::unrestricted(&LOCAL_FS),
&PathUri::from_abs_path(&plugin_root.abs()),
)
.await,