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
parent 6368f506b7
commit 1d4cc494c9
85 changed files with 974 additions and 35 deletions

View File

@@ -160,6 +160,7 @@ async fn assert_user_turn_local_image_resizes_to(
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::LocalImage {
path: abs_path.clone(),
}],
@@ -279,6 +280,7 @@ async fn view_image_tool_attaches_local_image() -> anyhow::Result<()> {
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please add the screenshot".into(),
text_elements: Vec::new(),
@@ -410,6 +412,7 @@ async fn view_image_tool_can_preserve_original_resolution_when_requested_on_gpt5
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please add the original screenshot".into(),
text_elements: Vec::new(),
@@ -509,6 +512,7 @@ async fn view_image_tool_errors_clearly_for_unsupported_detail_values() -> anyho
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please attach the image at low detail".into(),
text_elements: Vec::new(),
@@ -599,6 +603,7 @@ async fn view_image_tool_treats_null_detail_as_omitted() -> anyhow::Result<()> {
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please attach the image with a null detail".into(),
text_elements: Vec::new(),
@@ -699,6 +704,7 @@ async fn view_image_tool_resizes_when_model_lacks_original_detail_support() -> a
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please add the screenshot".into(),
text_elements: Vec::new(),
@@ -803,6 +809,7 @@ async fn view_image_tool_does_not_force_original_resolution_with_capability_only
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please add the screenshot".into(),
text_elements: Vec::new(),
@@ -905,6 +912,7 @@ await codex.emitImage(out);
let session_model = session_configured.model.clone();
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "use js_repl to write an image and attach it".into(),
text_elements: Vec::new(),
@@ -1025,6 +1033,7 @@ console.log(out.type);
let session_model = session_configured.model.clone();
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "use js_repl to write an image but do not emit it".into(),
text_elements: Vec::new(),
@@ -1118,6 +1127,7 @@ async fn view_image_tool_errors_when_path_is_directory() -> anyhow::Result<()> {
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please attach the folder".into(),
text_elements: Vec::new(),
@@ -1199,6 +1209,7 @@ async fn view_image_tool_errors_for_non_image_files() -> anyhow::Result<()> {
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please use the view_image tool to read the json file".into(),
text_elements: Vec::new(),
@@ -1285,6 +1296,7 @@ async fn view_image_tool_errors_when_file_missing() -> anyhow::Result<()> {
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please attach the missing image".into(),
text_elements: Vec::new(),
@@ -1422,6 +1434,7 @@ async fn view_image_tool_returns_unsupported_message_for_text_only_model() -> an
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::Text {
text: "please attach the image".into(),
text_elements: Vec::new(),
@@ -1503,6 +1516,7 @@ async fn replaces_invalid_local_image_after_bad_request() -> anyhow::Result<()>
codex
.submit(Op::UserTurn {
environments: None,
items: vec![UserInput::LocalImage {
path: abs_path.clone(),
}],