mirror of
https://github.com/openai/codex.git
synced 2026-11-09 00:39:32 +00:00
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:
1 parent
33d50234a8
commit
f8850cab1d
37 files changed
+346
-208
No files matched your search
@@ -97,7 +97,7 @@ impl ThreadEnvironments {
|
||||
}
|
||||
let turn_environment = match current.turn_environments.iter().find(|environment| {
|
||||
environment.environment_id == selected_environment.environment_id
|
||||
&& environment.cwd_uri() == &selected_environment.cwd
|
||||
&& environment.cwd() == &selected_environment.cwd
|
||||
}) {
|
||||
Some(environment) => environment.clone(),
|
||||
None => match Self::resolve_selection(
|
||||
@@ -157,12 +157,7 @@ impl ThreadEnvironments {
|
||||
let mut turn_environment = TurnEnvironment::new(
|
||||
environment_id,
|
||||
environment,
|
||||
selected_environment.cwd.to_abs_path().map_err(|err| {
|
||||
CodexErr::InvalidRequest(format!(
|
||||
"turn environment cwd `{}` is not valid on this host: {err}",
|
||||
selected_environment.cwd
|
||||
))
|
||||
})?,
|
||||
selected_environment.cwd.clone(),
|
||||
shell,
|
||||
);
|
||||
let task = shell_snapshot
|
||||
@@ -226,8 +221,10 @@ impl TurnEnvironmentSnapshot {
|
||||
(!environment.environment.is_remote()).then_some(environment)
|
||||
}
|
||||
|
||||
pub(crate) fn single_local_environment_cwd(&self) -> Option<&AbsolutePathBuf> {
|
||||
self.single_local_environment().map(TurnEnvironment::cwd)
|
||||
pub(crate) fn single_local_environment_cwd(&self) -> Option<AbsolutePathBuf> {
|
||||
// TODO(anp): Migrate local-environment consumers to PathUri so this compatibility
|
||||
// conversion can be removed.
|
||||
self.single_local_environment()?.cwd().to_abs_path().ok()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +557,7 @@ url = "ws://127.0.0.1:8765"
|
||||
Arc::clone(&local_manager),
|
||||
&[TurnEnvironmentSelection {
|
||||
environment_id: LOCAL_ENVIRONMENT_ID.to_string(),
|
||||
cwd: cwd_uri,
|
||||
cwd: cwd_uri.clone(),
|
||||
}],
|
||||
)
|
||||
.await;
|
||||
@@ -573,7 +570,7 @@ url = "ws://127.0.0.1:8765"
|
||||
turn_environments: vec![TurnEnvironment::new(
|
||||
REMOTE_ENVIRONMENT_ID.to_string(),
|
||||
remote_environment.clone(),
|
||||
cwd.clone(),
|
||||
cwd_uri.clone(),
|
||||
/*shell*/ None,
|
||||
)],
|
||||
};
|
||||
@@ -583,13 +580,13 @@ url = "ws://127.0.0.1:8765"
|
||||
TurnEnvironment::new(
|
||||
REMOTE_ENVIRONMENT_ID.to_string(),
|
||||
remote_environment,
|
||||
cwd.clone(),
|
||||
cwd_uri,
|
||||
/*shell*/ None,
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
assert_eq!(local.single_local_environment_cwd(), Some(&cwd));
|
||||
assert_eq!(local.single_local_environment_cwd(), Some(cwd));
|
||||
assert_eq!(remote.single_local_environment_cwd(), None);
|
||||
assert_eq!(multiple.single_local_environment_cwd(), None);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user