Stamp conversation history items with creation times (#38272)

## What changed

- Add fractional Unix creation times to locally authored user, developer, agent, and tool-output items when they enter durable conversation history.
- Preserve any creation time already supplied with an item across subsequent requests, remote compaction, and resumed history.

## Testing

- Cover timestamp assignment and preservation in session, client, tool, agent-spawn, and remote-compaction tests.

GitOrigin-RevId: 431d1770b9746005c808bc0a43953845166d68ad
This commit is contained in:
ashwinnathan-openai
2026-08-12 23:04:42 +00:00
committed by copyberry
parent 842fae26c9
commit 361fe2d202
10 changed files with 196 additions and 22 deletions
@@ -382,8 +382,15 @@ mod tests {
session
.record_conversation_items(&turn, std::slice::from_ref(&history_item))
.await;
let mut expected_history_item = history_item.clone();
expected_history_item.set_turn_id_if_missing(&turn_id);
let expected_history_item = strip_response_item_id(
session
.clone_history()
.await
.raw_items()
.next()
.expect("history item")
.clone(),
);
let raw_history_event = rx.recv().await.expect("history raw response item event");
let EventMsg::RawResponseItem(raw_history_item) = raw_history_event.msg else {
panic!("expected raw response item event");
+7 -2
View File
@@ -545,8 +545,13 @@ async fn extension_tool_executors_are_model_visible_and_dispatchable() -> anyhow
session
.record_conversation_items(&turn, std::slice::from_ref(&history_item))
.await;
let mut expected_history_item = history_item.clone();
expected_history_item.set_turn_id_if_missing(&turn.sub_id);
let expected_history_item = session
.clone_history()
.await
.raw_items()
.next()
.expect("history item")
.clone();
let router = test_tool_router(
step_context.as_ref(),