From 36b5df0dd775ee4fd5a1d86b2e42a723e86b74b4 Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Wed, 13 May 2026 12:17:10 -0700 Subject: [PATCH 1/3] Use selected environment cwd for filesystem helpers --- codex-rs/core/src/mcp_tool_call_tests.rs | 4 --- codex-rs/core/src/session/turn_context.rs | 4 +-- .../agent_jobs/spawn_agents_on_csv.rs | 26 ++++++++++++++----- .../core/src/tools/handlers/apply_patch.rs | 6 ++--- .../core/src/tools/handlers/view_image.rs | 8 ++---- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/codex-rs/core/src/mcp_tool_call_tests.rs b/codex-rs/core/src/mcp_tool_call_tests.rs index 8b4f1ba223c9..714b0b99e68d 100644 --- a/codex-rs/core/src/mcp_tool_call_tests.rs +++ b/codex-rs/core/src/mcp_tool_call_tests.rs @@ -2233,10 +2233,6 @@ async fn maybe_persist_mcp_tool_approval_writes_project_config_for_project_serve .build() .await .expect("load project config"); - #[allow(deprecated)] - { - turn_context.cwd = config.cwd.clone(); - } turn_context.config = Arc::new(config); let key = McpToolApprovalKey { server: "docs".to_string(), diff --git a/codex-rs/core/src/session/turn_context.rs b/codex-rs/core/src/session/turn_context.rs index 8caec7aaeaba..71e238a5400c 100644 --- a/codex-rs/core/src/session/turn_context.rs +++ b/codex-rs/core/src/session/turn_context.rs @@ -301,6 +301,7 @@ impl TurnContext { pub(crate) fn file_system_sandbox_context( &self, additional_permissions: Option, + cwd: &AbsolutePathBuf, ) -> FileSystemSandboxContext { let (base_file_system_sandbox_policy, base_network_sandbox_policy) = self.permission_profile.to_runtime_permissions(); @@ -319,8 +320,7 @@ impl TurnContext { ); FileSystemSandboxContext { permissions, - #[allow(deprecated)] - cwd: Some(self.cwd.clone()), + cwd: Some(cwd.clone()), windows_sandbox_level: self.windows_sandbox_level, windows_sandbox_private_desktop: self .config diff --git a/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs b/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs index e1a37be6b6c6..6ad0515e810c 100644 --- a/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs +++ b/codex-rs/core/src/tools/handlers/agent_jobs/spawn_agents_on_csv.rs @@ -7,6 +7,7 @@ use crate::tools::registry::ToolExecutor; use crate::tools::registry::ToolHandler; use codex_tools::ToolName; use codex_tools::ToolSpec; +use codex_utils_absolute_path::AbsolutePathBuf; use super::*; @@ -67,9 +68,9 @@ pub async fn handle( )); } + let cwd = single_local_environment_cwd(&turn)?; let db = required_state_db(&session)?; - #[allow(deprecated)] - let input_path = turn.resolve_path(Some(args.csv_path)); + let input_path = cwd.join(args.csv_path); let input_path_display = input_path.display().to_string(); let csv_content = tokio::fs::read_to_string(&input_path) .await @@ -142,10 +143,7 @@ pub async fn handle( let job_id = Uuid::new_v4().to_string(); let output_csv_path = args.output_csv_path.map_or_else( || default_output_csv_path(&input_path, job_id.as_str()), - |path| { - #[allow(deprecated)] - turn.resolve_path(Some(path)) - }, + |path| cwd.join(path), ); let job_suffix = &job_id[..8]; let job_name = format!("agent-job-{job_suffix}"); @@ -290,3 +288,19 @@ pub async fn handle( })?; Ok(FunctionToolOutput::from_text(content, Some(true))) } + +fn single_local_environment_cwd(turn: &TurnContext) -> Result<&AbsolutePathBuf, FunctionCallError> { + let [turn_environment] = turn.environments.turn_environments.as_slice() else { + return Err(FunctionCallError::RespondToModel( + "spawn_agents_on_csv requires exactly one local environment".to_string(), + )); + }; + + if turn_environment.environment.is_remote() { + return Err(FunctionCallError::RespondToModel( + "spawn_agents_on_csv is not supported for remote environments".to_string(), + )); + } + + Ok(&turn_environment.cwd) +} diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs index 32edd21da194..5a709b287f7a 100644 --- a/codex-rs/core/src/tools/handlers/apply_patch.rs +++ b/codex-rs/core/src/tools/handlers/apply_patch.rs @@ -345,8 +345,7 @@ impl ToolExecutor for ApplyPatchHandler { }; let cwd = turn_environment.cwd.clone(); let fs = turn_environment.environment.get_filesystem(); - let mut sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None); - sandbox.cwd = Some(cwd.clone()); + let sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None, &cwd); match codex_apply_patch::verify_apply_patch_args(args, &cwd, fs.as_ref(), Some(&sandbox)) .await { @@ -499,8 +498,7 @@ pub(crate) async fn intercept_apply_patch( call_id: &str, tool_name: &str, ) -> Result, FunctionCallError> { - let mut sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None); - sandbox.cwd = Some(cwd.clone()); + let sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None, cwd); match codex_apply_patch::maybe_parse_apply_patch_verified(command, cwd, fs, Some(&sandbox)) .await { diff --git a/codex-rs/core/src/tools/handlers/view_image.rs b/codex-rs/core/src/tools/handlers/view_image.rs index bb74adb86db4..1587e90ddb74 100644 --- a/codex-rs/core/src/tools/handlers/view_image.rs +++ b/codex-rs/core/src/tools/handlers/view_image.rs @@ -134,8 +134,7 @@ impl ToolExecutor for ViewImageHandler { }; let cwd = turn_environment.cwd.clone(); let abs_path = cwd.join(path); - let mut sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None); - sandbox.cwd = Some(cwd.clone()); + let sandbox = turn.file_system_sandbox_context(/*additional_permissions*/ None, &cwd); let fs = turn_environment.environment.get_filesystem(); let metadata = fs @@ -282,10 +281,7 @@ mod tests { let (session, mut turn) = make_session_and_context().await; let image_dir = tempfile::tempdir().expect("create image temp dir"); let image_cwd = image_dir.abs(); - #[allow(deprecated)] - { - turn.cwd = image_cwd.clone(); - } + turn.environments .turn_environments .first_mut() From e723214081dc7888609fd546b165ff081616247e Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Thu, 14 May 2026 14:55:05 -0700 Subject: [PATCH 2/3] Remove unused TurnContextItem fields --- .../core/src/context_manager/history_tests.rs | 7 --- .../session/rollout_reconstruction_tests.rs | 48 ------------------- codex-rs/core/src/session/tests.rs | 15 ++---- codex-rs/core/src/session/turn_context.rs | 6 --- codex-rs/protocol/src/protocol.rs | 18 ------- codex-rs/rollout/src/recorder_tests.rs | 7 --- codex-rs/state/src/extract.rs | 19 -------- 7 files changed, 4 insertions(+), 116 deletions(-) diff --git a/codex-rs/core/src/context_manager/history_tests.rs b/codex-rs/core/src/context_manager/history_tests.rs index 74f4d29bfb4e..43f35b838a7b 100644 --- a/codex-rs/core/src/context_manager/history_tests.rs +++ b/codex-rs/core/src/context_manager/history_tests.rs @@ -2,7 +2,6 @@ use super::*; use base64::Engine; use base64::engine::general_purpose::STANDARD as BASE64_STANDARD; use codex_protocol::AgentPath; -use codex_protocol::config_types::ReasoningSummary; use codex_protocol::models::BaseInstructions; use codex_protocol::models::ContentItem; use codex_protocol::models::DEFAULT_IMAGE_DETAIL; @@ -121,7 +120,6 @@ fn developer_msg_with_fragments(texts: &[&str]) -> ResponseItem { fn reference_context_item() -> TurnContextItem { TurnContextItem { turn_id: Some("reference-turn".to_string()), - trace_id: None, cwd: PathBuf::from("/tmp/reference-cwd"), current_date: Some("2026-03-23".to_string()), timezone: Some("America/Los_Angeles".to_string()), @@ -135,11 +133,6 @@ fn reference_context_item() -> TurnContextItem { collaboration_mode: None, realtime_active: Some(false), effort: None, - summary: ReasoningSummary::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(codex_protocol::protocol::TruncationPolicy::Tokens(10_000)), } } diff --git a/codex-rs/core/src/session/rollout_reconstruction_tests.rs b/codex-rs/core/src/session/rollout_reconstruction_tests.rs index 143b23d3a327..66e6675974cb 100644 --- a/codex-rs/core/src/session/rollout_reconstruction_tests.rs +++ b/codex-rs/core/src/session/rollout_reconstruction_tests.rs @@ -59,7 +59,6 @@ async fn record_initial_history_resumed_bare_turn_context_does_not_hydrate_previ let previous_model = "previous-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -74,11 +73,6 @@ async fn record_initial_history_resumed_bare_turn_context_does_not_hydrate_previ collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let rollout_items = vec![RolloutItem::TurnContext(previous_context_item)]; @@ -101,7 +95,6 @@ async fn record_initial_history_resumed_hydrates_previous_turn_settings_from_lif let previous_model = "previous-rollout-model"; let mut previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -116,11 +109,6 @@ async fn record_initial_history_resumed_hydrates_previous_turn_settings_from_lif collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let turn_id = previous_context_item .turn_id @@ -912,7 +900,6 @@ async fn record_initial_history_resumed_turn_context_after_compaction_reestablis let previous_model = "previous-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -927,11 +914,6 @@ async fn record_initial_history_resumed_turn_context_after_compaction_reestablis collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let previous_turn_id = previous_context_item .turn_id @@ -991,7 +973,6 @@ async fn record_initial_history_resumed_turn_context_after_compaction_reestablis .expect("serialize seeded reference context item"), serde_json::to_value(Some(TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -1006,11 +987,6 @@ async fn record_initial_history_resumed_turn_context_after_compaction_reestablis collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), })) .expect("serialize expected reference context item") ); @@ -1023,7 +999,6 @@ async fn record_initial_history_resumed_aborted_turn_without_id_clears_active_tu let previous_model = "previous-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -1038,11 +1013,6 @@ async fn record_initial_history_resumed_aborted_turn_without_id_clears_active_tu collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let previous_turn_id = previous_context_item .turn_id @@ -1139,7 +1109,6 @@ async fn record_initial_history_resumed_unmatched_abort_preserves_active_turn_fo let unmatched_abort_turn_id = "other-turn".to_string(); let current_context_item = TurnContextItem { turn_id: Some(current_turn_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -1154,11 +1123,6 @@ async fn record_initial_history_resumed_unmatched_abort_preserves_active_turn_fo collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let rollout_items = vec![ @@ -1254,7 +1218,6 @@ async fn record_initial_history_resumed_trailing_incomplete_turn_compaction_clea let previous_model = "previous-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -1269,11 +1232,6 @@ async fn record_initial_history_resumed_trailing_incomplete_turn_compaction_clea collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let previous_turn_id = previous_context_item .turn_id @@ -1407,7 +1365,6 @@ async fn record_initial_history_resumed_replaced_incomplete_compacted_turn_clear let previous_model = "previous-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -1422,11 +1379,6 @@ async fn record_initial_history_resumed_replaced_incomplete_compacted_turn_clear collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let previous_turn_id = previous_context_item .turn_id diff --git a/codex-rs/core/src/session/tests.rs b/codex-rs/core/src/session/tests.rs index 38988329e98b..4a5ce6d69bdb 100644 --- a/codex-rs/core/src/session/tests.rs +++ b/codex-rs/core/src/session/tests.rs @@ -2280,7 +2280,6 @@ async fn record_initial_history_forked_hydrates_previous_turn_settings() { let previous_model = "forked-rollout-model"; let previous_context_item = TurnContextItem { turn_id: Some(turn_context.sub_id.clone()), - trace_id: turn_context.trace_id.clone(), #[allow(deprecated)] cwd: turn_context.cwd.to_path_buf(), current_date: turn_context.current_date.clone(), @@ -2295,11 +2294,6 @@ async fn record_initial_history_forked_hydrates_previous_turn_settings() { collaboration_mode: Some(turn_context.collaboration_mode.clone()), realtime_active: Some(turn_context.realtime_active), effort: turn_context.reasoning_effort, - summary: turn_context.reasoning_summary, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: Some(turn_context.truncation_policy), }; let turn_id = previous_context_item .turn_id @@ -4976,7 +4970,7 @@ async fn new_default_turn_captures_current_span_trace_id() { &request_parent )); - let turn_context_item = async { + let turn_trace_id = async { let expected_trace_id = Span::current() .context() .span() @@ -4984,15 +4978,14 @@ async fn new_default_turn_captures_current_span_trace_id() { .trace_id() .to_string(); let turn_context = session.new_default_turn().await; - let turn_context_item = turn_context.to_turn_context_item(); - assert_eq!(turn_context_item.trace_id, Some(expected_trace_id)); - turn_context_item + assert_eq!(turn_context.trace_id, Some(expected_trace_id)); + turn_context.trace_id.clone() } .instrument(request_span) .await; assert_eq!( - turn_context_item.trace_id.as_deref(), + turn_trace_id.as_deref(), Some("00000000000000000000000000000011") ); } diff --git a/codex-rs/core/src/session/turn_context.rs b/codex-rs/core/src/session/turn_context.rs index c646b5833df9..5f99cc54896b 100644 --- a/codex-rs/core/src/session/turn_context.rs +++ b/codex-rs/core/src/session/turn_context.rs @@ -367,7 +367,6 @@ impl TurnContext { pub(crate) fn to_turn_context_item(&self) -> TurnContextItem { TurnContextItem { turn_id: Some(self.sub_id.clone()), - trace_id: self.trace_id.clone(), #[allow(deprecated)] cwd: self.cwd.to_path_buf(), current_date: self.current_date.clone(), @@ -382,11 +381,6 @@ impl TurnContext { collaboration_mode: Some(self.collaboration_mode.clone()), realtime_active: Some(self.realtime_active), effort: self.reasoning_effort, - summary: self.reasoning_summary, - user_instructions: self.user_instructions.clone(), - developer_instructions: self.developer_instructions.clone(), - final_output_json_schema: self.final_output_json_schema.clone(), - truncation_policy: Some(self.truncation_policy), } } diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 91fd02d8583e..10c8c2620c32 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -2805,8 +2805,6 @@ pub struct TurnContextNetworkItem { pub struct TurnContextItem { #[serde(default, skip_serializing_if = "Option::is_none")] pub turn_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub trace_id: Option, pub cwd: PathBuf, #[serde(default, skip_serializing_if = "Option::is_none")] pub current_date: Option, @@ -2829,15 +2827,6 @@ pub struct TurnContextItem { pub realtime_active: Option, #[serde(skip_serializing_if = "Option::is_none")] pub effort: Option, - pub summary: ReasoningSummaryConfig, - #[serde(skip_serializing_if = "Option::is_none")] - pub user_instructions: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub developer_instructions: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub final_output_json_schema: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub truncation_policy: Option, } impl TurnContextItem { @@ -5168,7 +5157,6 @@ mod tests { "summary": "auto", }))?; - assert_eq!(item.trace_id, None); assert_eq!(item.network, None); assert_eq!(item.file_system_sandbox_policy, None); Ok(()) @@ -5178,7 +5166,6 @@ mod tests { fn turn_context_item_serializes_network_when_present() -> Result<()> { let item = TurnContextItem { turn_id: None, - trace_id: None, cwd: test_path_buf("/tmp"), current_date: None, timezone: None, @@ -5202,11 +5189,6 @@ mod tests { collaboration_mode: None, realtime_active: None, effort: None, - summary: ReasoningSummaryConfig::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }; let value = serde_json::to_value(item)?; diff --git a/codex-rs/rollout/src/recorder_tests.rs b/codex-rs/rollout/src/recorder_tests.rs index ede7f720a919..3a0e4ae10cbf 100644 --- a/codex-rs/rollout/src/recorder_tests.rs +++ b/codex-rs/rollout/src/recorder_tests.rs @@ -4,7 +4,6 @@ use super::*; use crate::config::RolloutConfig; use chrono::TimeZone; use codex_protocol::ThreadId; -use codex_protocol::config_types::ReasoningSummary as ReasoningSummaryConfig; use codex_protocol::models::ResponseItem; use codex_protocol::protocol::AgentMessageEvent; use codex_protocol::protocol::AskForApproval; @@ -1125,7 +1124,6 @@ async fn resume_candidate_matches_cwd_reads_latest_turn_context() -> std::io::Re timestamp: "2025-01-03T13:00:01Z".to_string(), item: RolloutItem::TurnContext(TurnContextItem { turn_id: Some("turn-1".to_string()), - trace_id: None, cwd: latest_cwd.clone(), current_date: None, timezone: None, @@ -1139,11 +1137,6 @@ async fn resume_candidate_matches_cwd_reads_latest_turn_context() -> std::io::Re collaboration_mode: None, realtime_active: None, effort: None, - summary: ReasoningSummaryConfig::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }), }; writeln!(file, "{}", serde_json::to_string(&turn_context)?)?; diff --git a/codex-rs/state/src/extract.rs b/codex-rs/state/src/extract.rs index d815d444cede..b03114c6b62e 100644 --- a/codex-rs/state/src/extract.rs +++ b/codex-rs/state/src/extract.rs @@ -156,7 +156,6 @@ mod tests { use chrono::DateTime; use chrono::Utc; use codex_protocol::ThreadId; - use codex_protocol::config_types::ReasoningSummary; use codex_protocol::models::ContentItem; use codex_protocol::models::ResponseItem; use codex_protocol::openai_models::ReasoningEffort; @@ -335,7 +334,6 @@ mod tests { &mut metadata, &RolloutItem::TurnContext(TurnContextItem { turn_id: Some("turn-1".to_string()), - trace_id: None, cwd: PathBuf::from("/parent/workspace"), current_date: None, timezone: None, @@ -349,11 +347,6 @@ mod tests { collaboration_mode: None, realtime_active: None, effort: None, - summary: ReasoningSummary::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }), "test-provider", ); @@ -375,7 +368,6 @@ mod tests { &mut metadata, &RolloutItem::TurnContext(TurnContextItem { turn_id: Some("turn-1".to_string()), - trace_id: None, cwd: PathBuf::from("/fallback/workspace"), current_date: None, timezone: None, @@ -389,11 +381,6 @@ mod tests { collaboration_mode: None, realtime_active: None, effort: Some(ReasoningEffort::High), - summary: ReasoningSummary::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }), "test-provider", ); @@ -409,7 +396,6 @@ mod tests { &mut metadata, &RolloutItem::TurnContext(TurnContextItem { turn_id: Some("turn-1".to_string()), - trace_id: None, cwd: PathBuf::from("/fallback/workspace"), current_date: None, timezone: None, @@ -423,11 +409,6 @@ mod tests { collaboration_mode: None, realtime_active: None, effort: Some(ReasoningEffort::High), - summary: ReasoningSummary::Auto, - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }), "test-provider", ); From d43d7d16a07f53aa3da897cef8be8fe6e1ff6d7e Mon Sep 17 00:00:00 2001 From: alexburch Date: Thu, 14 May 2026 18:10:46 -0400 Subject: [PATCH 3/3] codex: address PR review feedback (#22709) --- codex-rs/core/src/session/turn_context.rs | 1 + codex-rs/core/tests/suite/resume_warning.rs | 5 ----- codex-rs/protocol/src/protocol.rs | 2 ++ 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/codex-rs/core/src/session/turn_context.rs b/codex-rs/core/src/session/turn_context.rs index 5f99cc54896b..559686c91222 100644 --- a/codex-rs/core/src/session/turn_context.rs +++ b/codex-rs/core/src/session/turn_context.rs @@ -381,6 +381,7 @@ impl TurnContext { collaboration_mode: Some(self.collaboration_mode.clone()), realtime_active: Some(self.realtime_active), effort: self.reasoning_effort, + summary: self.reasoning_summary, } } diff --git a/codex-rs/core/tests/suite/resume_warning.rs b/codex-rs/core/tests/suite/resume_warning.rs index cb545df3519b..d636a35cba4a 100644 --- a/codex-rs/core/tests/suite/resume_warning.rs +++ b/codex-rs/core/tests/suite/resume_warning.rs @@ -27,7 +27,6 @@ fn resume_history( let turn_id = "resume-warning-seed-turn".to_string(); let turn_ctx = TurnContextItem { turn_id: Some(turn_id.clone()), - trace_id: None, cwd: config.cwd.to_path_buf(), current_date: None, timezone: None, @@ -44,10 +43,6 @@ fn resume_history( summary: config .model_reasoning_summary .unwrap_or(ReasoningSummary::Auto), - user_instructions: None, - developer_instructions: None, - final_output_json_schema: None, - truncation_policy: None, }; InitialHistory::Resumed(ResumedHistory { diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 10c8c2620c32..4efebc3be019 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -2827,6 +2827,7 @@ pub struct TurnContextItem { pub realtime_active: Option, #[serde(skip_serializing_if = "Option::is_none")] pub effort: Option, + pub summary: ReasoningSummaryConfig, } impl TurnContextItem { @@ -5189,6 +5190,7 @@ mod tests { collaboration_mode: None, realtime_active: None, effort: None, + summary: ReasoningSummaryConfig::Auto, }; let value = serde_json::to_value(item)?;