#19269: Fix Codex usage window label for weekly reset
size: XS
Cluster:
Context Window and Model Updates
## Summary
- Fix Codex usage window label derivation to avoid labeling weekly windows as "Day".
- Use 24h+ as Day only for sub-week windows and 7d+ (>=168h) as Week.
- Add test coverage for label behavior.
## Details
This updates `src/infra/provider-usage.fetch.codex.ts`:
- Refactor window labeling into `describeWindowHours(windowSeconds)`.
- Labels both `primary_window` and `secondary_window` with this helper.
Touches:
- `src/infra/provider-usage.fetch.codex.ts`
- `src/infra/provider-usage.test.ts`
Closes #19266
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Refactors Codex usage window labeling to correctly distinguish between daily and weekly rate limit windows. Previously, any window >=24 hours (including 168-hour weekly windows) was labeled "Day". The new `describeWindowHours` helper correctly labels windows <24h with hour counts, 24-167h as "Day", and >=168h as "Week". Test coverage verifies the fix.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Simple refactoring with clear logic and comprehensive test coverage. The fix correctly addresses the labeling issue without changing any business logic or external behavior
- No files require special attention
<sub>Last reviewed commit: ac32e1f</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#13229: Fix openai-codex/gpt-5.3-codex API format resolution
by trevorgordon981 · 2026-02-10
67.5%
#6053: fix: use 400K context window instead of 200K if the model allows (g...
by icedac · 2026-02-01
66.6%
#13215: fix: pass agentId to loadCostUsageSummary in /usage cost command
by veast · 2026-02-10
66.2%
#17531: fix(auth): sync Codex CLI credentials into auth profile store and c...
by sauerdaniel · 2026-02-15
66.0%
#13895: fix(usage): exclude cache tokens from context-window accounting
by zerone0x · 2026-02-11
65.9%
#15522: fix(codex-cli): compatible resume args + JSONL chunk streaming bridge
by chungjchris · 2026-02-13
65.8%
#14709: fix: display local timezone in console logs
by Daiyimo · 2026-02-12
65.5%
#15875: fix(cron): normalize seconds to milliseconds in timestamps
by Shuai-DaiDai · 2026-02-14
65.5%
#22387: fix: session_status context tracking undercount for cached providers
by 1ucian · 2026-02-21
65.4%
#15754: fix: handle Unix timestamps in seconds in parseAbsoluteTimeMs
by MisterGuy420 · 2026-02-13
65.3%