mirror of
https://github.com/openai/codex.git
synced 2026-11-23 15:18:14 +00:00
Add Guardian internal session support (#39994)
## What changed - Add an extension API for spawning host-owned internal sessions and a `ThreadReadyInput` lifecycle callback that runs after thread registration. - Add Guardian reviewer session scaffolding that records the parent thread and effective model, plus the under-development `guardian_ext` feature flag. - Start internal sessions with fresh history while preserving parent lineage, shared session controls, and internal-thread visibility rules. - Scope internal-session prompt cache keys to their source and parent thread, and expose `guardian` as an internal session source. ## Testing - Cover internal-session spawning, parent metadata, history isolation, prompt cache keys, and extension spawner argument forwarding. GitOrigin-RevId: 682dae80397d62bb36247796b447042e760ca364
This commit is contained in:
1 parent
79b7606803
commit
56012fafb8
22 files changed
+402
-10
No files matched your search
@@ -0,0 +1,38 @@
|
||||
use codex_protocol::ThreadId;
|
||||
|
||||
use super::agent::AgentSpawnFuture;
|
||||
|
||||
/// Future returned by one host-owned internal-session spawning request.
|
||||
pub type InternalSessionSpawnFuture<'a, T, E> = AgentSpawnFuture<'a, T, E>;
|
||||
|
||||
/// Constructor-injected host helper for extensions that need private internal sessions.
|
||||
///
|
||||
/// The extension owns the request shape and resulting handle types. The host
|
||||
/// provides the implementation when it constructs the extension.
|
||||
pub trait InternalSessionSpawner<R>: Send + Sync {
|
||||
type Spawned;
|
||||
type Error;
|
||||
|
||||
/// Starts a fresh host-owned internal session associated with its parent.
|
||||
fn spawn_internal_session<'a>(
|
||||
&'a self,
|
||||
parent_thread_id: ThreadId,
|
||||
request: R,
|
||||
) -> InternalSessionSpawnFuture<'a, Self::Spawned, Self::Error>;
|
||||
}
|
||||
|
||||
impl<R, S, E, F> InternalSessionSpawner<R> for F
|
||||
where
|
||||
F: Fn(ThreadId, R) -> InternalSessionSpawnFuture<'static, S, E> + Send + Sync,
|
||||
{
|
||||
type Spawned = S;
|
||||
type Error = E;
|
||||
|
||||
fn spawn_internal_session<'a>(
|
||||
&'a self,
|
||||
parent_thread_id: ThreadId,
|
||||
request: R,
|
||||
) -> InternalSessionSpawnFuture<'a, Self::Spawned, Self::Error> {
|
||||
self(parent_thread_id, request)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
mod agent;
|
||||
mod conversation_history;
|
||||
mod events;
|
||||
mod internal_session;
|
||||
mod metrics;
|
||||
mod response_items;
|
||||
|
||||
@@ -10,6 +11,8 @@ pub use conversation_history::ConversationHistorySnapshot;
|
||||
pub use events::ExtensionEventSink;
|
||||
pub use events::ExtensionWarning;
|
||||
pub use events::NoopExtensionEventSink;
|
||||
pub use internal_session::InternalSessionSpawnFuture;
|
||||
pub use internal_session::InternalSessionSpawner;
|
||||
pub use metrics::ExtensionMetrics;
|
||||
pub use response_items::NoopResponseItemInjector;
|
||||
pub use response_items::ResponseItemInjectionFuture;
|
||||
|
||||
Reference in new issue
Block a user