mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
Simplify tool executor lifetimes (#64159)
## Why Extension tools borrow host capabilities for each call. Expressing that borrow in the executor's type argument requires higher-ranked lifetime bounds wherever extension executors are stored or returned. ## What changed Define the per-call input as `ToolInput::Call<'a>` so `ToolExecutor` can use the same lifetime for the input, the executor borrow, and the returned future while remaining usable as a trait object. Default to borrowed `ToolCall<'a>` inputs so extension contributors can return `Arc<dyn ToolExecutor>`. Core handlers continue to take owned `ToolInvocation` inputs. GitOrigin-RevId: efbf56c1e758c59a18b192d210c2ab1b368793e2
This commit is contained in:
@@ -10,7 +10,6 @@ use codex_exec_server_protocol::ExecutorCapabilityDiscoveryV2Snapshot;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::protocol::TokenUsageInfo;
|
||||
use codex_tools::ToolCall;
|
||||
use codex_tools::ToolExecutor;
|
||||
|
||||
use crate::ExtensionData;
|
||||
@@ -429,7 +428,7 @@ pub trait ToolContributor: Send + Sync {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
@@ -439,7 +438,7 @@ pub trait ToolContributor: Send + Sync {
|
||||
session_store: &ExtensionData,
|
||||
thread_store: &ExtensionData,
|
||||
_step_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
self.tools(session_store, thread_store)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ use codex_extension_api::ResponseItem;
|
||||
use codex_extension_api::SkillInvocationContributor;
|
||||
use codex_extension_api::ThreadLifecycleContributor;
|
||||
use codex_extension_api::TokenUsageContributor;
|
||||
use codex_extension_api::ToolCall;
|
||||
use codex_extension_api::ToolContributor;
|
||||
use codex_extension_api::ToolExecutor;
|
||||
use codex_extension_api::ToolLifecycleContributor;
|
||||
@@ -179,7 +178,7 @@ impl ToolContributor for AllContributors {
|
||||
&self,
|
||||
_session_store: &ExtensionData,
|
||||
_thread_store: &ExtensionData,
|
||||
) -> Vec<Arc<dyn for<'call> ToolExecutor<ToolCall<'call>>>> {
|
||||
) -> Vec<Arc<dyn ToolExecutor>> {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user