Remove the done prefix from TUI completion timestamps (#46067)

## What changed

Render completion footers as `2:32 PM` or `Worked for 2m 5s · 2:32 PM`, with the existing date formatting for older completions.

Update test helpers to identify completion footer cells by type when normalizing or excluding timestamps, preserving message text that resembles a completion footer.

## Testing

Update completion label and transcript snapshots, and add assertions that timestamp normalization preserves ordinary message text while normalizing completion footer cells.

GitOrigin-RevId: 35f1658db02f8527212c006fd7492b574a105304
This commit is contained in:
Eric Traut
2026-09-17 01:19:38 +00:00
committed by copyberry
parent 40584fad87
commit e22e6523eb
25 changed files with 157 additions and 144 deletions
+19 -29
View File
@@ -888,15 +888,12 @@ async fn unified_exec_wait_after_final_agent_message_snapshot() {
complete_assistant_message(&mut chat, "msg-1", "Final response.", /*phase*/ None);
handle_turn_completed(&mut chat, "turn-1", /*duration_ms*/ None);
let cells = drain_insert_history(&mut rx);
let cells = drain_insert_history_normalized(&mut rx);
let combined = cells
.iter()
.map(|lines| lines_to_single_string(lines))
.collect::<String>();
assert_chatwidget_snapshot!(
"unified_exec_wait_after_final_agent_message",
normalize_completion_timestamps(combined)
);
assert_chatwidget_snapshot!("unified_exec_wait_after_final_agent_message", combined);
}
#[tokio::test]
@@ -915,15 +912,12 @@ async fn unified_exec_wait_before_streamed_agent_message_snapshot() {
handle_agent_message_delta(&mut chat, "Streaming response.");
handle_turn_completed(&mut chat, "turn-wait-1", /*duration_ms*/ None);
let cells = drain_insert_history(&mut rx);
let cells = drain_insert_history_normalized(&mut rx);
let combined = cells
.iter()
.map(|lines| lines_to_single_string(lines))
.collect::<String>();
assert_chatwidget_snapshot!(
"unified_exec_wait_before_streamed_agent_message",
normalize_completion_timestamps(combined)
);
assert_chatwidget_snapshot!("unified_exec_wait_before_streamed_agent_message", combined);
}
#[tokio::test]
@@ -954,19 +948,21 @@ async fn final_worked_for_uses_cumulative_turn_duration_snapshot() {
);
handle_turn_completed(&mut chat, "turn-1", duration_ms);
let cells = drain_insert_history(&mut rx);
let cells = drain_insert_history_with(&mut rx, |cell| {
let rendered = lines_to_single_string(&cell.display_lines(/*width*/ 80));
if cell.as_any().is::<history_cell::FinalMessageSeparator>() {
assert!(rendered.contains("Worked for 2m 5s"), "{rendered}");
}
normalize_completion_timestamps(cell, rendered)
.lines()
.map(|line| Line::from(line.to_owned()))
.collect()
});
let combined = cells
.iter()
.map(|lines| lines_to_single_string(lines))
.collect::<String>();
assert!(
combined.contains("Worked for 2m 5s"),
"expected final separator to use cumulative turn duration, got:\n{combined}"
);
assert_chatwidget_snapshot!(
"final_worked_for_uses_cumulative_turn_duration",
normalize_completion_timestamps(combined)
);
assert_chatwidget_snapshot!("final_worked_for_uses_cumulative_turn_duration", combined);
}
}
@@ -1033,15 +1029,12 @@ async fn unified_exec_waiting_multiple_empty_snapshots() {
handle_turn_completed(&mut chat, "turn-wait-3", /*duration_ms*/ None);
let cells = drain_insert_history(&mut rx);
let cells = drain_insert_history_normalized(&mut rx);
let combined = cells
.iter()
.map(|lines| lines_to_single_string(lines))
.collect::<String>();
assert_chatwidget_snapshot!(
"unified_exec_waiting_multiple_empty_after",
normalize_completion_timestamps(combined)
);
assert_chatwidget_snapshot!("unified_exec_waiting_multiple_empty_after", combined);
}
#[tokio::test]
@@ -1108,7 +1101,7 @@ async fn unified_exec_non_empty_then_empty_snapshots() {
handle_turn_completed(&mut chat, "turn-1", /*duration_ms*/ None);
let post_cells = drain_insert_history(&mut rx);
let post_cells = drain_insert_history_normalized(&mut rx);
let mut combined = pre_cells
.iter()
.map(|lines| lines_to_single_string(lines))
@@ -1121,10 +1114,7 @@ async fn unified_exec_non_empty_then_empty_snapshots() {
combined.push('\n');
}
combined.push_str(&post);
assert_chatwidget_snapshot!(
"unified_exec_non_empty_then_empty_after",
normalize_completion_timestamps(combined)
);
assert_chatwidget_snapshot!("unified_exec_non_empty_then_empty_after", combined);
}
#[tokio::test]