Add async delivery metadata to agent messages (#39312)

## What changed

- Add an optional `delivery` field to agent message events and app-server
  `agentMessage` items, with `"async"` identifying a user-visible message sent
  without ending the current turn.
- Preserve the marker through legacy event conversion, thread history
  materialization, replay, and generated JSON and TypeScript schemas.
- Require delivery of async agent message completion notifications on the
  in-process app-server transport.

## Testing

- Cover preservation of async delivery metadata in thread history.
- Cover delivery-required classification for async agent messages.

GitOrigin-RevId: f92ba25de1293ee271404badfdf0d117d6530329
This commit is contained in:
rka-oai
2026-08-18 23:05:52 +00:00
committed by copyberry
parent 7d9990fa30
commit fb356f3d2c
64 changed files with 467 additions and 21 deletions
@@ -250,6 +250,7 @@ fn final_message_from_turn_items_uses_latest_agent_message() {
text: "first".to_string(),
phase: None,
memory_citation: None,
delivery: None,
},
ThreadItem::Plan {
id: "plan-1".to_string(),
@@ -260,6 +261,7 @@ fn final_message_from_turn_items_uses_latest_agent_message() {
text: "second".to_string(),
phase: None,
memory_citation: None,
delivery: None,
},
]);
@@ -318,6 +320,7 @@ fn turn_completed_recovers_final_message_from_turn_items() {
text: "final answer".to_string(),
phase: None,
memory_citation: None,
delivery: None,
}],
status: TurnStatus::Completed,
error: None,
@@ -366,6 +369,7 @@ fn turn_completed_overwrites_stale_final_message_from_turn_items() {
text: "final answer".to_string(),
phase: None,
memory_citation: None,
delivery: None,
}],
status: TurnStatus::Completed,
error: None,
@@ -18,6 +18,7 @@ fn failed_turn_does_not_overwrite_output_last_message_file() {
text: "partial answer".to_string(),
phase: None,
memory_citation: None,
delivery: None,
},
thread_id: "thread-1".to_string(),
turn_id: "turn-1".to_string(),
+2
View File
@@ -363,6 +363,7 @@ fn turn_items_for_thread_returns_matching_turn_items() {
text: "hello".to_string(),
phase: None,
memory_citation: None,
delivery: None,
}],
status: codex_app_server_protocol::TurnStatus::Completed,
error: None,
@@ -393,6 +394,7 @@ fn turn_items_for_thread_returns_matching_turn_items() {
text: "hello".to_string(),
phase: None,
memory_citation: None,
delivery: None,
}])
);
assert_eq!(turn_items_for_thread(&thread, "missing-turn"), None);