Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

[codex] Outline ToolExecutor handler bodies (#27299)

Adam Perry @ OpenAIdb531b4a6c07
diff --git a/codex-rs/core/src/tools/code_mode/execute_handler.rs b/codex-rs/core/src/tools/code_mode/execute_handler.rs
index 1d69c8f4cc..0bdb8b20a6 100644
--- a/codex-rs/core/src/tools/code_mode/execute_handler.rs
+++ b/codex-rs/core/src/tools/code_mode/execute_handler.rs
@@ -104,6 +104,15 @@ impl ToolExecutor<ToolInvocation> for CodeModeExecuteHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl CodeModeExecuteHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/code_mode/wait_handler.rs b/codex-rs/core/src/tools/code_mode/wait_handler.rs
index 74cc314a7b..c1928955f4 100644
--- a/codex-rs/core/src/tools/code_mode/wait_handler.rs
+++ b/codex-rs/core/src/tools/code_mode/wait_handler.rs
@@ -57,6 +57,15 @@ impl ToolExecutor<ToolInvocation> for CodeModeWaitHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl CodeModeWaitHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs b/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs
index c7adb27610..5f2a615329 100644
--- a/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs
+++ b/codex-rs/core/src/tools/handlers/agent_jobs/report_agent_job_result.rs
@@ -26,6 +26,15 @@ impl ToolExecutor<ToolInvocation> for ReportAgentJobResultHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ReportAgentJobResultHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session, payload, ..
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 26438ca7ba..16e1b1f72c 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
@@ -27,6 +27,15 @@ impl ToolExecutor<ToolInvocation> for SpawnAgentsOnCsvHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl SpawnAgentsOnCsvHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs
index 66fb1d3080..6a322ed6ae 100644
--- a/codex-rs/core/src/tools/handlers/apply_patch.rs
+++ b/codex-rs/core/src/tools/handlers/apply_patch.rs
@@ -318,6 +318,15 @@ impl ToolExecutor<ToolInvocation> for ApplyPatchHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ApplyPatchHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/dynamic.rs b/codex-rs/core/src/tools/handlers/dynamic.rs
index a74f44fd6d..e0151cf189 100644
--- a/codex-rs/core/src/tools/handlers/dynamic.rs
+++ b/codex-rs/core/src/tools/handlers/dynamic.rs
@@ -89,6 +89,15 @@ impl ToolExecutor<ToolInvocation> for DynamicToolHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl DynamicToolHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/extension_tools.rs b/codex-rs/core/src/tools/handlers/extension_tools.rs
index 5e177156c6..a94c764a9f 100644
--- a/codex-rs/core/src/tools/handlers/extension_tools.rs
+++ b/codex-rs/core/src/tools/handlers/extension_tools.rs
@@ -221,6 +221,15 @@ mod tests {
async fn handle(
&self,
call: codex_tools::ToolCall,
+ ) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
+ self.handle_call(call).await
+ }
+ }
+
+ impl CapturingExtensionExecutor {
+ async fn handle_call(
+ &self,
+ call: codex_tools::ToolCall,
) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
let item = ExtensionTurnItem::WebSearch(WebSearchItem {
id: call.call_id.clone(),
@@ -452,6 +461,15 @@ mod tests {
async fn handle(
&self,
call: codex_tools::ToolCall,
+ ) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
+ self.handle_call(call).await
+ }
+ }
+
+ impl ImageGenerationExtensionExecutor {
+ async fn handle_call(
+ &self,
+ call: codex_tools::ToolCall,
) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
call.turn_item_emitter
.emit_started(ExtensionTurnItem::ImageGeneration(
diff --git a/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs b/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs
index d18a1ca36e..2b782e4552 100644
--- a/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs
+++ b/codex-rs/core/src/tools/handlers/list_available_plugins_to_install.rs
@@ -71,6 +71,15 @@ impl ToolExecutor<ToolInvocation> for ListAvailablePluginsToInstallHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ListAvailablePluginsToInstallHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation { payload, .. } = invocation;
match payload {
diff --git a/codex-rs/core/src/tools/handlers/mcp.rs b/codex-rs/core/src/tools/handlers/mcp.rs
index 77ff3c14a3..d60cdfdd0c 100644
--- a/codex-rs/core/src/tools/handlers/mcp.rs
+++ b/codex-rs/core/src/tools/handlers/mcp.rs
@@ -116,6 +116,15 @@ impl ToolExecutor<ToolInvocation> for McpHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl McpHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs
index e96aad7552..8974d678fd 100644
--- a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs
+++ b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resource_templates.rs
@@ -43,6 +43,15 @@ impl ToolExecutor<ToolInvocation> for ListMcpResourceTemplatesHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ListMcpResourceTemplatesHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs
index 1b052184ee..f3a7b43c28 100644
--- a/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs
+++ b/codex-rs/core/src/tools/handlers/mcp_resource/list_mcp_resources.rs
@@ -43,6 +43,15 @@ impl ToolExecutor<ToolInvocation> for ListMcpResourcesHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ListMcpResourcesHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs b/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs
index f059d12c84..9861e5d22d 100644
--- a/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs
+++ b/codex-rs/core/src/tools/handlers/mcp_resource/read_mcp_resource.rs
@@ -43,6 +43,15 @@ impl ToolExecutor<ToolInvocation> for ReadMcpResourceHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ReadMcpResourceHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs
index 6e28d0a1d9..b811faf91a 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents/send_input.rs
@@ -26,6 +26,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs
index 525ee7f2ed..1f6b7db8f1 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents/wait.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents/wait.rs
@@ -47,6 +47,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs
index 2fe09f5f21..66a39cc79d 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/followup_task.rs
@@ -20,6 +20,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let arguments = function_arguments(invocation.payload.clone())?;
let args: FollowupTaskArgs = parse_arguments(&arguments)?;
diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs
index 46b29bdf10..18421278fe 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/list_agents.rs
@@ -18,6 +18,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs
index a8e3605840..2fd636a85c 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/send_message.rs
@@ -20,6 +20,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let arguments = function_arguments(invocation.payload.clone())?;
let args: SendMessageArgs = parse_arguments(&arguments)?;
diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs
index 5e37725b77..9d671b1989 100644
--- a/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs
+++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/wait.rs
@@ -32,6 +32,15 @@ impl ToolExecutor<ToolInvocation> for Handler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl Handler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/plan.rs b/codex-rs/core/src/tools/handlers/plan.rs
index bd1060b3d7..ff18a32813 100644
--- a/codex-rs/core/src/tools/handlers/plan.rs
+++ b/codex-rs/core/src/tools/handlers/plan.rs
@@ -58,6 +58,15 @@ impl ToolExecutor<ToolInvocation> for PlanHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl PlanHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/request_permissions.rs b/codex-rs/core/src/tools/handlers/request_permissions.rs
index a20ff2b665..7c24f15697 100644
--- a/codex-rs/core/src/tools/handlers/request_permissions.rs
+++ b/codex-rs/core/src/tools/handlers/request_permissions.rs
@@ -38,6 +38,15 @@ impl ToolExecutor<ToolInvocation> for RequestPermissionsHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl RequestPermissionsHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/request_plugin_install.rs b/codex-rs/core/src/tools/handlers/request_plugin_install.rs
index ce5bb3fb1f..64625aaac0 100644
--- a/codex-rs/core/src/tools/handlers/request_plugin_install.rs
+++ b/codex-rs/core/src/tools/handlers/request_plugin_install.rs
@@ -65,6 +65,15 @@ impl ToolExecutor<ToolInvocation> for RequestPluginInstallHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl RequestPluginInstallHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
payload,
diff --git a/codex-rs/core/src/tools/handlers/request_user_input.rs b/codex-rs/core/src/tools/handlers/request_user_input.rs
index 0aa4b4f6f8..3f3adf0ba3 100644
--- a/codex-rs/core/src/tools/handlers/request_user_input.rs
+++ b/codex-rs/core/src/tools/handlers/request_user_input.rs
@@ -33,6 +33,15 @@ impl ToolExecutor<ToolInvocation> for RequestUserInputHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl RequestUserInputHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/shell/shell_command.rs b/codex-rs/core/src/tools/handlers/shell/shell_command.rs
index 7c492b3646..e9fcf82046 100644
--- a/codex-rs/core/src/tools/handlers/shell/shell_command.rs
+++ b/codex-rs/core/src/tools/handlers/shell/shell_command.rs
@@ -144,6 +144,15 @@ impl ToolExecutor<ToolInvocation> for ShellCommandHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ShellCommandHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/test_sync.rs b/codex-rs/core/src/tools/handlers/test_sync.rs
index 0e5fe894ad..802859c916 100644
--- a/codex-rs/core/src/tools/handlers/test_sync.rs
+++ b/codex-rs/core/src/tools/handlers/test_sync.rs
@@ -74,6 +74,15 @@ impl ToolExecutor<ToolInvocation> for TestSyncHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl TestSyncHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation { payload, .. } = invocation;
diff --git a/codex-rs/core/src/tools/handlers/tool_search.rs b/codex-rs/core/src/tools/handlers/tool_search.rs
index 2de1e20dd4..a4781e75e2 100644
--- a/codex-rs/core/src/tools/handlers/tool_search.rs
+++ b/codex-rs/core/src/tools/handlers/tool_search.rs
@@ -70,6 +70,15 @@ impl ToolExecutor<ToolInvocation> for ToolSearchHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ToolSearchHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation { payload, .. } = invocation;
diff --git a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
index ba69f0d039..9fe3b343b5 100644
--- a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
+++ b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
@@ -95,6 +95,15 @@ impl ToolExecutor<ToolInvocation> for ExecCommandHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ExecCommandHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
index a639ea0065..9b319d5433 100644
--- a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
+++ b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
@@ -44,6 +44,15 @@ impl ToolExecutor<ToolInvocation> for WriteStdinHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl WriteStdinHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let ToolInvocation {
session,
diff --git a/codex-rs/core/src/tools/handlers/view_image.rs b/codex-rs/core/src/tools/handlers/view_image.rs
index 5a67db1a66..eb761359a7 100644
--- a/codex-rs/core/src/tools/handlers/view_image.rs
+++ b/codex-rs/core/src/tools/handlers/view_image.rs
@@ -81,6 +81,15 @@ impl ToolExecutor<ToolInvocation> for ViewImageHandler {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+}
+
+impl ViewImageHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
if !invocation
.turn
diff --git a/codex-rs/core/src/tools/parallel.rs b/codex-rs/core/src/tools/parallel.rs
index 7db1ec9643..a6f630a342 100644
--- a/codex-rs/core/src/tools/parallel.rs
+++ b/codex-rs/core/src/tools/parallel.rs
@@ -314,6 +314,15 @@ mod tests {
async fn handle(
&self,
invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call(invocation).await
+ }
+ }
+
+ impl CancellationCleanupHandler {
+ async fn handle_call(
+ &self,
+ invocation: ToolInvocation,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
let started = self
.started
diff --git a/codex-rs/core/src/tools/registry_tests.rs b/codex-rs/core/src/tools/registry_tests.rs
index f2566251c5..cc7f39e2a3 100644
--- a/codex-rs/core/src/tools/registry_tests.rs
+++ b/codex-rs/core/src/tools/registry_tests.rs
@@ -51,6 +51,14 @@ impl ToolExecutor<ToolInvocation> for LifecycleTestHandler {
async fn handle(
&self,
_invocation: ToolInvocation,
+ ) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
+ self.handle_call().await
+ }
+}
+
+impl LifecycleTestHandler {
+ async fn handle_call(
+ &self,
) -> Result<Box<dyn crate::tools::context::ToolOutput>, FunctionCallError> {
match self.result.clone() {
LifecycleTestResult::Ok { success } => Ok(Box::new(
diff --git a/codex-rs/core/src/tools/router_tests.rs b/codex-rs/core/src/tools/router_tests.rs
index 7c3e0157bc..a9a52ca463 100644
--- a/codex-rs/core/src/tools/router_tests.rs
+++ b/codex-rs/core/src/tools/router_tests.rs
@@ -76,6 +76,15 @@ impl ToolExecutor<ExtensionToolCall> for ExtensionEchoExecutor {
async fn handle(
&self,
call: ExtensionToolCall,
+ ) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
+ self.handle_call(call).await
+ }
+}
+
+impl ExtensionEchoExecutor {
+ async fn handle_call(
+ &self,
+ call: ExtensionToolCall,
) -> Result<Box<dyn codex_tools::ToolOutput>, codex_tools::FunctionCallError> {
let arguments: serde_json::Value =
serde_json::from_str(call.function_arguments()?).expect("test arguments should parse");
diff --git a/codex-rs/ext/image-generation/src/tool.rs b/codex-rs/ext/image-generation/src/tool.rs
index 69b99bdbc4..70880b4661 100644
--- a/codex-rs/ext/image-generation/src/tool.rs
+++ b/codex-rs/ext/image-generation/src/tool.rs
@@ -97,6 +97,12 @@ impl ToolExecutor<ToolCall> for ImageGenerationTool {
/// Executes the selected image operation and returns the completed image result.
async fn handle(&self, call: ToolCall) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
+ self.handle_call(call).await
+ }
+}
+
+impl ImageGenerationTool {
+ async fn handle_call(&self, call: ToolCall) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
let args = parse_args(&call)?;
let request = request_for_args(&args, call.conversation_history.items())?;
call.turn_item_emitter
diff --git a/codex-rs/ext/memories/src/tools/ad_hoc_note.rs b/codex-rs/ext/memories/src/tools/ad_hoc_note.rs
index a6712a4022..3495d57d32 100644
--- a/codex-rs/ext/memories/src/tools/ad_hoc_note.rs
+++ b/codex-rs/ext/memories/src/tools/ad_hoc_note.rs
@@ -61,6 +61,19 @@ where
&self,
call: ToolCall,
) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
+ {
+ self.handle_call(call).await
+ }
+}
+
+impl<B> AddAdHocNoteTool<B>
+where
+ B: MemoriesBackend,
+{
+ async fn handle_call(
+ &self,
+ call: ToolCall,
+ ) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
{
let backend = self.backend.clone();
let args: AddAdHocNoteArgs = parse_args(&call)?;
diff --git a/codex-rs/ext/memories/src/tools/list.rs b/codex-rs/ext/memories/src/tools/list.rs
index 301c7cab71..d3b23b1ca2 100644
--- a/codex-rs/ext/memories/src/tools/list.rs
+++ b/codex-rs/ext/memories/src/tools/list.rs
@@ -59,6 +59,19 @@ where
&self,
call: ToolCall,
) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
+ {
+ self.handle_call(call).await
+ }
+}
+
+impl<B> ListTool<B>
+where
+ B: MemoriesBackend,
+{
+ async fn handle_call(
+ &self,
+ call: ToolCall,
+ ) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
{
let backend = self.backend.clone();
let args: ListArgs = parse_args(&call)?;
diff --git a/codex-rs/ext/memories/src/tools/read.rs b/codex-rs/ext/memories/src/tools/read.rs
index 33ede3c600..e408a17cad 100644
--- a/codex-rs/ext/memories/src/tools/read.rs
+++ b/codex-rs/ext/memories/src/tools/read.rs
@@ -58,6 +58,19 @@ where
&self,
call: ToolCall,
) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
+ {
+ self.handle_call(call).await
+ }
+}
+
+impl<B> ReadTool<B>
+where
+ B: MemoriesBackend,
+{
+ async fn handle_call(
+ &self,
+ call: ToolCall,
+ ) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
{
let backend = self.backend.clone();
let args: ReadArgs = parse_args(&call)?;
diff --git a/codex-rs/ext/memories/src/tools/search.rs b/codex-rs/ext/memories/src/tools/search.rs
index 1d05072703..cc8ba201a6 100644
--- a/codex-rs/ext/memories/src/tools/search.rs
+++ b/codex-rs/ext/memories/src/tools/search.rs
@@ -67,6 +67,19 @@ where
&self,
call: ToolCall,
) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
+ {
+ self.handle_call(call).await
+ }
+}
+
+impl<B> SearchTool<B>
+where
+ B: MemoriesBackend,
+{
+ async fn handle_call(
+ &self,
+ call: ToolCall,
+ ) -> Result<Box<dyn codex_extension_api::ToolOutput>, codex_extension_api::FunctionCallError>
{
let backend = self.backend.clone();
let args: SearchArgs = parse_args(&call)?;
diff --git a/codex-rs/ext/web-search/src/tool.rs b/codex-rs/ext/web-search/src/tool.rs
index 35f126dd6b..1de65edf86 100644
--- a/codex-rs/ext/web-search/src/tool.rs
+++ b/codex-rs/ext/web-search/src/tool.rs
@@ -75,6 +75,12 @@ impl ToolExecutor<ToolCall> for WebSearchTool {
}
async fn handle(&self, call: ToolCall) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
+ self.handle_call(call).await
+ }
+}
+
+impl WebSearchTool {
+ async fn handle_call(&self, call: ToolCall) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
let commands = parse_commands(&call)?;
let command_action = command_action(&commands);
let provider = self