mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Replace Guardian tickets with parent response IDs (#43002)
## What changed Capture the ID from `response.created` and pass it as `parent_response_id` in Guardian review and classifier request metadata. Clear the current response ID before sampling retries so tool reviews cannot inherit a failed response's ID. Request Guardian credits with `guardian_credits_requested` on eligible parent requests. Remove the ticket protocol, transport attachment, and ticket-specific body redaction. Keep ordinary app-server client `parent_response_id` values inside `x-codex-turn-metadata` rather than promoting them to Guardian request metadata. ## Testing Update coverage for HTTP fallback, WebSocket review reuse, missing response IDs, classifier transport retries, and code-mode yield/resume attribution. Extend app-server tests to verify client metadata placement over HTTP and WebSocket. GitOrigin-RevId: c1665e56382ecec8d260fc2ca0ecd5e20b0b2391
This commit is contained in:
1 parent
a7a4321593
commit
dee21ec1bc
32 files changed
+178
-362
No files matched your search
@@ -88,8 +88,8 @@ const GUARDIAN_RECENT_ENTRY_LIMIT: usize = 40;
|
||||
/// step-scoped things past their lifetime (like MCP bindings)
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct GuardianReviewContext {
|
||||
/// Ticket from the response currently handled in this execution context.
|
||||
pub(crate) guardian_ticket: Option<codex_protocol::guardian_ticket::GuardianTicket>,
|
||||
/// The response currently handled in this execution context.
|
||||
pub(crate) parent_response_id: Option<String>,
|
||||
turn: Arc<TurnContext>,
|
||||
environments: TurnEnvironmentSnapshot,
|
||||
// Model and reasoning inputs are carried for the follow-up Guardian and V2 migrations.
|
||||
@@ -109,11 +109,10 @@ impl GuardianReviewContext {
|
||||
settings: &ResolvedStepSettings,
|
||||
) -> Self {
|
||||
Self {
|
||||
guardian_ticket: turn
|
||||
parent_response_id: turn
|
||||
.extension_data
|
||||
.get::<codex_protocol::guardian_ticket::GuardianTicket>()
|
||||
.as_deref()
|
||||
.cloned(),
|
||||
.get::<codex_api::ResponseId>()
|
||||
.map(|id| id.0.clone()),
|
||||
environments: turn.environments.clone(),
|
||||
model_info: Arc::clone(&settings.model_info),
|
||||
reasoning_effort: settings.reasoning_effort().cloned(),
|
||||
@@ -136,12 +135,11 @@ impl GuardianReviewContext {
|
||||
impl From<&Arc<StepContext>> for GuardianReviewContext {
|
||||
fn from(step: &Arc<StepContext>) -> Self {
|
||||
Self {
|
||||
guardian_ticket: step
|
||||
parent_response_id: step
|
||||
.turn
|
||||
.extension_data
|
||||
.get::<codex_protocol::guardian_ticket::GuardianTicket>()
|
||||
.as_deref()
|
||||
.cloned(),
|
||||
.get::<codex_api::ResponseId>()
|
||||
.map(|id| id.0.clone()),
|
||||
turn: Arc::clone(&step.turn),
|
||||
environments: step.environments.clone(),
|
||||
model_info: Arc::clone(&step.settings.model_info),
|
||||
@@ -156,11 +154,10 @@ impl From<&Arc<StepContext>> for GuardianReviewContext {
|
||||
impl From<Arc<TurnContext>> for GuardianReviewContext {
|
||||
fn from(turn: Arc<TurnContext>) -> Self {
|
||||
Self {
|
||||
guardian_ticket: turn
|
||||
parent_response_id: turn
|
||||
.extension_data
|
||||
.get::<codex_protocol::guardian_ticket::GuardianTicket>()
|
||||
.as_deref()
|
||||
.cloned(),
|
||||
.get::<codex_api::ResponseId>()
|
||||
.map(|id| id.0.clone()),
|
||||
environments: turn.environments.clone(),
|
||||
model_info: Arc::clone(turn.model_info()),
|
||||
reasoning_effort: turn.reasoning_effort().cloned(),
|
||||
|
||||
@@ -1300,8 +1300,14 @@ async fn run_review_on_session(
|
||||
}),
|
||||
..Default::default()
|
||||
})
|
||||
.with_responses_metadata(
|
||||
params
|
||||
.parent_context
|
||||
.parent_response_id
|
||||
.as_ref()
|
||||
.map(|id| HashMap::from([("parent_response_id".to_owned(), id.clone())])),
|
||||
)
|
||||
.on_start(TurnStartOptions {
|
||||
guardian_ticket: params.parent_context.guardian_ticket.clone(),
|
||||
final_output_json_schema: Some(params.schema.clone()),
|
||||
service_tier: None,
|
||||
parent_turn_id: Some(parent_turn.sub_id.clone()),
|
||||
|
||||
Reference in new issue
Block a user