From a9144cd82f11ec876b87ba84226e3c14b5fb8749 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Fri, 6 Feb 2026 12:23:54 -0800 Subject: [PATCH] More fixes --- codex-rs/core/src/thread_manager.rs | 34 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/codex-rs/core/src/thread_manager.rs b/codex-rs/core/src/thread_manager.rs index c7d6a7449b..63216abc0f 100644 --- a/codex-rs/core/src/thread_manager.rs +++ b/codex-rs/core/src/thread_manager.rs @@ -91,6 +91,12 @@ pub struct NewThread { pub session_configured: SessionConfiguredEvent, } +struct SpawnThreadWithSourceOptions { + session_source: SessionSource, + dynamic_tools: Vec, + defer_new_rollout_creation: bool, +} + /// [`ThreadManager`] is responsible for creating threads and maintaining /// them in memory. pub struct ThreadManager { @@ -419,9 +425,11 @@ impl ThreadManagerState { InitialHistory::New, Arc::clone(&self.auth_manager), agent_control, - session_source, - Vec::new(), - false, + SpawnThreadWithSourceOptions { + session_source, + dynamic_tools: Vec::new(), + defer_new_rollout_creation: false, + }, ) .await } @@ -441,22 +449,22 @@ impl ThreadManagerState { initial_history, auth_manager, agent_control, - self.session_source.clone(), - dynamic_tools, - defer_new_rollout_creation, + SpawnThreadWithSourceOptions { + session_source: self.session_source.clone(), + dynamic_tools, + defer_new_rollout_creation, + }, ) .await } - pub(crate) async fn spawn_thread_with_source( + async fn spawn_thread_with_source( &self, config: Config, initial_history: InitialHistory, auth_manager: Arc, agent_control: AgentControl, - session_source: SessionSource, - dynamic_tools: Vec, - defer_new_rollout_creation: bool, + options: SpawnThreadWithSourceOptions, ) -> CodexResult { self.file_watcher.register_config(&config); let CodexSpawnOk { @@ -468,10 +476,10 @@ impl ThreadManagerState { Arc::clone(&self.skills_manager), Arc::clone(&self.file_watcher), initial_history, - defer_new_rollout_creation, - session_source, + options.defer_new_rollout_creation, + options.session_source, agent_control, - dynamic_tools, + options.dynamic_tools, ) .await?; self.finalize_thread_spawn(codex, thread_id).await