mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Forward Guardian reviewer events to parent raw-event subscribers (#56124)
## What changed Add the disabled-by-default `guardian_recorded_items` feature to forward recorded reviewer items and interruptions through the parent's raw-event subscription, preserving reviewer thread and turn IDs without modifying the parent's history or completing its turn. Emit reviewer items as `rawResponseItem/completed` notifications and interruptions as interrupted `turn/completed` notifications. Mark opted-in reviewer requests with `guardian_recorded_items` metadata. ## Testing Extend Guardian integration tests to cover reviewer identity, recorded-item metadata replay, concurrent reviewer interruptions, independent parent completion, and behavior without the feature enabled. GitOrigin-RevId: beb4dbf6c6f2a800a2fbf3cfd11ae174a1382386
This commit is contained in:
@@ -1653,6 +1653,12 @@ pub enum EventMsg {
|
||||
RawResponseItem(RawResponseItemEvent),
|
||||
RawResponseCompleted(RawResponseCompletedEvent),
|
||||
|
||||
/// In-process delivery from a private reviewer through its parent's subscription.
|
||||
#[serde(skip)]
|
||||
#[schemars(skip)]
|
||||
#[ts(skip)]
|
||||
PrivateSessionEvent(PrivateSessionEvent),
|
||||
|
||||
ItemStarted(ItemStartedEvent),
|
||||
ItemCompleted(ItemCompletedEvent),
|
||||
HookStarted(HookStartedEvent),
|
||||
@@ -2042,6 +2048,20 @@ pub struct RawResponseItemEvent {
|
||||
pub item: ResponseItem,
|
||||
}
|
||||
|
||||
/// Observer events that a private session forwards without modifying its parent's history.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PrivateSessionEvent {
|
||||
pub thread_id: ThreadId,
|
||||
pub event: PrivateSessionEventPayload,
|
||||
}
|
||||
|
||||
/// Recorded state and cancellation needed by observers awaiting response acceptance.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PrivateSessionEventPayload {
|
||||
RecordedItem(RawResponseItemEvent),
|
||||
TurnAborted(TurnAbortedEvent),
|
||||
}
|
||||
|
||||
/// Exact usage and metadata reported by one upstream Responses API completion.
|
||||
///
|
||||
/// Unlike TokenCountEvent, this is not accumulated, estimated, or replayed.
|
||||
|
||||
Reference in New Issue
Block a user