[codex] Carry exec-server cwd as PathUri (#28032)

## Why

This is the second-to-last place in the exec-server protocol that needs
to migrate to URIs to support cross-OS operation.

## What

- Change `ExecParams.cwd` to `PathUri`.
- Keep the cwd URI-shaped through core and rmcp producers, converting it
to `AbsolutePathBuf` only in `LocalProcess::start_process`.
- Reject non-native cwd URIs before launch and update the affected
protocol documentation and call sites.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-13 20:56:42 +00:00
committed by GitHub
parent 17586d80ee
commit 0fed4497f5
13 changed files with 84 additions and 85 deletions
+13 -12
View File
@@ -15,6 +15,7 @@ use codex_exec_server::ProcessSignal;
use codex_exec_server::ReadResponse;
use codex_exec_server::StartedExecProcess;
use codex_exec_server::WriteStatus;
use codex_utils_path_uri::PathUri;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use test_case::test_case;
@@ -72,7 +73,7 @@ async fn assert_exec_process_starts_and_exits(use_remote: bool) -> Result<()> {
.start(ExecParams {
process_id: ProcessId::from("proc-1"),
argv: vec!["true".to_string()],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -213,7 +214,7 @@ async fn assert_exec_process_streams_output(use_remote: bool) -> Result<()> {
"-c".to_string(),
"sleep 0.05; printf 'session output\\n'".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -244,7 +245,7 @@ async fn assert_exec_process_pushes_events(use_remote: bool) -> Result<()> {
"-c".to_string(),
"printf 'event output\\n'; sleep 0.1; printf 'event err\\n' >&2; sleep 0.1; exit 7".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -291,7 +292,7 @@ async fn assert_exec_process_replays_events_after_close(use_remote: bool) -> Res
"-c".to_string(),
"printf 'late one\\n'; printf 'late two\\n'".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -339,7 +340,7 @@ async fn assert_exec_process_retains_output_after_exit_until_streams_close(
DELAYED_OUTPUT_AFTER_EXIT_PARENT_ARG.to_string(),
release_path.to_string_lossy().into_owned(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -412,7 +413,7 @@ async fn assert_exec_process_write_then_read(use_remote: bool) -> Result<()> {
"-c".to_string(),
"IFS= read line; printf 'from-stdin:%s\\n' \"$line\"".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: true,
@@ -449,7 +450,7 @@ async fn assert_exec_process_write_then_read_without_tty(use_remote: bool) -> Re
"-c".to_string(),
"IFS= read line; printf 'from-stdin:%s\\n' \"$line\"".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -482,7 +483,7 @@ async fn assert_exec_process_rejects_write_without_pipe_stdin(use_remote: bool)
"-c".to_string(),
"sleep 0.3; if IFS= read -r line; then printf 'read:%s\\n' \"$line\"; else printf 'eof\\n'; fi".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -516,7 +517,7 @@ async fn assert_exec_process_signal_interrupts_process(use_remote: bool) -> Resu
"-c".to_string(),
"trap 'printf \"signal:2\\n\"; exit 7' INT; printf 'ready\\n'; while :; do :; done".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -569,7 +570,7 @@ async fn assert_exec_process_signal_reports_unsupported_on_windows(use_remote: b
"/C".to_string(),
"echo ready && ping -n 30 127.0.0.1 >NUL".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -609,7 +610,7 @@ async fn assert_exec_process_preserves_queued_events_before_subscribe(
"-c".to_string(),
"printf 'queued output\\n'".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,
@@ -644,7 +645,7 @@ async fn remote_exec_process_reports_transport_disconnect() -> Result<()> {
"-c".to_string(),
"sleep 10".to_string(),
],
cwd: std::env::current_dir()?,
cwd: PathUri::from_path(std::env::current_dir()?)?,
env_policy: /*env_policy*/ None,
env: Default::default(),
tty: false,