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

@@ -49,6 +49,7 @@ async fn permissions_message_sent_once_on_start() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello".into(),
text_elements: Vec::new(),
@@ -87,6 +88,7 @@ async fn permissions_message_added_on_override_change() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 1".into(),
text_elements: Vec::new(),
@@ -115,6 +117,7 @@ async fn permissions_message_added_on_override_change() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 2".into(),
text_elements: Vec::new(),
@@ -159,6 +162,7 @@ async fn permissions_message_not_added_when_no_change() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 1".into(),
text_elements: Vec::new(),
@@ -171,6 +175,7 @@ async fn permissions_message_not_added_when_no_change() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 2".into(),
text_elements: Vec::new(),
@@ -215,6 +220,7 @@ async fn permissions_message_omitted_when_disabled() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 1".into(),
text_elements: Vec::new(),
@@ -243,6 +249,7 @@ async fn permissions_message_omitted_when_disabled() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 2".into(),
text_elements: Vec::new(),
@@ -300,6 +307,7 @@ async fn resume_replays_permissions_messages() -> Result<()> {
initial
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 1".into(),
text_elements: Vec::new(),
@@ -330,6 +338,7 @@ async fn resume_replays_permissions_messages() -> Result<()> {
initial
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 2".into(),
text_elements: Vec::new(),
@@ -344,6 +353,7 @@ async fn resume_replays_permissions_messages() -> Result<()> {
resumed
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "after resume".into(),
text_elements: Vec::new(),
@@ -402,6 +412,7 @@ async fn resume_and_fork_append_permissions_messages() -> Result<()> {
initial
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 1".into(),
text_elements: Vec::new(),
@@ -432,6 +443,7 @@ async fn resume_and_fork_append_permissions_messages() -> Result<()> {
initial
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello 2".into(),
text_elements: Vec::new(),
@@ -452,6 +464,7 @@ async fn resume_and_fork_append_permissions_messages() -> Result<()> {
resumed
.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "after resume".into(),
text_elements: Vec::new(),
@@ -485,6 +498,7 @@ async fn resume_and_fork_append_permissions_messages() -> Result<()> {
forked
.thread
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "after fork".into(),
text_elements: Vec::new(),
@@ -538,6 +552,7 @@ async fn permissions_message_includes_writable_roots() -> Result<()> {
test.codex
.submit(Op::UserInput {
environments: None,
items: vec![UserInput::Text {
text: "hello".into(),
text_elements: Vec::new(),