diff --git a/codex-rs/core/src/agent/control.rs b/codex-rs/core/src/agent/control.rs index 7a6ffcc583..2571062b1d 100644 --- a/codex-rs/core/src/agent/control.rs +++ b/codex-rs/core/src/agent/control.rs @@ -217,7 +217,7 @@ impl AgentControl { config: crate::config::Config, initial_operation: Op, session_source: Option, - options: SpawnAgentOptions, + mut options: SpawnAgentOptions, ) -> CodexResult { let state = self.upgrade()?; let multi_agent_version = options.multi_agent_version.or_else(|| { @@ -229,6 +229,7 @@ impl AgentControl { None } }); + options.multi_agent_version = multi_agent_version; let max_threads = if multi_agent_version == Some(MultiAgentVersion::V2) { Some( config @@ -277,7 +278,6 @@ impl AgentControl { config, session_source, &options, - multi_agent_version, inherited_shell_snapshot, inherited_exec_policy, )) @@ -389,7 +389,6 @@ impl AgentControl { config: crate::config::Config, session_source: SessionSource, options: &SpawnAgentOptions, - multi_agent_version: Option, inherited_shell_snapshot: Option>, inherited_exec_policy: Option>, ) -> CodexResult { @@ -440,6 +439,7 @@ impl AgentControl { forked_rollout_items = truncate_rollout_to_last_n_fork_turns(&forked_rollout_items, *last_n_turns); } + let multi_agent_version = options.multi_agent_version; let multi_agent_v2_usage_hint_texts_to_filter: Vec = if let Some(parent_thread) = parent_thread.as_ref() { if multi_agent_version == Some(MultiAgentVersion::V2) {