Add turn-scoped environment selections (#18416)

## Summary
- add experimental turn/start.environments params for per-turn
environment id + cwd selections
- pass selections through core protocol ops and resolve them with
EnvironmentManager before TurnContext creation
- treat omitted selections as default behavior, empty selections as no
environment, and non-empty selections as first environment/cwd as the
turn primary

## Testing
- ran `just fmt`
- ran `just write-app-server-schema`
- not run: unit tests for this stacked PR

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-04-21 17:48:33 -07:00
committed by GitHub
Unverified
parent 6368f506b7
commit 1d4cc494c9
85 changed files with 974 additions and 35 deletions
+10 -1
View File
@@ -70,7 +70,7 @@ mod tests {
#[tokio::test]
async fn test_unix_executes_script_without_extension() -> Result<()> {
let env = TestExecutableEnv::new()?;
let mut cmd = Command::new(&env.program_name);
let mut cmd = Command::new(&env.executable_path);
cmd.envs(&env.mcp_env);
let output = cmd.output().await;
@@ -138,6 +138,8 @@ mod tests {
// Held to prevent the temporary directory from being deleted.
_temp_dir: TempDir,
program_name: String,
#[cfg(unix)]
executable_path: std::path::PathBuf,
mcp_env: HashMap<OsString, OsString>,
}
@@ -160,6 +162,8 @@ mod tests {
let mcp_env = create_env_for_mcp_server(Some(extra_env), &[])?;
Ok(Self {
#[cfg(unix)]
executable_path: Self::executable_path(dir_path),
_temp_dir: temp_dir,
program_name: Self::TEST_PROGRAM.to_string(),
mcp_env,
@@ -184,6 +188,11 @@ mod tests {
Ok(())
}
#[cfg(unix)]
fn executable_path(dir: &Path) -> std::path::PathBuf {
dir.join(Self::TEST_PROGRAM)
}
#[cfg(unix)]
fn set_executable(path: &Path) -> Result<()> {
use std::os::unix::fs::PermissionsExt;