Make local environment optional in EnvironmentManager (#23369)

## Summary
- make `EnvironmentManager` local environment/runtime paths optional
- simplify constructor surface around snapshot materialization
- rename local env accessors to `require_local_environment` /
`try_local_environment`

## Validation
- devbox Bazel build for touched crate surfaces
- `//codex-rs/exec-server:exec-server-unit-tests`
- `//codex-rs/app-server-client:app-server-client-unit-tests`
- filtered touched `//codex-rs/core:core-unit-tests` cases
This commit is contained in:
starr-openai authored and GitHub committed 2026-05-19 12:55:34 -07:00
1 parent 7f4d7ae3a4
commit 5c43a64e2b
26 files changed
+853 -298

No files matched your search

+4 -4
View File
@@ -852,9 +852,9 @@ pub async fn run_main(
)?;
let environment_manager =
if should_load_configured_environments(&loader_overrides, &app_server_target) {
EnvironmentManager::from_codex_home(codex_home.clone(), local_runtime_paths).await
EnvironmentManager::from_codex_home(codex_home.clone(), Some(local_runtime_paths)).await
} else {
EnvironmentManager::from_env(local_runtime_paths).await
EnvironmentManager::from_env(Some(local_runtime_paths)).await
}
.map(Arc::new)
.map_err(std::io::Error::other)?;
@@ -2291,10 +2291,10 @@ mod tests {
let target = AppServerTarget::Embedded;
let environment_manager = EnvironmentManager::create_for_tests(
Some("ws://127.0.0.1:8765".to_string()),
ExecServerRuntimePaths::new(
Some(ExecServerRuntimePaths::new(
std::env::current_exe().expect("current exe"),
/*codex_linux_sandbox_exe*/ None,
)?,
)?),
)
.await;