Repository navigation
Description
Summary
After Codex stopped returning an hourly quota, Jcode renders the remaining two quota windows as two separate weekly bars. This is misleading because neither returned window is an hourly limit.
Reproduction
- Sign in with a Codex/OpenAI OAuth account whose current usage response has no hourly window and contains two weekly windows.
- Start Jcode and inspect the OpenAI limits in the info widget or compact header.
- Jcode shows two quota lines, both labeled with the backend's weekly window label.
Expected
Render the reported windows without assigning an hourly role when the response does not contain an hourly window. In particular, do not display two weekly windows as the legacy five_hour and seven_day slots. The UI could use a generic ordered list of returned windows, or correctly distinguish the two weekly quotas when the backend supplies an identifier.
Actual
The first weekly window is stored in the seven_day field because its name matches the weekly detector. The generic fallback then stores that same first window in five_hour, because no hourly window was found. The widget renders both field labels verbatim, so users see the same weekly quota twice.
Root cause
crates/jcode-base/src/usage/openai_helpers.rs still models OpenAI usage as fixed five_hour, seven_day, and spark slots. In classify_openai_limits:
if five_hour.is_none() {
five_hour = generic_non_spark.first().cloned();
}
if seven_day.is_none() {
seven_day = generic_non_spark.iter().find(/* a different item */).cloned();
}This fallback causes the first generic window to fill the historical hourly slot whenever no limit matches limit_mentions_five_hour. A weekly limit has already filled seven_day, so that same weekly quota is rendered through both legacy slots. A second returned weekly window is not meaningfully represented.
crates/jcode-tui/src/tui/app/tui_state.rs then forwards window.name as each display label, and info_widget_usage.rs renders both bars. Therefore the issue is not merely cosmetic label text: the model cannot represent the changed Codex quota shape.
Validation
- Inspected the v0.75.0 source at commit
5ae2385. - Ran
cargo test -p jcode-base test_classify_openai_limits --lib --quietsuccessfully (2 tests passed). Existing coverage only tests the old 5h + 1w shape and does not cover two weekly windows.
Suggested fix
Replace the fixed two-window fallback for OpenAI with a list of normalized windows, or only populate the hourly slot when a returned limit explicitly identifies an hourly duration. Add a regression test with two 7-day window limits and no hourly limit. The regression should assert that the first weekly window is not duplicated into an hourly slot and that both returned windows remain distinguishable.
Activity
1jehuang commentedon Aug 10, 2026
The duplication is reproducible in
classify_openai_limits. A focused fix now excludes an already-classified weekly window from the generic fallback and adds coverage for two weekly windows with no hourly window. I will link the verified PR here shortly.— Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Aug 10, 2026
The focused classification tests pass, and the verified fix is now available in #882.
— Jcode agent (automated triage), on behalf of @1jehuang
chore: sync fork with upstream jcode (fresh merge onto current master) (
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)
fix: avoid duplicate Codex quota windows (fixes 1jehuang#869)