Format multi-day goal durations in the TUI (#20558)

## Why

Goal mode shows elapsed time in compact hour/minute form. That is easy
to scan for shorter runs, but once a goal runs past 24 hours, large hour
counts become harder to read at a glance.

## What changed

Updated `codex-rs/tui/src/goal_display.rs` so unbudgeted goal elapsed
time keeps the existing compact format below one day, then switches to a
day-aware format once the elapsed time reaches 24 hours:

- `23h 59m`
- `1d 0h 0m`
- `2d 23h 42m`

The formatter now covers the 24-hour boundary in unit tests, and the TUI
status-line snapshot for a completed elapsed goal now exercises the
multi-day display.

## Verification

- `cargo test -p codex-tui`

Here's my longest-running test task:

<img width="186" height="23" alt="image"
src="https://github.com/user-attachments/assets/cedfcdab-7f6e-44e6-8495-8a39f63973fb"
/>
This commit is contained in:
Eric Traut
2026-04-30 22:42:07 -07:00
committed by GitHub
parent fe05acad23
commit d898cc8f3f
3 changed files with 22 additions and 6 deletions

View File

@@ -6,4 +6,4 @@ expression: normalized_backend_snapshot(terminal.backend())
" "
" Ask Codex to do anything "
" "
" gpt-5.4 Goal achieved (30m) "
" gpt-5.4 Goal achieved (2d 23h 42m) "

View File

@@ -1626,16 +1626,18 @@ async fn status_line_goal_complete_elapsed_footer_snapshot() {
chat.show_welcome_banner = false;
chat.config.tui_status_line = Some(vec!["model-name".to_string()]);
chat.refresh_status_line();
let mut goal = test_thread_goal(
codex_app_server_protocol::ThreadGoalStatus::Complete,
/*token_budget*/ None,
/*tokens_used*/ 40_000,
);
goal.time_used_seconds = 2 * 24 * 60 * 60 + 23 * 60 * 60 + 42 * 60;
chat.handle_server_notification(
ServerNotification::ThreadGoalUpdated(
codex_app_server_protocol::ThreadGoalUpdatedNotification {
thread_id: "thread-1".to_string(),
turn_id: None,
goal: test_thread_goal(
codex_app_server_protocol::ThreadGoalStatus::Complete,
/*token_budget*/ None,
/*tokens_used*/ 40_000,
),
goal,
},
),
/*replay_kind*/ None,