Skip to content

Commit 5240b89

Browse files
fix(tui): restore rate-limit reset time in status header
The reapply on rust-v0.144.1 introduced a regression: when the reset time falls on the same day, `format_reset_timestamp` returns a bare `HH:MM` string with no space, so `split_once(' ')` returned `None` and the header dropped the time, showing only `95%` instead of `95% 23:19`. Restore the `compact_reset_time` helper from feat/rust-v0.144.0 that falls back to the original string when there is no space, so the time segment is always preserved. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 9c9ca1f commit 5240b89

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

codex-rs/tui/src/chatwidget/status_header.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ impl StatusHeader {
9999
let rate_limit = snapshot.and_then(|snapshot| {
100100
snapshot.primary.as_ref().map(|primary| {
101101
let remaining = (100.0 - primary.used_percent).clamp(0.0, 100.0).round() as i64;
102-
match primary.resets_at.as_deref().and_then(|reset| reset.split_once(' ')) {
103-
Some((time, _)) => format!("{remaining}% {time}"),
104-
None => format!("{remaining}%"),
102+
match primary.resets_at.as_deref() {
103+
Some(resets_at) if !resets_at.trim().is_empty() => {
104+
format!("{remaining}% {}", compact_reset_time(resets_at))
105+
}
106+
_ => format!("{remaining}%"),
105107
}
106108
})
107109
});
@@ -192,3 +194,9 @@ fn account_label(
192194
None => None,
193195
}
194196
}
197+
198+
fn compact_reset_time(resets_at: &str) -> &str {
199+
resets_at
200+
.split_once(' ')
201+
.map_or(resets_at, |(time, _)| time)
202+
}

0 commit comments

Comments
 (0)