Scope extension capabilities to invocation lifetimes (#41020)

## What changed

- Add callback lifetimes to extension `ToolCall`, `ToolEnvironment`, turn-input context, and skill-read request types.
- Require extension tool executors to handle calls for any invocation lifetime and tie their returned futures to that lifetime.
- Update built-in extensions, adapters, and tests to use the lifetime-scoped APIs without retaining host-owned environment capabilities.

GitOrigin-RevId: aca9ce3a1b6870df550bc84ec9308cc65533f161
This commit is contained in:
Adam Perry @ OpenAI authored and copyberry committed 2026-08-27 02:00:31 +00:00
1 parent eed1dee69e
commit 81e180044d
85 files changed
+477 -202

No files matched your search

+5 -5
View File
@@ -25,6 +25,7 @@ use codex_protocol::protocol::SessionSource;
use codex_protocol::protocol::SubAgentSource;
use codex_protocol::protocol::TurnAbortReason;
use codex_protocol::protocol::WarningEvent;
use futures::future::BoxFuture;
use std::sync::Arc;
use tokio::sync::oneshot;
use tokio::time::Instant;
@@ -748,9 +749,8 @@ pub(crate) async fn review_approval_request(
request: GuardianApprovalRequest,
reasons: ApprovalRequestReasons,
) -> ReviewDecision {
// Box the delegated review future so callers do not inline the entire
// guardian session state machine into their own async stack.
Box::pin(run_guardian_review(
// Erase the delegated future to bound its async state and the tool handlers' Send checks.
let review: BoxFuture<'_, ReviewDecision> = Box::pin(run_guardian_review(
Arc::clone(session),
context.into(),
review_id,
@@ -761,8 +761,8 @@ pub(crate) async fn review_approval_request(
approval_request_source: GuardianApprovalRequestSource::MainTurn,
external_cancel: None,
},
))
.await
));
review.await
}
pub(crate) async fn review_approval_request_with_cancel(