Preserve host-assigned user input IDs in Responses messages (#57538)

## What changed

Add optional `TurnInputRequest.user_item_uuid` and carry it through turn starts and steering to the recorded user message. When supplied, use `msg_input_<uuid>` as the Responses item ID; inputs without a UUID retain generated IDs. Raw response items ignore this field.

Add `ResponseItemId` helpers to construct and recognize the reserved `msg_input_` namespace.

## Testing

Add regression coverage for steered inputs with identical text and client IDs, checking that each supplied UUID survives recording and UI item IDs remain distinct. Add a scenario test verifying that the assigned ID reaches Responses and persists in subsequent request history alongside an identical ordinary prompt.

GitOrigin-RevId: 440e306bfdaa7facb69b21930c5244a83db2fdae
This commit is contained in:
Zack Brunson
2026-10-27 19:00:03 +00:00
committed by copyberry
parent 4d3ed3f3b4
commit e3149ddb11
8 changed files with 222 additions and 14 deletions
+3
View File
@@ -24,6 +24,9 @@ use tokio_util::task::AbortOnDropHandle;
pub struct UserInputMetadata {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub acceptance_order: Option<u64>,
/// Optional host-assigned UUID for this particular Responses user item.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub response_item_uuid: Option<uuid::Uuid>,
#[serde(
default,
skip_serializing_if = "codex_history::UserInputOrigin::is_user"