Expose lifecycle timestamps on app-server thread items (#57172)

## What changed

- Add nullable `startedAtMs` and `completedAtMs` fields to `ThreadItem` in live notifications and turn history. Values are Unix milliseconds when recorded.
- Preserve recorded item times through history reconstruction, pagination, and resume, including command start times recorded during approval.
- Separate the Rust item payload into `ThreadItemPayload` while keeping the JSON payload flat, and update consumers, schemas, and generated TypeScript and Python types.

## Testing

Extend coverage for timestamp serialization, history reconstruction, paginated reads and resume, and persisted Python SDK items.

GitOrigin-RevId: ecbcee95af52db7c807b46a6e9deb30e5fba1f80
This commit is contained in:
Charlie Marsh
2026-10-26 18:13:00 +00:00
committed by copyberry
parent cf29971d93
commit a797dd7c6f
206 changed files with 4691 additions and 3089 deletions
@@ -2,6 +2,7 @@
use super::*;
use crate::history_cell::PlainHistoryCell;
use codex_app_server_protocol::ThreadItem;
use pretty_assertions::assert_eq;
fn cell(text: &str) -> Arc<dyn HistoryCell> {
@@ -360,7 +361,7 @@ fn folding_a_reasoning_only_page_retains_its_find_and_copy_revision() {
use crate::thread_transcript::RawReasoningVisibility;
use crate::thread_transcript::fold_trailing_activity_details;
use crate::thread_transcript::thread_items_to_transcript_cells;
use codex_app_server_protocol::ThreadItem;
use codex_app_server_protocol::ThreadItemPayload;
use codex_app_server_protocol::Turn;
use codex_app_server_protocol::TurnItemsView;
use codex_app_server_protocol::TurnStatus;
@@ -371,7 +372,7 @@ fn folding_a_reasoning_only_page_retains_its_find_and_copy_revision() {
"result": {"content": [{"type": "text", "text": "retained call output"}]}, "durationMs": 1
}))
.expect("computer call");
let reasoning = ThreadItem::Reasoning {
let reasoning = ThreadItemPayload::Reasoning {
id: "reasoning".to_owned(),
summary: vec!["retained needle text with exact spacing".to_owned()],
content: Vec::new(),
@@ -379,7 +380,7 @@ fn folding_a_reasoning_only_page_retains_its_find_and_copy_revision() {
let current = Turn {
id: "turn".to_owned(),
root_turn_id: None,
items: vec![call, reasoning],
items: vec![call, ThreadItem::untimed(reasoning)],
items_view: TurnItemsView::Full,
status: TurnStatus::Completed,
error: None,
@@ -387,11 +388,11 @@ fn folding_a_reasoning_only_page_retains_its_find_and_copy_revision() {
completed_at: None,
duration_ms: None,
};
let project = |items: &[ThreadItem]| {
let project = |items: &[codex_app_server_protocol::ThreadItem]| {
thread_items_to_transcript_cells(
/*thread_id*/ None,
&codex_utils_absolute_path::AbsolutePathBuf::current_dir().unwrap(),
items.iter().cloned(),
items.iter().map(|entry| entry.payload.clone()),
RawReasoningVisibility::Hidden,
/*config*/ None,
)