Lightweight coding agent that runs in your terminal
Rust
Consolidate multi-agent v2 communication sends (#30867)
Michael Bolina98a21798c33
diff --git a/codex-rs/core/src/agent/control.rs b/codex-rs/core/src/agent/control.rsindex 49bbab0f87..8de6443402 100644--- a/codex-rs/core/src/agent/control.rs+++ b/codex-rs/core/src/agent/control.rs@@ -154,12 +154,13 @@ impl AgentControl {state: &Arc<ThreadManagerState>,initial_operation: Op,) -> CodexResult<String> {- let last_task_message = match &initial_operation {- Op::InterAgentCommunication { communication } => {- last_task_message_from_communication(communication)- }- _ => non_empty_task_message(render_input_preview(&initial_operation)),- };+ if let Op::InterAgentCommunication { communication } = initial_operation {+ return self+ .submit_inter_agent_communication(agent_id, state, communication)+ .await;+ }++ let last_task_message = non_empty_task_message(render_input_preview(&initial_operation));let result = self.handle_thread_request_result(agent_id,@@ -182,13 +183,26 @@ impl AgentControl {&self,agent_id: ThreadId,communication: InterAgentCommunication,+ ) -> CodexResult<String> {+ self.send_input(agent_id, Op::InterAgentCommunication { communication })+ .await+ }++ async fn submit_inter_agent_communication(+ &self,+ agent_id: ThreadId,+ state: &Arc<ThreadManagerState>,+ communication: InterAgentCommunication,) -> CodexResult<String> {let last_task_message = last_task_message_from_communication(&communication);- let state = self.upgrade()?;- let op = Op::InterAgentCommunication { communication };- self.ensure_execution_capacity_for_op(agent_id, &op).await?;let result = self- .handle_thread_request_result(agent_id, &state, state.send_op(agent_id, op).await)+ .handle_thread_request_result(+ agent_id,+ state,+ state+ .send_op(agent_id, Op::InterAgentCommunication { communication })+ .await,+ ).await;if result.is_ok() {match last_task_message {