Track image generation request IDs in analytics (#40714)

## What changed

- Read `x-codex-imagegen-request-id` from image generation and edit responses.
- Propagate the ID to `codex_image_generation_event` analytics.
- Keep the ID in process only, excluding it from extension item serialization, generated types, app-server wire data, and rollout history.

## Testing

- Cover response-header extraction and missing-header behavior in the images client.
- Verify end-to-end analytics emission and the unchanged image-generation item wire shape.

GitOrigin-RevId: 9b8e09b7d655c0c2faa84f0eee99aabae583668d
This commit is contained in:
Chris Dong
2026-08-25 21:38:10 +00:00
committed by copyberry
parent 1bc02aea50
commit 346c4db7c2
16 changed files with 124 additions and 24 deletions
@@ -859,6 +859,7 @@ impl ThreadHistoryBuilder {
transparent_background: None,
failure: None,
saved_path: None,
imagegen_request_id: None,
});
self.upsert_item_in_current_turn(item);
}
@@ -872,6 +873,7 @@ impl ThreadHistoryBuilder {
transparent_background: payload.transparent_background,
failure: payload.failure.clone(),
saved_path: payload.saved_path.clone(),
imagegen_request_id: None,
});
self.upsert_item_in_current_turn(item);
}
@@ -2083,6 +2085,7 @@ mod tests {
transparent_background: Some(true),
failure: None,
saved_path: Some(saved_path.clone()),
imagegen_request_id: None,
},
)),
started_at_ms: Some(0),
@@ -2115,6 +2118,7 @@ mod tests {
transparent_background: Some(true),
failure: None,
saved_path: Some(saved_path),
imagegen_request_id: None,
})]
);
}
@@ -2432,6 +2436,7 @@ mod tests {
},
),
saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()),
imagegen_request_id: None,
}),
],
}
@@ -973,6 +973,7 @@ impl From<CoreTurnItem> for ThreadItem {
transparent_background: None,
failure: None,
saved_path: image.saved_path,
imagegen_request_id: None,
})
}
CoreTurnItem::EnteredReviewMode(review) => ThreadItem::EnteredReviewMode {