fix: read Codex weekly quota from the correct rate-limit window (CLFY-25) #55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "clfy-25-codex-week-quota"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The premise was wrong (headline)
CLFY-25 assumed the permanent "Week: ~" lived in
parseAnthropicUsage'sseven_daybranch. A live capture disproves that: with an Anthropic model active the footer renders both windows correctly —Usage: 49% … │ Week: 4%. Theseven_dayparser matches the live shape exactly.The "~" is the Codex / OpenAI path, reproduced live with
GPT-5.6 Solactive (Week: ~). The reporter was on a Codex model.Root cause
parseOpenAIUsagereadrate_limit.secondary_window.used_percentunconditionally. But the live Codex payload (plan_type: "prolite") has:secondary_windowis null; the 7-day window (604800s) is inprimary_window. Which window is weekly varies by plan — the standard shape (already in the test) puts a 5h window inprimaryand the weekly insecondary; here it's inverted.Fix
openAIWeeklyWindowpicks, ofprimary_window/secondary_window, the longest window that spans a weekly scale (limit_window_seconds ≥ 6 days), reading itsused_percent+reset_at:primary_window→ Week 16% ✅secondary_window(604800 > 18000) → Week 42% ✅ (unchanged)Anthropic parser is left untouched (it's correct); added a regression test for its live field format (float
utilization, microsecond ISOresets_atwith+00:00offset).Capture
Both payloads captured through pi's
modelRegistryOAuth path — response shape only, never the token or headers — and recorded (PII redacted) indocs/plans/2026-07-17-cc-quota-payloads.md, per the repo's capture-don't-guess rule.Test plan
bun run test— 15/15 suites green (new prolite + sub-weekly + live-Anthropic cases)tsc --strictcleanWeek: ~on GPT-5.6 Sol) and confirmed Anthropic renders Week correctlyCloses CLFY-25