mirror of
https://github.com/openai/codex.git
synced 2026-11-13 22:47:20 +00:00
[codex] Remove async_trait from ToolExecutor (#27304)
## Why We're now [discouraging use of `async_trait`](https://github.com/openai/codex/pull/20242). Removing use of `async_trait` from `ToolExecutor` yields a `codex_core` debug test build speedup of ~78% (from 227.5s to 50.3s) on my machine. Stacked on #27299, this PR applies the trait change after the handler bodies have been outlined. ## What Changed `ToolExecutor::handle` to return an explicit boxed `ToolExecutorFuture` instead of using `async_trait`. Updated ToolExecutor implementors to return `Box::pin(...)`, reexported the future alias through `codex-tools` and `codex-extension-api`, and removed `codex-tools` direct `async-trait` dependency.
This commit is contained in:
1 parent
d3abd8774e
commit
2704ecea9a
56 files changed
+161
-357
No files matched your search
@@ -44,7 +44,6 @@ impl codex_extension_api::ToolContributor for ExtensionEchoContributor {
|
||||
|
||||
struct ExtensionEchoExecutor;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl ToolExecutor<ExtensionToolCall> for ExtensionEchoExecutor {
|
||||
fn tool_name(&self) -> ToolName {
|
||||
ToolName::namespaced("extension/", "echo")
|
||||
@@ -73,11 +72,8 @@ 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
|
||||
fn handle(&self, call: ExtensionToolCall) -> codex_tools::ToolExecutorFuture<'_> {
|
||||
Box::pin(self.handle_call(call))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +89,7 @@ impl ExtensionEchoExecutor {
|
||||
"callId": call.call_id,
|
||||
"conversationHistory": call.conversation_history.items(),
|
||||
"ok": true,
|
||||
}))))
|
||||
}))) as Box<dyn codex_tools::ToolOutput>)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user