Skip to content

Commit e22e652

Browse files
etraut-openaicopyberry
authored andcommitted
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
1 parent 40584fa commit e22e652

25 files changed

Lines changed: 157 additions & 144 deletions

‎codex-rs/tui/src/app/tests/safety_buffering.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ goals = true
923923
.as_any()
924924
.is::<crate::history_cell::FinalMessageSeparator>()
925925
{
926-
replayed_history.push_str(&normalize_completion_timestamps(rendered));
926+
replayed_history
927+
.push_str(&normalize_completion_timestamps(cell.as_ref(), rendered));
927928
} else {
928929
replayed_history.push_str(&rendered);
929930
}

‎codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__pagination_completion_tests__older_pagination_completion_footers_follow_answers_without_overlap_duplicates.snap‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: "snapshots.join(\"\\n\\n--- next overlapping page ---\\n\\n\")"
55
Earlier messages are available — press ctrl + t to view the full transcript
66
• Middle answer
77

8-
Worked for 2m 5s · done Sep 6, 2000 at 2:33 PM
8+
Worked for 2m 5s · Sep 6, 2000 at 2:33 PM
99

1010
--- next overlapping page ---
1111

@@ -15,12 +15,12 @@ Earlier messages are available — press ctrl + t to view the full transcript
1515

1616
• Oldest answer
1717

18-
Worked for 2m 5s · done Sep 6, 2000 at 2:32 PM
18+
Worked for 2m 5s · Sep 6, 2000 at 2:32 PM
1919

2020

2121
› Middle prompt
2222

2323

2424
• Middle answer
2525

26-
Worked for 2m 5s · done Sep 6, 2000 at 2:33 PM
26+
Worked for 2m 5s · Sep 6, 2000 at 2:33 PM

‎codex-rs/tui/src/app/tests/snapshots/codex_tui__app__tests__safety_buffering__safety_retry_committed_steer_history.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ expression: rendered_retry
44
---
55
› Handle the safety-buffered request
66
Keep the accepted steer
7-
⚠ Full-history hydration is deprecated for paginated threads; omit `includeTurns` or set it to `false`, then page with `thread/turns/list` and `thread/items/list`.• done done [completion time]
7+
⚠ Full-history hydration is deprecated for paginated threads; omit `includeTurns` or set it to `false`, then page with `thread/turns/list` and `thread/items/list`.• done [completion time]

‎codex-rs/tui/src/chatwidget/realtime_tests.rs‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::chatwidget::ChatWidget;
1313
use crate::chatwidget::ReplayKind;
1414
use crate::chatwidget::tests::make_chatwidget_manual_with_sender;
1515
use crate::chatwidget::tests::render_bottom_popup;
16+
use crate::history_cell::FinalMessageSeparator;
1617
use codex_app_server_protocol::AgentMessageDeltaNotification;
1718
use codex_app_server_protocol::ItemCompletedNotification;
1819
use codex_app_server_protocol::ItemStartedNotification;
@@ -138,19 +139,6 @@ fn finish_turn(
138139
);
139140
}
140141

141-
fn without_completion_metadata(rendered: &str) -> String {
142-
rendered
143-
.lines()
144-
.filter_map(|line| {
145-
let stable = line
146-
.split_once(" done ")
147-
.map_or(line, |(before, _)| before);
148-
(!stable.is_empty()).then_some(stable)
149-
})
150-
.collect::<Vec<_>>()
151-
.join("\n")
152-
}
153-
154142
#[path = "realtime_tests/caption_replay.rs"]
155143
mod caption_replay;
156144
#[path = "realtime_tests/handoff_privacy.rs"]

