From ec691513987aa7147527ba38604f78e25adddbf0 Mon Sep 17 00:00:00 2001 From: evan-oai Date: Wed, 29 Apr 2026 14:50:40 -0700 Subject: [PATCH] Scope remote execution analytics to threads --- .../analytics/src/analytics_client_tests.rs | 179 +++--------------- codex-rs/analytics/src/events.rs | 8 +- codex-rs/analytics/src/reducer.rs | 34 +--- .../schema/json/ClientRequest.json | 12 +- .../codex_app_server_protocol.schemas.json | 12 +- .../codex_app_server_protocol.v2.schemas.json | 12 +- .../schema/json/v2/ThreadForkParams.json | 2 +- .../schema/json/v2/ThreadResumeParams.json | 2 +- .../schema/json/v2/ThreadStartParams.json | 12 +- .../schema/json/v2/TurnStartParams.json | 6 - .../schema/json/v2/TurnSteerParams.json | 6 - ...nment.ts => ThreadExecutionEnvironment.ts} | 2 +- .../schema/typescript/v2/index.ts | 2 +- .../app-server-protocol/src/protocol/v2.rs | 17 +- .../src/message_processor/tracing_tests.rs | 1 - .../tests/suite/v2/client_metadata.rs | 1 - .../app-server/tests/suite/v2/turn_steer.rs | 3 - codex-rs/exec/src/lib.rs | 1 - codex-rs/tui/src/app_server_session.rs | 2 - 19 files changed, 67 insertions(+), 247 deletions(-) rename codex-rs/app-server-protocol/schema/typescript/v2/{TurnExecutionEnvironment.ts => ThreadExecutionEnvironment.ts} (75%) diff --git a/codex-rs/analytics/src/analytics_client_tests.rs b/codex-rs/analytics/src/analytics_client_tests.rs index 0c0113c458..1e35d1f9e9 100644 --- a/codex-rs/analytics/src/analytics_client_tests.rs +++ b/codex-rs/analytics/src/analytics_client_tests.rs @@ -71,6 +71,7 @@ use codex_app_server_protocol::SandboxPolicy as AppServerSandboxPolicy; use codex_app_server_protocol::ServerNotification; use codex_app_server_protocol::SessionSource as AppServerSessionSource; use codex_app_server_protocol::Thread; +use codex_app_server_protocol::ThreadExecutionEnvironment; use codex_app_server_protocol::ThreadResumeResponse; use codex_app_server_protocol::ThreadStartParams; use codex_app_server_protocol::ThreadStartResponse; @@ -78,7 +79,6 @@ use codex_app_server_protocol::ThreadStatus as AppServerThreadStatus; use codex_app_server_protocol::Turn; use codex_app_server_protocol::TurnCompletedNotification; use codex_app_server_protocol::TurnError as AppServerTurnError; -use codex_app_server_protocol::TurnExecutionEnvironment; use codex_app_server_protocol::TurnStartParams; use codex_app_server_protocol::TurnStartedNotification; use codex_app_server_protocol::TurnStatus as AppServerTurnStatus; @@ -219,14 +219,6 @@ fn sample_thread_resume_response_with_source( } fn sample_turn_start_request(thread_id: &str, request_id: i64) -> ClientRequest { - sample_turn_start_request_with_execution_environment(thread_id, request_id, None) -} - -fn sample_turn_start_request_with_execution_environment( - thread_id: &str, - request_id: i64, - execution_environment: Option, -) -> ClientRequest { ClientRequest::TurnStart { request_id: RequestId::Integer(request_id), params: TurnStartParams { @@ -240,7 +232,6 @@ fn sample_turn_start_request_with_execution_environment( url: "https://example.com/a.png".to_string(), }, ], - execution_environment, ..Default::default() }, } @@ -346,20 +337,6 @@ fn sample_turn_steer_request( thread_id: &str, expected_turn_id: &str, request_id: i64, -) -> ClientRequest { - sample_turn_steer_request_with_execution_environment( - thread_id, - expected_turn_id, - request_id, - None, - ) -} - -fn sample_turn_steer_request_with_execution_environment( - thread_id: &str, - expected_turn_id: &str, - request_id: i64, - execution_environment: Option, ) -> ClientRequest { ClientRequest::TurnSteer { request_id: RequestId::Integer(request_id), @@ -376,7 +353,6 @@ fn sample_turn_steer_request_with_execution_environment( }, ], responsesapi_client_metadata: None, - execution_environment, }, } } @@ -503,7 +479,7 @@ async fn ingest_initialize(reducer: &mut AnalyticsReducer, out: &mut Vec, - execution_environment: Option, + execution_environment: Option, ) { reducer .ingest( @@ -878,7 +854,7 @@ fn thread_initialized_event_serializes_expected_shape() { initialization_mode: ThreadInitializationMode::New, subagent_source: None, parent_thread_id: None, - execution_environment: Some(TurnExecutionEnvironment::Remote), + execution_environment: Some(ThreadExecutionEnvironment::Remote), created_at: 1, }, }); @@ -1016,27 +992,6 @@ async fn initialize_caches_client_and_thread_lifecycle_publishes_once_initialize ); } -#[tokio::test] -async fn thread_start_execution_environment_flows_to_thread_initialized_event() { - let mut reducer = AnalyticsReducer::default(); - let mut out = Vec::new(); - - ingest_initialize(&mut reducer, &mut out).await; - ingest_thread_start_with_execution_environment( - &mut reducer, - &mut out, - Some(TurnExecutionEnvironment::Remote), - ) - .await; - - let payload = serde_json::to_value(&out[0]).expect("serialize thread event"); - assert_eq!(payload["event_type"], json!("codex_thread_initialized")); - assert_eq!( - payload["event_params"]["execution_environment"], - json!("remote") - ); -} - #[tokio::test] async fn compaction_event_ingests_custom_fact() { let mut reducer = AnalyticsReducer::default(); @@ -1833,7 +1788,7 @@ fn turn_event_serializes_expected_shape() { initialization_mode: ThreadInitializationMode::New, subagent_source: None, parent_thread_id: None, - execution_environment: Some(TurnExecutionEnvironment::Remote), + execution_environment: Some(ThreadExecutionEnvironment::Remote), model: Some("gpt-5".to_string()), model_provider: "openai".to_string(), sandbox_policy: Some("read_only"), @@ -2231,76 +2186,7 @@ async fn turn_lifecycle_emits_turn_event() { } #[tokio::test] -async fn turn_start_execution_environment_flows_to_turn_event() { - let mut reducer = AnalyticsReducer::default(); - let mut out = Vec::new(); - - ingest_initialize(&mut reducer, &mut out).await; - reducer - .ingest( - AnalyticsFact::ClientResponse { - connection_id: 7, - response: Box::new(sample_thread_start_response( - "thread-2", /*ephemeral*/ false, "gpt-5", - )), - }, - &mut out, - ) - .await; - out.clear(); - - reducer - .ingest( - AnalyticsFact::ClientRequest { - connection_id: 7, - request_id: RequestId::Integer(3), - request: Box::new(sample_turn_start_request_with_execution_environment( - "thread-2", - /*request_id*/ 3, - Some(TurnExecutionEnvironment::Remote), - )), - }, - &mut out, - ) - .await; - reducer - .ingest( - AnalyticsFact::ClientResponse { - connection_id: 7, - response: Box::new(sample_turn_start_response("turn-2", /*request_id*/ 3)), - }, - &mut out, - ) - .await; - reducer - .ingest( - AnalyticsFact::Custom(CustomAnalyticsFact::TurnResolvedConfig(Box::new( - sample_turn_resolved_config("turn-2"), - ))), - &mut out, - ) - .await; - reducer - .ingest( - AnalyticsFact::Notification(Box::new(sample_turn_completed_notification( - "thread-2", - "turn-2", - AppServerTurnStatus::Completed, - /*codex_error_info*/ None, - ))), - &mut out, - ) - .await; - - let payload = serde_json::to_value(&out[0]).expect("serialize turn event"); - assert_eq!( - payload["event_params"]["execution_environment"], - json!("remote") - ); -} - -#[tokio::test] -async fn thread_execution_environment_flows_to_turn_and_steer_events() { +async fn thread_execution_environment_flows_to_thread_turn_and_steer_events() { let mut reducer = AnalyticsReducer::default(); let mut out = Vec::new(); @@ -2308,38 +2194,26 @@ async fn thread_execution_environment_flows_to_turn_and_steer_events() { ingest_thread_start_with_execution_environment( &mut reducer, &mut out, - Some(TurnExecutionEnvironment::Remote), + Some(ThreadExecutionEnvironment::Remote), ) .await; + + let thread_payload = serde_json::to_value(&out[0]).expect("serialize thread event"); + assert_eq!( + thread_payload["event_params"]["execution_environment"], + json!("remote") + ); out.clear(); - reducer - .ingest( - AnalyticsFact::ClientRequest { - connection_id: 7, - request_id: RequestId::Integer(3), - request: Box::new(sample_turn_start_request("thread-2", /*request_id*/ 3)), - }, - &mut out, - ) - .await; - reducer - .ingest( - AnalyticsFact::ClientResponse { - connection_id: 7, - response: Box::new(sample_turn_start_response("turn-2", /*request_id*/ 3)), - }, - &mut out, - ) - .await; - reducer - .ingest( - AnalyticsFact::Custom(CustomAnalyticsFact::TurnResolvedConfig(Box::new( - sample_turn_resolved_config("turn-2"), - ))), - &mut out, - ) - .await; + ingest_turn_prerequisites( + &mut reducer, + &mut out, + /*include_initialize*/ false, + /*include_resolved_config*/ true, + /*include_started*/ false, + /*include_token_usage*/ false, + ) + .await; reducer .ingest( AnalyticsFact::ClientRequest { @@ -2415,11 +2289,8 @@ async fn accepted_steers_increment_turn_steer_count() { AnalyticsFact::ClientRequest { connection_id: 7, request_id: RequestId::Integer(4), - request: Box::new(sample_turn_steer_request_with_execution_environment( - "thread-2", - "turn-2", - /*request_id*/ 4, - Some(TurnExecutionEnvironment::Remote), + request: Box::new(sample_turn_steer_request( + "thread-2", "turn-2", /*request_id*/ 4, )), }, &mut out, @@ -2498,10 +2369,6 @@ async fn accepted_steers_increment_turn_steer_count() { .find(|event| matches!(event, TrackEventRequest::TurnEvent(_))) .expect("turn event should be emitted"); let payload = serde_json::to_value(turn_event).expect("serialize turn event"); - assert_eq!( - payload["event_params"]["execution_environment"], - json!("remote") - ); assert_eq!(payload["event_params"]["steer_count"], json!(2)); } diff --git a/codex-rs/analytics/src/events.rs b/codex-rs/analytics/src/events.rs index ad051a2aa9..b850033d09 100644 --- a/codex-rs/analytics/src/events.rs +++ b/codex-rs/analytics/src/events.rs @@ -20,7 +20,7 @@ use crate::facts::TurnSteerResult; use crate::facts::TurnSubmissionType; use crate::now_unix_seconds; use codex_app_server_protocol::CodexErrorInfo; -use codex_app_server_protocol::TurnExecutionEnvironment; +use codex_app_server_protocol::ThreadExecutionEnvironment; use codex_login::default_client::originator; use codex_plugin::PluginTelemetryMetadata; use codex_protocol::approvals::NetworkApprovalProtocol; @@ -115,7 +115,7 @@ pub(crate) struct ThreadInitializedEventParams { pub(crate) initialization_mode: ThreadInitializationMode, pub(crate) subagent_source: Option, pub(crate) parent_thread_id: Option, - pub(crate) execution_environment: Option, + pub(crate) execution_environment: Option, pub(crate) created_at: u64, } @@ -468,7 +468,7 @@ pub(crate) struct CodexTurnEventParams { pub(crate) initialization_mode: ThreadInitializationMode, pub(crate) subagent_source: Option, pub(crate) parent_thread_id: Option, - pub(crate) execution_environment: Option, + pub(crate) execution_environment: Option, pub(crate) model: Option, pub(crate) model_provider: String, pub(crate) sandbox_policy: Option<&'static str>, @@ -521,7 +521,7 @@ pub(crate) struct CodexTurnSteerEventParams { pub(crate) thread_source: Option, pub(crate) subagent_source: Option, pub(crate) parent_thread_id: Option, - pub(crate) execution_environment: Option, + pub(crate) execution_environment: Option, pub(crate) num_input_images: usize, pub(crate) result: TurnSteerResult, pub(crate) rejection_reason: Option, diff --git a/codex-rs/analytics/src/reducer.rs b/codex-rs/analytics/src/reducer.rs index de84fffa13..5b3a31e9f0 100644 --- a/codex-rs/analytics/src/reducer.rs +++ b/codex-rs/analytics/src/reducer.rs @@ -53,7 +53,7 @@ use codex_app_server_protocol::CodexErrorInfo; use codex_app_server_protocol::InitializeParams; use codex_app_server_protocol::RequestId; use codex_app_server_protocol::ServerNotification; -use codex_app_server_protocol::TurnExecutionEnvironment; +use codex_app_server_protocol::ThreadExecutionEnvironment; use codex_app_server_protocol::TurnSteerResponse; use codex_app_server_protocol::UserInput; use codex_git_utils::collect_git_info; @@ -90,14 +90,14 @@ struct ThreadMetadataState { initialization_mode: ThreadInitializationMode, subagent_source: Option, parent_thread_id: Option, - execution_environment: Option, + execution_environment: Option, } impl ThreadMetadataState { fn from_thread_metadata( session_source: &SessionSource, initialization_mode: ThreadInitializationMode, - execution_environment: Option, + execution_environment: Option, ) -> Self { let (subagent_source, parent_thread_id) = match session_source { SessionSource::SubAgent(subagent_source) => ( @@ -129,20 +129,18 @@ enum RequestState { } struct PendingThreadInitializedState { - execution_environment: Option, + execution_environment: Option, } struct PendingTurnStartState { thread_id: String, num_input_images: usize, - execution_environment: Option, } struct PendingTurnSteerState { thread_id: String, expected_turn_id: String, num_input_images: usize, - execution_environment: Option, created_at: u64, } @@ -159,7 +157,6 @@ struct TurnState { thread_id: Option, num_input_images: Option, resolved_config: Option, - execution_environment: Option, started_at: Option, token_usage: Option, completed: Option, @@ -361,7 +358,6 @@ impl AnalyticsReducer { RequestState::TurnStart(PendingTurnStartState { thread_id: params.thread_id, num_input_images: num_input_images(¶ms.input), - execution_environment: params.execution_environment, }), ); } @@ -372,7 +368,6 @@ impl AnalyticsReducer { thread_id: params.thread_id, expected_turn_id: params.expected_turn_id, num_input_images: num_input_images(¶ms.input), - execution_environment: params.execution_environment, created_at: now_unix_seconds(), }), ); @@ -394,7 +389,6 @@ impl AnalyticsReducer { thread_id: None, num_input_images: None, resolved_config: None, - execution_environment: None, started_at: None, token_usage: None, completed: None, @@ -417,7 +411,6 @@ impl AnalyticsReducer { thread_id: None, num_input_images: None, resolved_config: None, - execution_environment: None, started_at: None, token_usage: None, completed: None, @@ -597,7 +590,6 @@ impl AnalyticsReducer { thread_id: None, num_input_images: None, resolved_config: None, - execution_environment: None, started_at: None, token_usage: None, completed: None, @@ -606,7 +598,6 @@ impl AnalyticsReducer { turn_state.connection_id = Some(connection_id); turn_state.thread_id = Some(pending_request.thread_id); turn_state.num_input_images = Some(pending_request.num_input_images); - turn_state.execution_environment = pending_request.execution_environment; self.maybe_emit_turn_event(&turn_id, out); } ClientResponse::TurnSteer { @@ -682,7 +673,6 @@ impl AnalyticsReducer { thread_id: None, num_input_images: None, resolved_config: None, - execution_environment: None, started_at: None, token_usage: None, completed: None, @@ -702,7 +692,6 @@ impl AnalyticsReducer { thread_id: None, num_input_images: None, resolved_config: None, - execution_environment: None, started_at: None, token_usage: None, completed: None, @@ -737,7 +726,7 @@ impl AnalyticsReducer { thread: codex_app_server_protocol::Thread, model: String, initialization_mode: ThreadInitializationMode, - execution_environment: Option, + execution_environment: Option, out: &mut Vec, ) { let thread_source: SessionSource = thread.source.into(); @@ -778,7 +767,7 @@ impl AnalyticsReducer { &mut self, connection_id: u64, request_id: RequestId, - ) -> Option { + ) -> Option { match self.requests.remove(&(connection_id, request_id)) { Some(RequestState::ThreadInitialized(pending_request)) => { pending_request.execution_environment @@ -841,9 +830,6 @@ impl AnalyticsReducer { return; }; if let Some(turn_state) = self.turns.get_mut(&response.turn_id) { - if pending_request.execution_environment.is_some() { - turn_state.execution_environment = pending_request.execution_environment; - } turn_state.steer_count += 1; } self.emit_turn_steer_event( @@ -886,9 +872,7 @@ impl AnalyticsReducer { thread_source: thread_metadata.thread_source.map(str::to_string), subagent_source: thread_metadata.subagent_source.clone(), parent_thread_id: thread_metadata.parent_thread_id.clone(), - execution_environment: pending_request - .execution_environment - .or(thread_metadata.execution_environment), + execution_environment: thread_metadata.execution_environment, num_input_images: pending_request.num_input_images, result, rejection_reason, @@ -1003,9 +987,7 @@ fn codex_turn_event_params( initialization_mode: thread_metadata.initialization_mode, subagent_source: thread_metadata.subagent_source.clone(), parent_thread_id: thread_metadata.parent_thread_id.clone(), - execution_environment: turn_state - .execution_environment - .or(thread_metadata.execution_environment), + execution_environment: thread_metadata.execution_environment, model: Some(model), model_provider, sandbox_policy: Some(sandbox_policy_mode( diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index d288edfe33..2dba847bb2 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -3296,6 +3296,12 @@ ], "type": "object" }, + "ThreadExecutionEnvironment": { + "enum": [ + "remote" + ], + "type": "string" + }, "ThreadForkParams": { "description": "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using path, the thread_id param will be ignored.\n\nPrefer using thread_id whenever possible.", "properties": { @@ -4091,12 +4097,6 @@ ], "type": "object" }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" - }, "TurnInterruptParams": { "properties": { "threadId": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 4099082a9d..2b8800d204 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -14564,6 +14564,12 @@ "title": "ThreadCompactStartResponse", "type": "object" }, + "ThreadExecutionEnvironment": { + "enum": [ + "remote" + ], + "type": "string" + }, "ThreadForkParams": { "$schema": "http://json-schema.org/draft-07/schema#", "description": "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using path, the thread_id param will be ignored.\n\nPrefer using thread_id whenever possible.", @@ -17088,12 +17094,6 @@ ], "type": "object" }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" - }, "TurnInterruptParams": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index 9715107603..b39367fcb1 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -12450,6 +12450,12 @@ "title": "ThreadCompactStartResponse", "type": "object" }, + "ThreadExecutionEnvironment": { + "enum": [ + "remote" + ], + "type": "string" + }, "ThreadForkParams": { "$schema": "http://json-schema.org/draft-07/schema#", "description": "There are two ways to fork a thread: 1. By thread_id: load the thread from disk by thread_id and fork it into a new thread. 2. By path: load the thread from disk by path and fork it into a new thread.\n\nIf using path, the thread_id param will be ignored.\n\nPrefer using thread_id whenever possible.", @@ -14974,12 +14980,6 @@ ], "type": "object" }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" - }, "TurnInterruptParams": { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json index e95d5aa1b8..b57349200b 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadForkParams.json @@ -404,7 +404,7 @@ ], "type": "string" }, - "TurnExecutionEnvironment": { + "ThreadExecutionEnvironment": { "enum": [ "remote" ], diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json index c8483e6362..c5dadf4dc8 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadResumeParams.json @@ -1262,7 +1262,7 @@ ], "type": "string" }, - "TurnExecutionEnvironment": { + "ThreadExecutionEnvironment": { "enum": [ "remote" ], diff --git a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json index 6954030fcc..4dc535dd95 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/ThreadStartParams.json @@ -438,6 +438,12 @@ ], "type": "string" }, + "ThreadExecutionEnvironment": { + "enum": [ + "remote" + ], + "type": "string" + }, "ThreadStartSource": { "enum": [ "startup", @@ -459,12 +465,6 @@ "environmentId" ], "type": "object" - }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" } }, "properties": { diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json index 1b4ecfe058..719a1bedc8 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnStartParams.json @@ -651,12 +651,6 @@ ], "type": "object" }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" - }, "UserInput": { "oneOf": [ { diff --git a/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json b/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json index 76f9b71f4e..a064d9e7e3 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/TurnSteerParams.json @@ -43,12 +43,6 @@ ], "type": "object" }, - "TurnExecutionEnvironment": { - "enum": [ - "remote" - ], - "type": "string" - }, "UserInput": { "oneOf": [ { diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/TurnExecutionEnvironment.ts b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadExecutionEnvironment.ts similarity index 75% rename from codex-rs/app-server-protocol/schema/typescript/v2/TurnExecutionEnvironment.ts rename to codex-rs/app-server-protocol/schema/typescript/v2/ThreadExecutionEnvironment.ts index bd826fffa0..42320d4fea 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/TurnExecutionEnvironment.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/ThreadExecutionEnvironment.ts @@ -2,4 +2,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type TurnExecutionEnvironment = "remote"; +export type ThreadExecutionEnvironment = "remote"; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts index 0d29566454..cf062314de 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/index.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/index.ts @@ -333,6 +333,7 @@ export type { ThreadArchivedNotification } from "./ThreadArchivedNotification"; export type { ThreadClosedNotification } from "./ThreadClosedNotification"; export type { ThreadCompactStartParams } from "./ThreadCompactStartParams"; export type { ThreadCompactStartResponse } from "./ThreadCompactStartResponse"; +export type { ThreadExecutionEnvironment } from "./ThreadExecutionEnvironment"; export type { ThreadForkParams } from "./ThreadForkParams"; export type { ThreadForkResponse } from "./ThreadForkResponse"; export type { ThreadGoal } from "./ThreadGoal"; @@ -400,7 +401,6 @@ export type { TurnCompletedNotification } from "./TurnCompletedNotification"; export type { TurnDiffUpdatedNotification } from "./TurnDiffUpdatedNotification"; export type { TurnEnvironmentParams } from "./TurnEnvironmentParams"; export type { TurnError } from "./TurnError"; -export type { TurnExecutionEnvironment } from "./TurnExecutionEnvironment"; export type { TurnInterruptParams } from "./TurnInterruptParams"; export type { TurnInterruptResponse } from "./TurnInterruptResponse"; export type { TurnPlanStep } from "./TurnPlanStep"; diff --git a/codex-rs/app-server-protocol/src/protocol/v2.rs b/codex-rs/app-server-protocol/src/protocol/v2.rs index b1488af90c..3d1dda125c 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -3481,7 +3481,7 @@ pub struct ThreadStartParams { /// Optional thread-scoped execution environment. #[experimental("thread/start.executionEnvironment")] #[ts(optional = nullable)] - pub execution_environment: Option, + pub execution_environment: Option, /// Optional sticky environments for this thread. /// /// Omitted selects the default environment when environment access is @@ -3630,7 +3630,7 @@ pub struct ThreadResumeParams { /// Optional thread-scoped execution environment. #[experimental("thread/resume.executionEnvironment")] #[ts(optional = nullable)] - pub execution_environment: Option, + pub execution_environment: Option, /// If true, persist additional rollout EventMsg variants required to /// reconstruct a richer thread history on subsequent resume/fork/read. #[experimental("thread/resume.persistFullHistory")] @@ -3731,7 +3731,7 @@ pub struct ThreadForkParams { /// Optional thread-scoped execution environment. #[experimental("thread/fork.executionEnvironment")] #[ts(optional = nullable)] - pub execution_environment: Option, + pub execution_environment: Option, /// If true, persist additional rollout EventMsg variants required to /// reconstruct a richer thread history on subsequent resume/fork/read. #[experimental("thread/fork.persistFullHistory")] @@ -5266,7 +5266,7 @@ pub struct TurnEnvironmentParams { #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] #[serde(rename_all = "snake_case")] #[ts(rename_all = "snake_case", export_to = "v2/")] -pub enum TurnExecutionEnvironment { +pub enum ThreadExecutionEnvironment { Remote, } @@ -5282,10 +5282,6 @@ pub struct TurnStartParams { #[experimental("turn/start.responsesapiClientMetadata")] #[ts(optional = nullable)] pub responsesapi_client_metadata: Option>, - /// Optional turn-scoped execution environment. - #[experimental("turn/start.executionEnvironment")] - #[ts(optional = nullable)] - pub execution_environment: Option, /// Optional turn-scoped environments. /// /// Omitted uses the thread sticky environments. Empty disables @@ -5435,10 +5431,6 @@ pub struct TurnSteerParams { #[experimental("turn/steer.responsesapiClientMetadata")] #[ts(optional = nullable)] pub responsesapi_client_metadata: Option>, - /// Optional turn-scoped execution environment. - #[experimental("turn/steer.executionEnvironment")] - #[ts(optional = nullable)] - pub execution_environment: Option, /// Required active turn id precondition. The request fails when it does not /// match the currently active turn. pub expected_turn_id: String, @@ -10786,7 +10778,6 @@ mod tests { thread_id: "thread_123".to_string(), input: vec![], responsesapi_client_metadata: None, - execution_environment: None, environments: None, cwd: None, approval_policy: None, diff --git a/codex-rs/app-server/src/message_processor/tracing_tests.rs b/codex-rs/app-server/src/message_processor/tracing_tests.rs index 5db075984b..bb247be59e 100644 --- a/codex-rs/app-server/src/message_processor/tracing_tests.rs +++ b/codex-rs/app-server/src/message_processor/tracing_tests.rs @@ -758,7 +758,6 @@ async fn turn_start_jsonrpc_span_parents_core_turn_spans() -> Result<()> { text_elements: Vec::new(), }], responsesapi_client_metadata: None, - execution_environment: None, cwd: None, approval_policy: None, sandbox_policy: None, diff --git a/codex-rs/app-server/tests/suite/v2/client_metadata.rs b/codex-rs/app-server/tests/suite/v2/client_metadata.rs index 56a5b51f4c..8d68888e7e 100644 --- a/codex-rs/app-server/tests/suite/v2/client_metadata.rs +++ b/codex-rs/app-server/tests/suite/v2/client_metadata.rs @@ -179,7 +179,6 @@ async fn turn_steer_updates_client_metadata_on_follow_up_responses_request_v2() text_elements: Vec::new(), }], responsesapi_client_metadata: Some(steer_metadata.clone()), - execution_environment: None, expected_turn_id: turn_id.clone(), }) .await?; diff --git a/codex-rs/app-server/tests/suite/v2/turn_steer.rs b/codex-rs/app-server/tests/suite/v2/turn_steer.rs index a90ca9d842..a92b2db528 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_steer.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_steer.rs @@ -67,7 +67,6 @@ async fn turn_steer_requires_active_turn() -> Result<()> { text_elements: Vec::new(), }], responsesapi_client_metadata: None, - execution_environment: None, expected_turn_id: "turn-does-not-exist".to_string(), }) .await?; @@ -177,7 +176,6 @@ async fn turn_steer_rejects_oversized_text_input() -> Result<()> { text_elements: Vec::new(), }], responsesapi_client_metadata: None, - execution_environment: None, expected_turn_id: turn.id.clone(), }) .await?; @@ -286,7 +284,6 @@ async fn turn_steer_returns_active_turn_id() -> Result<()> { text_elements: Vec::new(), }], responsesapi_client_metadata: None, - execution_environment: None, expected_turn_id: turn.id.clone(), }) .await?; diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs index 3a063f21fa..7846536206 100644 --- a/codex-rs/exec/src/lib.rs +++ b/codex-rs/exec/src/lib.rs @@ -754,7 +754,6 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> { thread_id: primary_thread_id_for_span.clone(), input: items.into_iter().map(Into::into).collect(), responsesapi_client_metadata: None, - execution_environment: None, environments: None, cwd: Some(default_cwd), approval_policy: Some(default_approval_policy.into()), diff --git a/codex-rs/tui/src/app_server_session.rs b/codex-rs/tui/src/app_server_session.rs index 982b58febe..96757998ff 100644 --- a/codex-rs/tui/src/app_server_session.rs +++ b/codex-rs/tui/src/app_server_session.rs @@ -569,7 +569,6 @@ impl AppServerSession { thread_id: thread_id.to_string(), input: items.into_iter().map(Into::into).collect(), responsesapi_client_metadata: None, - execution_environment: None, environments: None, cwd: Some(cwd), approval_policy: Some(approval_policy.into()), @@ -627,7 +626,6 @@ impl AppServerSession { thread_id: thread_id.to_string(), input: items.into_iter().map(Into::into).collect(), responsesapi_client_metadata: None, - execution_environment: None, expected_turn_id: turn_id, }, })