mirror of
https://github.com/openai/codex.git
synced 2026-04-25 23:24:55 +00:00
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:
@@ -35,6 +35,7 @@ use codex_protocol::protocol::RealtimeConversationVersion as RealtimeWsVersion;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
use codex_protocol::protocol::SessionConfiguredEvent;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
use codex_protocol::protocol::TurnEnvironmentSelection;
|
||||
use codex_protocol::user_input::UserInput;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use futures::future::BoxFuture;
|
||||
@@ -605,6 +606,7 @@ impl TestCodex {
|
||||
AskForApproval::Never,
|
||||
SandboxPolicy::DangerFullAccess,
|
||||
Some(service_tier),
|
||||
/*environments*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -620,6 +622,22 @@ impl TestCodex {
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
/*service_tier*/ None,
|
||||
/*environments*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_turn_with_environments(
|
||||
&self,
|
||||
prompt: &str,
|
||||
environments: Option<Vec<TurnEnvironmentSelection>>,
|
||||
) -> Result<()> {
|
||||
self.submit_turn_with_context(
|
||||
prompt,
|
||||
AskForApproval::Never,
|
||||
SandboxPolicy::DangerFullAccess,
|
||||
/*service_tier*/ None,
|
||||
environments,
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -630,10 +648,12 @@ impl TestCodex {
|
||||
approval_policy: AskForApproval,
|
||||
sandbox_policy: SandboxPolicy,
|
||||
service_tier: Option<Option<ServiceTier>>,
|
||||
environments: Option<Vec<TurnEnvironmentSelection>>,
|
||||
) -> Result<()> {
|
||||
let session_model = self.session_configured.model.clone();
|
||||
self.codex
|
||||
.submit(Op::UserTurn {
|
||||
environments,
|
||||
items: vec![UserInput::Text {
|
||||
text: prompt.into(),
|
||||
text_elements: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user