diff --git a/codex-rs/core/src/agent/api.rs b/codex-rs/core/src/agent/api.rs index 2d88e0568f..a2e07c164f 100644 --- a/codex-rs/core/src/agent/api.rs +++ b/codex-rs/core/src/agent/api.rs @@ -88,8 +88,11 @@ pub trait AgentControl: Send + Sync { /// authority. Success makes the child available for attachment through its thread manager. fn ensure_child_loaded(&self, parent: ThreadId, child: ThreadId) -> BoxFuture<'_, Result<()>>; - /// Stop current work and return the pre-interrupt snapshot. V2 rejects root/self - /// targets and tolerates known unloaded agents; other modes retain direct-ID interruption. + /// Stop current work and return the pre-interrupt snapshot. + /// V2 and V3 reject root and self targets and treat known unloaded workers as + /// already stopped. Other modes interrupt by ID. + /// For a loaded worker, V3 waits for the interrupted turn to release its execution + /// slot. Queued work can reclaim the slot immediately. fn interrupt( &self, caller: ThreadId, diff --git a/codex-rs/core/src/agent/control.rs b/codex-rs/core/src/agent/control.rs index 951a0813ae..997ebf6dde 100644 --- a/codex-rs/core/src/agent/control.rs +++ b/codex-rs/core/src/agent/control.rs @@ -356,12 +356,12 @@ impl LocalAgentControl { .await } - async fn handle_thread_request_result( + async fn handle_thread_request_result( &self, agent_id: ThreadId, state: &Arc, - result: CodexResult, - ) -> CodexResult { + result: CodexResult, + ) -> CodexResult { if result .as_ref() .is_err_and(|err| matches!(err.details(), CodexErrorDetails::InternalAgentDied)) diff --git a/codex-rs/core/src/agent/control/api.rs b/codex-rs/core/src/agent/control/api.rs index 0f07583acb..9efeaa50a7 100644 --- a/codex-rs/core/src/agent/control/api.rs +++ b/codex-rs/core/src/agent/control/api.rs @@ -234,7 +234,7 @@ impl AgentControl for LocalAgentControl { Ok(snapshot) } MultiAgentVersion::V2 | MultiAgentVersion::V3 => { - self.interrupt_spawned_agent(caller, target).await + self.interrupt_spawned_agent(caller, target, version).await } } }) diff --git a/codex-rs/core/src/agent/control/interrupt.rs b/codex-rs/core/src/agent/control/interrupt.rs index 110a7518ae..6c163c791e 100644 --- a/codex-rs/core/src/agent/control/interrupt.rs +++ b/codex-rs/core/src/agent/control/interrupt.rs @@ -1,7 +1,6 @@ -//! Applies V2 interruption rules to a registered agent without loading its runtime. +//! Applies external interruption and stop requests to a registered agent without loading its runtime. //! -//! Root and self targets are rejected. An unloaded or already-dead runtime is a successful -//! interruption; this operation never reloads it. +//! An evicted worker is already idle. V3 reports a dead worker as an error. use super::LocalAgentControl; use crate::agent::api::AgentInfo; @@ -10,6 +9,7 @@ use codex_protocol::ThreadId; use codex_protocol::error::CodexErr; use codex_protocol::error::CodexErrorDetails; use codex_protocol::error::Result as CodexResult; +use codex_protocol::protocol::MultiAgentVersion; use codex_protocol::protocol::Op; impl LocalAgentControl { @@ -18,6 +18,7 @@ impl LocalAgentControl { &self, caller: ThreadId, target: ThreadId, + version: MultiAgentVersion, ) -> CodexResult { let receiver_agent = self.runtime.ensure_agent_known(target)?; if receiver_agent @@ -39,15 +40,32 @@ impl LocalAgentControl { CodexErr::UnsupportedOperation("target agent is missing an agent_path".to_string()) })?; let snapshot = self.inspect_agent(target).await?; - match self.interrupt_agent(target, Op::InterruptAgent).await { - Ok(_) => {} + let result = if version == MultiAgentVersion::V3 { + self.stop_spawned_worker(target).await + } else { + self.interrupt_agent(target, Op::InterruptAgent) + .await + .map(drop) + }; + match result { + Ok(()) => {} + Err(err) if matches!(err.details(), CodexErrorDetails::ThreadNotFound(_)) => {} Err(err) - if matches!( - err.details(), - CodexErrorDetails::ThreadNotFound(_) | CodexErrorDetails::InternalAgentDied - ) => {} + if version == MultiAgentVersion::V2 + && matches!(err.details(), CodexErrorDetails::InternalAgentDied) => {} Err(err) => return Err(err), } Ok(snapshot) } + + async fn stop_spawned_worker(&self, target: ThreadId) -> CodexResult<()> { + let state = self.runtime.upgrade()?; + let thread = state.get_thread(target).await?; + // Pin the registered worker through acknowledgement and dead-thread cleanup. + // If eviction won, pinning returns ThreadNotFound and the worker is already idle. + let _resident = self.runtime.pin_v2_residency(&thread).await?; + let result = thread.stop_worker().await; + self.handle_thread_request_result(target, &state, result) + .await + } } diff --git a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs index b6a8d118ac..9be0307b2e 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_spec.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_spec.rs @@ -364,6 +364,24 @@ pub fn create_close_agent_tool_v1() -> ToolSpec { }) } +pub fn create_stop_agent_tool() -> ToolSpec { + let properties = BTreeMap::from([( + "target".to_string(), + JsonSchema::string(Some( + "Relative or canonical task name of the worker to stop.".to_string(), + )), + )]); + + ToolSpec::Function(ResponsesApiTool { + name: "stop_agent".to_string(), + description: "Stop a worker's current turn and release its slot. A message resumes the worker. If one is already queued, the worker can reclaim the slot immediately. Target your own path to finish after this batch unless new input is waiting or a send failed.".to_string(), + strict: false, + defer_loading: None, + parameters: JsonSchema::object(properties, Some(vec!["target".to_string()]), Some(false.into())), + output_schema: None, + }) +} + pub fn create_interrupt_agent_tool_v2() -> ToolSpec { let properties = BTreeMap::from([( "target".to_string(), diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2.rs index 09c8c9030b..5f1146ccbf 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2.rs @@ -26,7 +26,8 @@ use serde::Deserialize; use serde::Serialize; pub(crate) use followup_task::Handler as FollowupTaskHandler; -pub(crate) use interrupt_agent::Handler as InterruptAgentHandler; +pub(crate) use interrupt_agent::Handler::Interrupt as InterruptAgentHandler; +pub(crate) use interrupt_agent::Handler::Stop as StopAgentHandler; pub(crate) use list_agents::Handler as ListAgentsHandler; pub(crate) use send_message::Handler as SendMessageHandler; pub(crate) use spawn::Handler as SpawnAgentHandler; diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/interrupt_agent.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/interrupt_agent.rs index 2db76bc221..f64e5e9180 100644 --- a/codex-rs/core/src/tools/handlers/multi_agents_v2/interrupt_agent.rs +++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/interrupt_agent.rs @@ -1,36 +1,58 @@ use super::analytics::ToolCallAnalytics; use super::*; use crate::agent::api::AgentTarget; +use crate::tools::context::FunctionToolOutput; use crate::tools::handlers::multi_agents_spec::create_interrupt_agent_tool_v2; +use crate::tools::handlers::multi_agents_spec::create_stop_agent_tool; use codex_otel::SubagentStopAction; use codex_tools::ToolSpec; -pub(crate) struct Handler; +#[derive(Clone, Copy)] +pub(crate) enum Handler { + Interrupt, + Stop, +} + +impl Handler { + pub(crate) fn name(self) -> &'static str { + match self { + Self::Interrupt => "interrupt_agent", + Self::Stop => "stop_agent", + } + } +} impl ToolExecutor for Handler { fn tool_name(&self) -> ToolName { - ToolName::plain("interrupt_agent") + ToolName::plain(self.name()) } fn spec(&self) -> ToolSpec { - create_interrupt_agent_tool_v2() + match self { + Self::Interrupt => create_interrupt_agent_tool_v2(), + Self::Stop => create_stop_agent_tool(), + } } fn handle(&self, invocation: ToolInvocation) -> codex_tools::ToolExecutorFuture<'_> { Box::pin(async move { - let mut analytics = - ToolCallAnalytics::new(&invocation, CollabAgentTool::InterruptAgent); - let result = handle_interrupt_agent(invocation, &mut analytics).await; + let tool = match self { + Self::Interrupt => CollabAgentTool::InterruptAgent, + Self::Stop => CollabAgentTool::CloseAgent, + }; + let mut analytics = ToolCallAnalytics::new(&invocation, tool); + let result = handle_interrupt_agent(*self, invocation, &mut analytics).await; analytics.finish(&result); - result.map(boxed_tool_output) + result }) } } async fn handle_interrupt_agent( + action: Handler, invocation: ToolInvocation, analytics: &mut ToolCallAnalytics, -) -> Result { +) -> Result, FunctionCallError> { let ToolInvocation { session, turn, @@ -43,16 +65,35 @@ async fn handle_interrupt_agent( let args: InterruptAgentArgs = parse_arguments(&arguments)?; let agent_id = resolve_agent_target(&session, &turn, &args.target).await?; analytics.set_receiver(agent_id); - if session.thread_id == agent_id + let accepted = |status: Option<&AgentStatus>| { + turn.session_telemetry.record_multi_agent_stop_accepted( + session.session_id(), + agent_id, + &call_id, + match action { + Handler::Interrupt => SubagentStopAction::Interrupt, + Handler::Stop => SubagentStopAction::Stop, + }, + status, + ); + match action { + Handler::Interrupt => boxed_tool_output(InterruptAgentResult { + previous_status: status.cloned().unwrap_or(AgentStatus::NotFound), + }), + Handler::Stop => { + boxed_tool_output(FunctionToolOutput::from_text(String::new(), Some(true))) + } + } + }; + if matches!(action, Handler::Stop) + && session.thread_id == agent_id && let Some(stop) = &step_context.worker_self_stop { session .ensure_stoppable_worker(&turn.session_source) .map_err(|err| collab_v2_agent_error(agent_id, err))?; stop.requested.get_or_init(|| ()); - return Ok(InterruptAgentResult { - previous_status: AgentStatus::Running, - }); + return Ok(accepted(Some(&AgentStatus::Running))); } let snapshot = session .services @@ -67,14 +108,7 @@ async fn handle_interrupt_agent( let agent_path = snapshot.metadata().agent_path.clone().ok_or_else(|| { FunctionCallError::RespondToModel("target agent is missing an agent_path".to_string()) })?; - turn.session_telemetry.record_multi_agent_stop_accepted( - session.session_id(), - agent_id, - &call_id, - SubagentStopAction::Interrupt, - snapshot.status(), - ); - let previous_status = snapshot.status().cloned().unwrap_or(AgentStatus::NotFound); + let output = accepted(snapshot.status()); emit_sub_agent_activity( &session, &turn, @@ -89,7 +123,7 @@ async fn handle_interrupt_agent( ) .await; - Ok(InterruptAgentResult { previous_status }) + Ok(output) } impl CoreToolRuntime for Handler { diff --git a/codex-rs/core/src/tools/parallel.rs b/codex-rs/core/src/tools/parallel.rs index 2592f35d40..bdf7e1fe1a 100644 --- a/codex-rs/core/src/tools/parallel.rs +++ b/codex-rs/core/src/tools/parallel.rs @@ -98,7 +98,7 @@ fn direct_path_incomplete_reasons( &[CodeModeUnsupported] } "send_input" | "close_agent" | "resume_agent" | "list_agents" | "followup_task" - | "interrupt_agent" | "send_message" => &[UnsupportedOperation], + | "interrupt_agent" | "stop_agent" | "send_message" => &[UnsupportedOperation], _ => &[], }; let trusted = registered_tool.is_some_and(|tool| tool.is_trusted); diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs index 4402194902..0705e45002 100644 --- a/codex-rs/core/src/tools/spec_plan.rs +++ b/codex-rs/core/src/tools/spec_plan.rs @@ -48,6 +48,7 @@ use crate::tools::handlers::multi_agents_v2::InterruptAgentHandler; use crate::tools::handlers::multi_agents_v2::ListAgentsHandler as ListAgentsHandlerV2; use crate::tools::handlers::multi_agents_v2::SendMessageHandler as SendMessageHandlerV2; use crate::tools::handlers::multi_agents_v2::SpawnAgentHandler as SpawnAgentHandlerV2; +use crate::tools::handlers::multi_agents_v2::StopAgentHandler; use crate::tools::handlers::multi_agents_v2::WaitAgentHandler as WaitAgentHandlerV2; use crate::tools::handlers::tool_search_spec::ToolSearchSourceListing; use crate::tools::handlers::view_image_spec::ViewImageToolOptions; @@ -760,12 +761,18 @@ fn required_child_management_tool_names( Some(MULTI_AGENT_V1_NAMESPACE), &["send_input", "wait_agent", "resume_agent", "close_agent"], ), - MultiAgentVersion::V2 | MultiAgentVersion::V3 => ( + MultiAgentVersion::V3 => ( + turn_context.config.multi_agent_v2.tool_namespace.as_deref(), + if turn_context.config.multi_agent_v2.disable_direct_message { + &["stop_agent", "list_agents"] + } else { + &["send_message", "stop_agent", "list_agents"] + }, + ), + MultiAgentVersion::V2 => ( turn_context.config.multi_agent_v2.tool_namespace.as_deref(), if turn_context.config.multi_agent_v2.disable_direct_message { &["interrupt_agent", "list_agents"] - } else if turn_context.multi_agent_version == MultiAgentVersion::V3 { - &["send_message", "interrupt_agent", "list_agents"] } else { &[ "send_message", @@ -1538,12 +1545,17 @@ fn add_collaboration_tools(context: &CoreToolPlanContext<'_>, registry: &mut Too exposure, ); } + let stop = if turn_context.multi_agent_version == MultiAgentVersion::V3 { + StopAgentHandler + } else { + InterruptAgentHandler + }; registry.register_trusted_with_native_review( multi_agent_v2_handler( - InterruptAgentHandler, + stop, tool_namespace, - model_messages.multi_agent_tool_description_override("interrupt_agent"), - model_messages.multi_agent_tool_parameters_override("interrupt_agent"), + model_messages.multi_agent_tool_description_override(stop.name()), + model_messages.multi_agent_tool_parameters_override(stop.name()), ), exposure, native_review, diff --git a/codex-rs/core/tests/suite/agent_mailbox.rs b/codex-rs/core/tests/suite/agent_mailbox.rs index 359ccdae80..26e92342f4 100644 --- a/codex-rs/core/tests/suite/agent_mailbox.rs +++ b/codex-rs/core/tests/suite/agent_mailbox.rs @@ -355,24 +355,25 @@ async fn v3_message_wakes_require_a_slot_only_for_idle_workers() -> Result<()> { let first = created.recv().await?; ThreadIdle::wait(test.thread_manager.get_thread(first).await?.as_ref()).await; - // The second worker owns the only worker slot until a message ends its wait. - mount_sse_once_match( - &server, - |request: &wiremock::Request| { - body_contains(request, SECOND_TASK) - && !has_function_call_output(request, "spawn-second") - }, - sse(vec![ - ev_function_call_with_namespace( - "waiting", - MULTI_AGENT_V2_NAMESPACE, - "wait_agent", - "{}", - ), - ev_completed("waiting"), - ]), - ) - .await; + let wait = async |task: &'static str, parent_call: &'static str| { + mount_sse_once_match( + &server, + move |r: &wiremock::Request| { + body_contains(r, task) && !has_function_call_output(r, parent_call) + }, + sse(vec![ + ev_function_call_with_namespace( + "waiting", + MULTI_AGENT_V2_NAMESPACE, + "wait_agent", + "{}", + ), + ev_completed("waiting"), + ]), + ) + .await + }; + wait(SECOND_TASK, "spawn-second").await; spawn("spawn-second", "second", SECOND_TASK).await?; let second = test .thread_manager @@ -391,7 +392,7 @@ async fn v3_message_wakes_require_a_slot_only_for_idle_workers() -> Result<()> { ev_function_call_with_namespace( id, MULTI_AGENT_V2_NAMESPACE, - "interrupt_agent", + "stop_agent", r#"{"target":"/root/second"}"#, ) }; @@ -448,6 +449,10 @@ async fn v3_message_wakes_require_a_slot_only_for_idle_workers() -> Result<()> { correction.function_call_output_text("send-full").as_deref(), Some("collab tool failed: agent thread limit reached") ); + assert_eq!( + correction.function_call_output_text("stop-self").as_deref(), + Some("") + ); let requests = server.received_requests().await.unwrap(); assert!( !requests @@ -455,10 +460,20 @@ async fn v3_message_wakes_require_a_slot_only_for_idle_workers() -> Result<()> { .any(|r| has_function_call_output(r, "finish")) ); - // The second worker stopped itself, freeing the only slot for the first. - let retry = mount_completed_worker(&server, RETRY, "retry-wake").await; + // Self-stop freed the only slot. The parent can now wake and stop the first worker. + let retry = wait(RETRY, "retry-wake").await; assert_eq!(send("retry-wake", "first", RETRY).await?, ""); - ThreadIdle::wait(test.thread_manager.get_thread(first).await?.as_ref()).await; + let first = test.thread_manager.get_thread(first).await?; + wait_for_event( + &first, + |event| matches!(event, EventMsg::ItemStarted(item) if item.item.id() == "waiting"), + ) + .await; + assert_eq!( + call("stop-first", "stop_agent", json!({"target":"first"})).await?, + "" + ); + assert_eq!(first.agent_status().await, AgentStatus::Interrupted); let request = retry .requests() .into_iter() diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_eviction__idle_eviction_v3_send_message.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_eviction__idle_eviction_v3_send_message.snap index d19ca1e18c..44144ca7b8 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_eviction__idle_eviction_v3_send_message.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__agent_eviction__idle_eviction_v3_send_message.snap @@ -6,16 +6,16 @@ Scenario: A V3 parent spawns a worker, checks its status, and sends it an encryp ## Window 1 -- request 1 (turn) -- -00:additional_tools/developer (2; hash=8fbc0ea9adcc0eaf): +00:additional_tools/developer (2; hash=e4ca971ebcca4486): - namespace/functions; hash=f33f647fee88e25e - custom/exec - function/wait - function/request_user_input - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=e396a572e0f8acf4 - - function/interrupt_agent + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=170d28937de769cb - function/list_agents - function/send_message - function/spawn_agent + - function/stop_agent - function/wait_agent 01:message/developer: @@ -48,16 +48,16 @@ Scenario: A V3 parent spawns a worker, checks its status, and sends it an encryp ## Window 2 (after request 6: input diverged at item 03) -- request 7 (turn) -- -00:additional_tools/developer (2; hash=8fbc0ea9adcc0eaf): +00:additional_tools/developer (2; hash=e4ca971ebcca4486): - namespace/functions; hash=f33f647fee88e25e - custom/exec - function/wait - function/request_user_input - - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=e396a572e0f8acf4 - - function/interrupt_agent + - namespace/collaboration: Tools for spawning and managing sub-agents.; hash=170d28937de769cb - function/list_agents - function/send_message - function/spawn_agent + - function/stop_agent - function/wait_agent 01:message/developer: diff --git a/codex-rs/guardian-context/src/transcript.rs b/codex-rs/guardian-context/src/transcript.rs index c084cb5a1d..00c1f862b4 100644 --- a/codex-rs/guardian-context/src/transcript.rs +++ b/codex-rs/guardian-context/src/transcript.rs @@ -346,7 +346,11 @@ fn collect_transcript_for_review( }) && matches!( name.as_str(), - "spawn_agent" | "send_message" | "followup_task" | "interrupt_agent" + "spawn_agent" + | "send_message" + | "followup_task" + | "interrupt_agent" + | "stop_agent" ) { entries.push(ConversationTranscriptEntry { diff --git a/codex-rs/otel/src/subagent.rs b/codex-rs/otel/src/subagent.rs index 9238ec23df..50700414eb 100644 --- a/codex-rs/otel/src/subagent.rs +++ b/codex-rs/otel/src/subagent.rs @@ -34,6 +34,7 @@ pub enum SubagentTurnStatus<'a> { pub enum SubagentStopAction { Close, Interrupt, + Stop, } impl SessionTelemetry { diff --git a/codex-rs/prompts/src/model_messages/multi_agent.rs b/codex-rs/prompts/src/model_messages/multi_agent.rs index 7405e2658b..513649e6fa 100644 --- a/codex-rs/prompts/src/model_messages/multi_agent.rs +++ b/codex-rs/prompts/src/model_messages/multi_agent.rs @@ -80,8 +80,8 @@ impl<'a> ResolvedMultiAgentMessages<'a> { let mode = messages.and_then(|messages| messages.mode.as_ref()); let (root, subagent) = if role_version == MultiAgentVersion::V3 { ( - "You are `/root`. Use `spawn_agent` to delegate work. Use `send_message` to give a worker more input, including after it stops.", - "You are a worker. Use `send_message` to communicate with your parent or other workers. A message to an idle worker resumes its conversation.", + "You are `/root`. Use `spawn_agent` to delegate work. Use `send_message` to give a worker more input, including after it stops. Use `stop_agent` to stop a worker when its work is no longer needed.", + "You are a worker. Use `send_message` to communicate with your parent or other workers. Call `stop_agent` with your own canonical path to release your slot. A later message resumes your conversation.", ) } else { ( diff --git a/codex-rs/protocol/src/openai_models.rs b/codex-rs/protocol/src/openai_models.rs index d61d293509..697aa75dc4 100644 --- a/codex-rs/protocol/src/openai_models.rs +++ b/codex-rs/protocol/src/openai_models.rs @@ -743,6 +743,8 @@ pub struct MultiAgentToolMessages { #[serde(default, skip_serializing_if = "Option::is_none")] pub interrupt_agent: Option, #[serde(default, skip_serializing_if = "Option::is_none")] + pub stop_agent: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] pub list_agents: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub create_channel: Option, @@ -773,6 +775,7 @@ impl MultiAgentToolMessages { "followup_task" => &self.followup_task, "wait_agent" => &self.wait_agent, "interrupt_agent" => &self.interrupt_agent, + "stop_agent" => &self.stop_agent, "list_agents" => &self.list_agents, "create_channel" => &self.create_channel, "get_channels" => &self.get_channels, diff --git a/codex-rs/protocol/src/openai_models/guardian.rs b/codex-rs/protocol/src/openai_models/guardian.rs index ea9c65e36d..2e5920e29e 100644 --- a/codex-rs/protocol/src/openai_models/guardian.rs +++ b/codex-rs/protocol/src/openai_models/guardian.rs @@ -138,7 +138,7 @@ impl GuardianScope { } } - /// Classifies state-changing MAv2 calls in the configured namespace. + /// Classifies state-changing multi-agent calls in the configured namespace. /// An absent namespace accepts the default namespace spellings; callers gate this lookup. pub fn for_multi_agent_tool(tool: &ToolName, namespace: Option<&str>) -> Option { let matches_namespace = match namespace { @@ -148,7 +148,7 @@ impl GuardianScope { if matches_namespace && matches!( tool.name.as_str(), - "spawn_agent" | "send_message" | "followup_task" | "interrupt_agent" + "spawn_agent" | "send_message" | "followup_task" | "interrupt_agent" | "stop_agent" ) { Some(Self::NativeTool) diff --git a/codex-rs/rollout-trace/src/tool_dispatch.rs b/codex-rs/rollout-trace/src/tool_dispatch.rs index 777469c42d..aa07be4127 100644 --- a/codex-rs/rollout-trace/src/tool_dispatch.rs +++ b/codex-rs/rollout-trace/src/tool_dispatch.rs @@ -242,7 +242,7 @@ fn dispatched_tool_kind(tool_name: &str, _payload: &ToolDispatchPayload) -> Tool "send_message" => ToolCallKind::SendMessage, "followup_task" | "assign_task" => ToolCallKind::AssignAgentTask, "wait_agent" => ToolCallKind::WaitAgent, - "close_agent" | "interrupt_agent" => ToolCallKind::CloseAgent, + "close_agent" | "interrupt_agent" | "stop_agent" => ToolCallKind::CloseAgent, other => ToolCallKind::Other { name: other.to_string(), },