fix: label Codex weekly usage window as "Week" instead of "Day" (#26267)

The secondary window label logic treated any window >= 24h as "Day",
but Codex plans can have a weekly (604800s / 168h) quota window.
The reset timer showed "resets 2d 4h" while the label said "Day",
which was confusing.

Now windows >= 168h are labeled "Week", >= 24h remain "Day", and
shorter windows show the hour count.

Closes #25812

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sid
2026-02-28 09:23:01 +08:00
committed by GitHub
parent f16ecd1dac
commit e16d051d9f
2 changed files with 26 additions and 1 deletions

View File

@@ -65,7 +65,7 @@ export async function fetchCodexUsage(
if (data.rate_limit?.secondary_window) {
const sw = data.rate_limit.secondary_window;
const windowHours = Math.round((sw.limit_window_seconds || 86400) / 3600);
const label = windowHours >= 24 ? "Day" : `${windowHours}h`;
const label = windowHours >= 168 ? "Week" : windowHours >= 24 ? "Day" : `${windowHours}h`;
windows.push({
label,
usedPercent: clampPercent(sw.used_percent || 0),