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:
jif authored and copyberry committed 2026-09-05 13:02:49 +00:00
1 parent a7a4321593
commit dee21ec1bc
32 files changed
+178 -362

No files matched your search

+7 -5
View File
@@ -1437,10 +1437,10 @@ async fn run_sampling_request(
let mut original_input = None;
let mut executed_tool_calls_by_output = HashMap::new();
loop {
// A retry must not lend a previous response's ticket to the next tool call.
// A retry must not attribute the next tool call to the previous response.
turn_context
.extension_data
.remove::<codex_protocol::guardian_ticket::GuardianTicket>();
.remove::<codex_api::ResponseId>();
let prompt_input = if let Some(input) = initial_input.take() {
input
} else {
@@ -2376,9 +2376,11 @@ async fn try_run_sampling_request(
record_turn_ttft_metric(&turn_context, &event).await;
match event {
ResponseEvent::Created { guardian_ticket } => {
if let Some(ticket) = guardian_ticket {
turn_context.extension_data.insert(ticket);
ResponseEvent::Created { response_id } => {
if let Some(response_id) = response_id {
turn_context
.extension_data
.insert(codex_api::ResponseId(response_id));
}
}
ResponseEvent::OutputItemDone(mut item) => {