app-server: preserve target-native environment cwd (#28146)

## Why

app-server may run on a different OS from the selected exec-server
environment. Parsing that environment’s cwd with the Codex host’s path
rules prevents thread startup.

## What

Carry environment cwd values as `LegacyAppPathString` at the app-server
boundary and `PathUri` internally. Existing tool-call schemas and
relative-path behavior stay host-native; remaining local-only consumers
convert explicitly and leave follow-up TODOs.

The Wine integration test verifies app-server can start a thread and
complete an ordinary turn with a Windows environment cwd from Linux.

## Validation

- `bazel test //codex-rs/core/tests/remote_env_windows:smoke-test
--test_output=errors`
- focused app-server environment-selection and protocol schema tests
- scoped Clippy for `codex-core` and `codex-app-server-protocol`
This commit is contained in:
Adam Perry @ OpenAI
2026-06-16 14:42:28 -07:00
committed by GitHub
Unverified
parent 33d50234a8
commit f8850cab1d
37 changed files with 346 additions and 208 deletions
+12 -2
View File
@@ -144,7 +144,18 @@ pub(crate) async fn execute_user_shell_command(
// We do not source rc files or otherwise reformat the script.
let use_login_shell = true;
let display_command = environment_shell.derive_exec_args(&command, use_login_shell);
let shell_snapshot_location = turn_environment.shell_snapshot(turn_environment.cwd());
// TODO(anp): Migrate user-shell events and execution plumbing to PathUri so this local-only
// feature does not need to project the selected environment cwd onto the Codex host.
let Ok(cwd) = turn_environment.cwd().to_abs_path() else {
send_user_shell_error(
&session,
turn_context.as_ref(),
"shell working directory is not native to the Codex host",
)
.await;
return;
};
let shell_snapshot_location = turn_environment.shell_snapshot(&cwd);
let mut exec_env_map = create_env(
&turn_context.shell_environment_policy,
Some(session.thread_id),
@@ -162,7 +173,6 @@ pub(crate) async fn execute_user_shell_command(
let call_id = Uuid::new_v4().to_string();
let raw_command = command;
let cwd = turn_environment.cwd().clone();
let parsed_cmd = parse_command(&display_command);
session