‎codex-rs/tui/src/chatwidget/realtime_tests/handoff_privacy.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,17 @@ async fn typed_steering_restores_normal_output_for_an_existing_voice_item() {
107107

108108
let mut rendered = String::new();
109109
while let Ok(event) = events.try_recv() {
110-
if let AppEvent::InsertHistoryCell(cell) = event {
110+
if let AppEvent::InsertHistoryCell(cell) = event
111+
&& !cell.as_any().is::<FinalMessageSeparator>()
112+
{
111113
for line in cell.display_lines(/*width*/ 80) {
112114
rendered.push_str(&line.to_string());
113115
}
114116
}
115117
}
116118
assert!(rendered.contains("typed answer"), "{rendered}");
117119
assert!(!rendered.contains("private voice commentary"), "{rendered}");
118-
insta::assert_snapshot!(
119-
"typed_steering_keeps_voice_commentary_private",
120-
without_completion_metadata(&rendered)
121-
);
120+
insta::assert_snapshot!("typed_steering_keeps_voice_commentary_private", rendered);
122121
assert!(ops.try_recv().is_err());
123122
}
124123

‎codex-rs/tui/src/chatwidget/realtime_tests/handoffs.rs‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ async fn delegation_started_before_peer_connection_keeps_its_voice_origin() {
156156
let mut rendered_history = Vec::new();
157157
commit_realtime_history_events(&mut chat, &mut events);
158158
while let Ok(event) = events.try_recv() {
159-
if let AppEvent::InsertHistoryCell(cell) = event {
159+
if let AppEvent::InsertHistoryCell(cell) = event
160+
&& !cell.as_any().is::<FinalMessageSeparator>()
161+
{
160162
let rendered = cell
161163
.transcript_lines(/*width*/ 80)
162164
.iter()
@@ -169,7 +171,7 @@ async fn delegation_started_before_peer_connection_keeps_its_voice_origin() {
169171
}
170172
insta::assert_snapshot!(
171173
"voice_delegation_during_connection",
172-
without_completion_metadata(&rendered_history.join("\n"))
174+
rendered_history.join("\n")
173175
);
174176
}
175177

@@ -322,21 +324,20 @@ async fn explicit_final_answer_can_explain_private_channel_markers() {
322324
commit_realtime_history_events(&mut chat, &mut events);
323325
let rendered = std::iter::from_fn(|| events.try_recv().ok())
324326
.filter_map(|event| match event {
325-
AppEvent::InsertHistoryCell(cell) => Some(
326-
cell.transcript_lines(/*width*/ 80)
327-
.into_iter()
328-
.map(|line| line.to_string())
329-
.collect::<Vec<_>>()
330-
.join("\n"),
331-
),
327+
AppEvent::InsertHistoryCell(cell) if !cell.as_any().is::<FinalMessageSeparator>() => {
328+
Some(
329+
cell.transcript_lines(/*width*/ 80)
330+
.into_iter()
331+
.map(|line| line.to_string())
332+
.collect::<Vec<_>>()
333+
.join("\n"),
334+
)
335+
}
332336
_ => None,
333337
})
334338
.collect::<Vec<_>>()
335339
.join("\n");
336-
insta::assert_snapshot!(
337-
"explicit_final_answer_with_channel_marker",
338-
without_completion_metadata(&rendered)
339-
);
340+
insta::assert_snapshot!("explicit_final_answer_with_channel_marker", rendered);
340341
}
341342

342343
#[tokio::test]

‎codex-rs/tui/src/chatwidget/realtime_tests/speech_recovery.rs‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,22 +401,21 @@ async fn answer_exceeding_speech_budget_is_shown_in_full_instead() {
401401
assert!(chat.realtime_conversation.pending_speech.is_empty());
402402
let rendered = std::iter::from_fn(|| events.try_recv().ok())
403403
.filter_map(|event| match event {
404-
AppEvent::InsertHistoryCell(cell) => Some(
405-
cell.transcript_lines(/*width*/ 80)
406-
.into_iter()
407-
.map(|line| line.to_string())
408-
.collect::<Vec<_>>()
409-
.join("\n"),
410-
),
404+
AppEvent::InsertHistoryCell(cell) if !cell.as_any().is::<FinalMessageSeparator>() => {
405+
Some(
406+
cell.transcript_lines(/*width*/ 80)
407+
.into_iter()
408+
.map(|line| line.to_string())
409+
.collect::<Vec<_>>()
410+
.join("\n"),
411+
)
412+
}
411413
_ => None,
412414
})
413415
.collect::<Vec<_>>()
414416
.join("\n");
415417
assert_eq!(
416-
without_completion_metadata(&rendered)
417-
.split_whitespace()
418-
.collect::<Vec<_>>()
419-
.join(" "),
418+
rendered.split_whitespace().collect::<Vec<_>>().join(" "),
420419
format!("• {text}")
421420
.split_whitespace()
422421
.collect::<Vec<_>>()

‎codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__chatwidget_markdown_code_blocks_vt100_snapshot.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ expression: "normalize_completion_timestamps(&\n(normalize_snapshot_paths(term.b
5050
"path": "C:\\Program Files\\App",
5151
"regex": "^foo.*(bar)?$"
5252
}
53-
done [completion time]
53+
[completion time]

‎codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__completion_after_plain_answer.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ expression: normalize_completion_timestamps(& (text))
44
---
55
• The change is ready.
66

7-
Worked for [duration] · done [completion time]
7+
Worked for [duration] · [completion time]

‎codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__completion_after_streamed_tool_answer.snap‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ expression: normalize_completion_timestamps(& (text))
77

88
• The change is ready.
99

10-
Worked for [duration] · done [completion time]
10+
Worked for [duration] · [completion time]

0 commit comments

Comments
 (0)