Port more orchestrator executor split seams

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-03-21 11:22:29 -07:00
co-authored by Codex
parent a11f4795e3
commit e061bbbf84
121 changed files with 7465 additions and 672 deletions
+2 -12
View File
@@ -229,20 +229,10 @@ impl ExecServerClient {
.map_err(Into::into)
}
pub async fn write(
&self,
process_id: &str,
chunk: Vec<u8>,
) -> Result<WriteResponse, ExecServerError> {
pub async fn write(&self, params: WriteParams) -> Result<WriteResponse, ExecServerError> {
self.inner
.client
.call(
EXEC_WRITE_METHOD,
&WriteParams {
process_id: process_id.to_string(),
chunk: chunk.into(),
},
)
.call(EXEC_WRITE_METHOD, &params)
.await
.map_err(Into::into)
}
+13 -2
View File
@@ -90,7 +90,10 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
async fn read_file(&self, path: &AbsolutePathBuf) -> crate::fs::FileSystemResult<Vec<u8>> {
let response = self
.client
.fs_read_file(codex_app_server_protocol::FsReadFileParams { path: path.clone() })
.fs_read_file(codex_app_server_protocol::FsReadFileParams {
environment_id: None,
path: path.clone(),
})
.await
.map_err(exec_server_error_to_io)?;
base64::engine::general_purpose::STANDARD
@@ -105,6 +108,7 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
) -> crate::fs::FileSystemResult<()> {
self.client
.fs_write_file(codex_app_server_protocol::FsWriteFileParams {
environment_id: None,
path: path.clone(),
data_base64: base64::engine::general_purpose::STANDARD.encode(contents),
})
@@ -120,6 +124,7 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
) -> crate::fs::FileSystemResult<()> {
self.client
.fs_create_directory(codex_app_server_protocol::FsCreateDirectoryParams {
environment_id: None,
path: path.clone(),
recursive: Some(options.recursive),
})
@@ -134,7 +139,10 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
) -> crate::fs::FileSystemResult<crate::fs::FileMetadata> {
let response = self
.client
.fs_get_metadata(codex_app_server_protocol::FsGetMetadataParams { path: path.clone() })
.fs_get_metadata(codex_app_server_protocol::FsGetMetadataParams {
environment_id: None,
path: path.clone(),
})
.await
.map_err(exec_server_error_to_io)?;
Ok(crate::fs::FileMetadata {
@@ -152,6 +160,7 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
let response = self
.client
.fs_read_directory(codex_app_server_protocol::FsReadDirectoryParams {
environment_id: None,
path: path.clone(),
})
.await
@@ -174,6 +183,7 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
) -> crate::fs::FileSystemResult<()> {
self.client
.fs_remove(codex_app_server_protocol::FsRemoveParams {
environment_id: None,
path: path.clone(),
recursive: Some(options.recursive),
force: Some(options.force),
@@ -191,6 +201,7 @@ impl ExecutorFileSystem for RemoteEnvironmentFileSystem {
) -> crate::fs::FileSystemResult<()> {
self.client
.fs_copy(codex_app_server_protocol::FsCopyParams {
environment_id: None,
source_path: source_path.clone(),
destination_path: destination_path.clone(),
recursive: options.recursive,
+11 -11
View File
@@ -185,6 +185,15 @@ impl LocalProcess {
TerminalSize::default(),
)
.await
} else if params.stdin {
codex_utils_pty::spawn_pipe_process(
program,
args,
params.cwd.as_path(),
&params.env,
&params.arg0,
)
.await
} else {
codex_utils_pty::spawn_pipe_process_no_stdin(
program,
@@ -472,17 +481,8 @@ impl ExecProcess for LocalProcess {
self.exec_read(params).await.map_err(map_handler_error)
}
async fn write(
&self,
process_id: &str,
chunk: Vec<u8>,
) -> Result<WriteResponse, ExecServerError> {
self.exec_write(WriteParams {
process_id: process_id.to_string(),
chunk: chunk.into(),
})
.await
.map_err(map_handler_error)
async fn write(&self, params: WriteParams) -> Result<WriteResponse, ExecServerError> {
self.exec_write(params).await.map_err(map_handler_error)
}
async fn resize(
+2 -5
View File
@@ -13,6 +13,7 @@ use crate::protocol::ExecWaitResponse;
use crate::protocol::ReadParams;
use crate::protocol::ReadResponse;
use crate::protocol::TerminateResponse;
use crate::protocol::WriteParams;
use crate::protocol::WriteResponse;
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -27,11 +28,7 @@ pub trait ExecProcess: Send + Sync {
async fn read(&self, params: ReadParams) -> Result<ReadResponse, ExecServerError>;
async fn write(
&self,
process_id: &str,
chunk: Vec<u8>,
) -> Result<WriteResponse, ExecServerError>;
async fn write(&self, params: WriteParams) -> Result<WriteResponse, ExecServerError>;
async fn resize(&self, params: ExecResizeParams)
-> Result<ExecResizeResponse, ExecServerError>;
+2
View File
@@ -62,6 +62,7 @@ pub struct ExecParams {
pub cwd: PathBuf,
pub env: HashMap<String, String>,
pub tty: bool,
pub stdin: bool,
pub arg0: Option<String>,
}
@@ -134,6 +135,7 @@ pub struct ReadResponse {
pub struct WriteParams {
pub process_id: String,
pub chunk: ByteChunk,
pub close_stdin: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+2 -3
View File
@@ -39,10 +39,9 @@ impl ExecProcess for RemoteProcess {
async fn write(
&self,
process_id: &str,
chunk: Vec<u8>,
params: crate::protocol::WriteParams,
) -> Result<WriteResponse, ExecServerError> {
self.client.write(process_id, chunk).await
self.client.write(params).await
}
async fn resize(
@@ -34,6 +34,7 @@ fn exec_params(process_id: &str) -> ExecParams {
cwd: std::env::current_dir().expect("cwd"),
env,
tty: false,
stdin: false,
arg0: None,
}
}
@@ -41,6 +42,7 @@ fn exec_params(process_id: &str) -> ExecParams {
fn tty_exec_params(process_id: &str) -> ExecParams {
let mut params = exec_params(process_id);
params.tty = true;
params.stdin = true;
params
}
@@ -47,6 +47,7 @@ async fn assert_exec_process_starts_and_exits(use_remote: bool) -> Result<()> {
cwd: std::env::current_dir()?,
env: Default::default(),
tty: false,
stdin: false,
arg0: None,
})
.await?;
+1
View File
@@ -42,6 +42,7 @@ async fn exec_server_starts_process_over_websocket() -> anyhow::Result<()> {
"cwd": std::env::current_dir()?,
"env": {},
"tty": false,
"stdin": false,
"arg0": null
}),
)