Add structured asynchronous user input requests (#42178)

## What changed

- Replace `send_user_message_async` with `request_user_input_async`, accepting one or more questions with optional suggested answers while allowing the turn to continue.
- Attach structured question metadata to asynchronous agent messages while retaining readable fallback text, and preserve it through app-server events, thread history, and generated schemas.
- Continue enabling the new tool for model catalogs that advertise either the old or new tool name.

## Testing

- Cover tool registration, question validation, emitted items, continued turn execution, history preservation, and backwards-compatible deserialization.

GitOrigin-RevId: ffc49aebde2e854c3c50a122aa52805fec3fc6b3
This commit is contained in:
rka-oai authored and copyberry committed 2026-09-02 02:09:35 +00:00
1 parent b21f2e3081
commit 2c79ee6dac
80 files changed
+1110 -146

No files matched your search

+1
View File
@@ -1043,6 +1043,7 @@ mod tests {
phase: Some(MessagePhase::Commentary),
memory_citation: None,
delivery: None,
questions: None,
})),
RolloutItem::ResponseItem(
ResponseItem::FunctionCallOutput {
@@ -95,6 +95,7 @@ pub(super) fn completed_item(
phase: event.phase.clone(),
memory_citation: event.memory_citation.clone(),
delivery: event.delivery,
questions: event.questions.clone(),
}),
None,
)),
@@ -160,6 +160,7 @@ fn agent_message(text: &str) -> RolloutItem {
phase: None,
memory_citation: None,
delivery: None,
questions: None,
}))
}
@@ -232,6 +232,7 @@ async fn split_homes_support_backfill_listing_and_paginated_history() {
phase: None,
memory_citation: None,
delivery: None,
questions: None,
}),
),
turn_completed("turn-1"),
@@ -325,6 +326,7 @@ async fn paginated_live_append_materializes_turn_items_and_state() {
phase: None,
memory_citation: None,
delivery: None,
questions: None,
}),
),
turn_completed("turn-1"),
@@ -480,6 +482,7 @@ async fn paginated_realtime_items_materialize_separately_in_rollout_order() {
phase: None,
memory_citation: None,
delivery: None,
questions: None,
}),
),
RolloutItem::RealtimeItem(RealtimeItem {
@@ -2669,6 +2672,7 @@ fn agent_message(id: &str, phase: MessagePhase) -> TurnItem {
phase: Some(phase),
memory_citation: None,
delivery: None,
questions: None,
})
}