[codex] migrate ExecutorFileSystem paths to PathUri (#27424)

## Why

We're moving exec-server to use PathUri for its internal path
representations.

## What

Move `ExecutorFileSystem` APIs to use `PathUri` instead of
`AbsolutePathBuf`. Future changes will convert higher-level parts of
exec-server.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-11 18:44:18 +00:00
committed by GitHub
parent 4a05d3b282
commit b2a4e3be27
52 changed files with 1126 additions and 495 deletions
+1
View File
@@ -21,6 +21,7 @@ codex-mcp = { workspace = true }
codex-protocol = { workspace = true }
codex-tools = { workspace = true }
codex-utils-absolute-path = { workspace = true }
codex-utils-path-uri = { workspace = true }
codex-utils-string = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true, features = ["derive"] }
+8 -1
View File
@@ -10,6 +10,7 @@ use codex_protocol::capabilities::CapabilityRootLocation;
use codex_protocol::protocol::Product;
use codex_protocol::protocol::SkillScope;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
use crate::catalog::SkillAuthority;
use crate::catalog::SkillCatalog;
@@ -130,9 +131,15 @@ impl SkillProvider for ExecutorSkillProvider {
"executor skill resource references unavailable environment `{environment_id}`"
)));
};
let resource_path = PathUri::from_abs_path(resource_path).map_err(|err| {
SkillProviderError::new(format!(
"failed to read executor skill resource {}: {err}",
request.resource.as_str()
))
})?;
let contents = environment
.get_filesystem()
.read_file_text(resource_path, /*sandbox*/ None)
.read_file_text(&resource_path, /*sandbox*/ None)
.await
.map_err(|err| {
SkillProviderError::new(format!(
@@ -1,5 +1,4 @@
use std::io;
use std::path::Path;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
@@ -24,6 +23,7 @@ use codex_skills_extension::ExecutorSkillProvider;
use codex_skills_extension::provider::SkillListQuery;
use codex_skills_extension::provider::SkillProvider;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
use pretty_assertions::assert_eq;
const SKILL_CONTENTS: &str =
@@ -60,34 +60,23 @@ impl SyntheticFileSystem {
impl ExecutorFileSystem for SyntheticFileSystem {
async fn canonicalize(
&self,
path: &AbsolutePathBuf,
path: &PathUri,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<AbsolutePathBuf> {
if path == &self.alias_root {
return Ok(self.canonical_root.clone());
) -> FileSystemResult<PathUri> {
let path = path.to_abs_path()?;
if path == self.alias_root {
return PathUri::from_abs_path(&self.canonical_root);
}
self.metadata(path)?;
Ok(path.clone())
}
async fn join(
&self,
base_path: &AbsolutePathBuf,
path: &Path,
) -> FileSystemResult<AbsolutePathBuf> {
Ok(base_path.join(path))
}
async fn parent(&self, path: &AbsolutePathBuf) -> FileSystemResult<Option<AbsolutePathBuf>> {
Ok(path.parent())
self.metadata(&path)?;
PathUri::from_abs_path(&path)
}
async fn read_file(
&self,
path: &AbsolutePathBuf,
path: &PathUri,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<Vec<u8>> {
if path == &self.canonical_root.join("skill/SKILL.md") {
if path.to_abs_path()? == self.canonical_root.join("skill/SKILL.md") {
Ok(SKILL_CONTENTS.as_bytes().to_vec())
} else {
Err(io::Error::new(io::ErrorKind::NotFound, "not found"))
@@ -96,7 +85,7 @@ impl ExecutorFileSystem for SyntheticFileSystem {
async fn write_file(
&self,
_path: &AbsolutePathBuf,
_path: &PathUri,
_contents: Vec<u8>,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<()> {
@@ -105,7 +94,7 @@ impl ExecutorFileSystem for SyntheticFileSystem {
async fn create_directory(
&self,
_path: &AbsolutePathBuf,
_path: &PathUri,
_options: CreateDirectoryOptions,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<()> {
@@ -114,24 +103,25 @@ impl ExecutorFileSystem for SyntheticFileSystem {
async fn get_metadata(
&self,
path: &AbsolutePathBuf,
path: &PathUri,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<FileMetadata> {
self.metadata(path)
self.metadata(&path.to_abs_path()?)
}
async fn read_directory(
&self,
path: &AbsolutePathBuf,
path: &PathUri,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<Vec<ReadDirectoryEntry>> {
if path == &self.canonical_root {
let path = path.to_abs_path()?;
if path == self.canonical_root {
Ok(vec![ReadDirectoryEntry {
file_name: "skill".to_string(),
is_directory: true,
is_file: false,
}])
} else if path == &self.canonical_root.join("skill") {
} else if path == self.canonical_root.join("skill") {
Ok(vec![ReadDirectoryEntry {
file_name: "SKILL.md".to_string(),
is_directory: false,
@@ -144,7 +134,7 @@ impl ExecutorFileSystem for SyntheticFileSystem {
async fn remove(
&self,
_path: &AbsolutePathBuf,
_path: &PathUri,
_options: RemoveOptions,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<()> {
@@ -153,8 +143,8 @@ impl ExecutorFileSystem for SyntheticFileSystem {
async fn copy(
&self,
_source_path: &AbsolutePathBuf,
_destination_path: &AbsolutePathBuf,
_source_path: &PathUri,
_destination_path: &PathUri,
_options: CopyOptions,
_sandbox: Option<&FileSystemSandboxContext>,
) -> FileSystemResult<()> {