Skip to content

Split exec process into local and remote implementations#15233

Merged
starr-openai merged 5 commits intomainfrom
starr/exec-process-traits-20260319
Mar 20, 2026
Merged

Split exec process into local and remote implementations#15233
starr-openai merged 5 commits intomainfrom
starr/exec-process-traits-20260319

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented Mar 19, 2026

Summary

  • match the exec-process structure to filesystem PR Refactor ExecServer filesystem split between local and remote #15232
  • expose ExecProcess on Environment
  • make LocalProcess the real implementation and RemoteProcess a thin network proxy over ExecServerClient
  • make ProcessHandler a thin RPC adapter delegating to LocalProcess
  • add a shared local/remote process test

Validation

  • just fmt
  • CARGO_TARGET_DIR=~/.cache/cargo-target/codex cargo test -p codex-exec-server
  • just fix -p codex-exec-server
@starr-openai starr-openai changed the title Add async Environment executor seam Mar 19, 2026
@starr-openai starr-openai force-pushed the starr/exec-process-traits-20260319 branch from b0b16a2 to 7723b54 Compare March 19, 2026 23:46
@starr-openai starr-openai changed the base branch from main to pakrym/compare-execserverfilesystem-and March 19, 2026 23:54
pub struct Environment {
experimental_exec_server_url: Option<String>,
remote_exec_server_client: Option<ExecServerClient>,
executor: Arc<dyn ExecProcess>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we Arc the Environment instead?


impl ExecutorEnvironment for Environment {
fn get_executor(&self) -> Arc<dyn ExecProcess> {
self.get_executor()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just inline the impl?


pub fn remote_exec_server_client(&self) -> Option<&ExecServerClient> {
self.remote_exec_server_client.as_ref()
pub fn remote_exec_server_client(&self) -> Option<ExecServerClient> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be public?

}
}

pub(crate) fn initialize(&self) -> Result<InitializeResponse, JSONRPCErrorError> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this on local?


#[derive(Clone)]
pub(crate) struct LocalProcess {
inner: Arc<Inner>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already Arc the LocalProcess impl in Environment. Is there anything we can un-Arc?

}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn exec_process_starts_and_exits_locally() -> Result<()> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MOAR!

(later)

also use test_case

Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean!

Base automatically changed from pakrym/compare-execserverfilesystem-and to main March 20, 2026 00:08
starr-openai and others added 5 commits March 19, 2026 17:11
Stack this on top of PR #15232's filesystem split: expose the process trait on Environment, keep LocalProcess as the real implementation, proxy RemoteProcess over ExecServerClient, and route RPCs through a thin ProcessHandler.

Co-authored-by: Codex <noreply@openai.com>
Keep Environment::default() and Environment::create(None) behavior aligned by making the default local executor ready to use immediately, and cover it with a regression test.

Co-authored-by: Codex <noreply@openai.com>
Address clippy's expect-used warning in the local Environment::default() initialization path without changing behavior.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/exec-process-traits-20260319 branch from dcef8bc to 25585b9 Compare March 20, 2026 00:12
@starr-openai starr-openai enabled auto-merge (squash) March 20, 2026 02:45
@starr-openai starr-openai merged commit 96a8671 into main Mar 20, 2026
56 of 60 checks passed
@starr-openai starr-openai deleted the starr/exec-process-traits-20260319 branch March 20, 2026 03:13
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants