[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
@@ -28,6 +28,7 @@ codex-models-manager = { workspace = true }
codex-protocol = { workspace = true }
codex-utils-absolute-path = { workspace = true }
codex-utils-cargo-bin = { workspace = true }
codex-utils-path-uri = { workspace = true }
ctor = { workspace = true }
futures = { workspace = true }
notify = { workspace = true }
+26 -7
View File
@@ -43,6 +43,7 @@ use codex_protocol::protocol::TurnEnvironmentSelection;
use codex_protocol::protocol::TurnEnvironmentSelections;
use codex_protocol::user_input::UserInput;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
use futures::future::BoxFuture;
use serde_json::Value;
use tempfile::TempDir;
@@ -135,10 +136,11 @@ pub async fn test_env() -> Result<TestEnv> {
let environment =
codex_exec_server::Environment::create_for_tests(Some(websocket_url.clone()))?;
let cwd = remote_aware_cwd_path();
let cwd_uri = PathUri::from_path(&cwd)?;
environment
.get_filesystem()
.create_directory(
&cwd,
&cwd_uri,
CreateDirectoryOptions { recursive: true },
/*sandbox*/ None,
)
@@ -907,35 +909,45 @@ impl TestCodexHarness {
) -> Result<()> {
let abs_path = self.path_abs(rel);
if let Some(parent) = abs_path.parent() {
let parent_uri = PathUri::from_path(&parent)?;
self.test
.fs()
.create_directory(
&parent,
&parent_uri,
CreateDirectoryOptions { recursive: true },
/*sandbox*/ None,
)
.await?;
}
let abs_path_uri = PathUri::from_path(&abs_path)?;
self.test
.fs()
.write_file(&abs_path, contents.as_ref().to_vec(), /*sandbox*/ None)
.write_file(
&abs_path_uri,
contents.as_ref().to_vec(),
/*sandbox*/ None,
)
.await?;
Ok(())
}
pub async fn read_file_text(&self, rel: impl AsRef<Path>) -> Result<String> {
let path = self.path_abs(rel);
let path_uri = PathUri::from_path(&path)?;
Ok(self
.test
.fs()
.read_file_text(&self.path_abs(rel), /*sandbox*/ None)
.read_file_text(&path_uri, /*sandbox*/ None)
.await?)
}
pub async fn create_dir_all(&self, rel: impl AsRef<Path>) -> Result<()> {
let path = self.path_abs(rel);
let path_uri = PathUri::from_path(&path)?;
self.test
.fs()
.create_directory(
&self.path_abs(rel),
&path_uri,
CreateDirectoryOptions { recursive: true },
/*sandbox*/ None,
)
@@ -948,10 +960,11 @@ impl TestCodexHarness {
}
pub async fn remove_abs_path(&self, path: &AbsolutePathBuf) -> Result<()> {
let path_uri = PathUri::from_abs_path(path)?;
self.test
.fs()
.remove(
path,
&path_uri,
RemoveOptions {
recursive: false,
force: true,
@@ -963,7 +976,13 @@ impl TestCodexHarness {
}
pub async fn abs_path_exists(&self, path: &AbsolutePathBuf) -> Result<bool> {
match self.test.fs().get_metadata(path, /*sandbox*/ None).await {
let path_uri = PathUri::from_abs_path(path)?;
match self
.test
.fs()
.get_metadata(&path_uri, /*sandbox*/ None)
.await
{
Ok(_) => Ok(true),
Err(err) if err.kind() == ErrorKind::NotFound => Ok(false),
Err(err) => Err(err.into()),