Skip to content

fix(codex): label weekly-only rate limits correctly - #8493

Closed
zpdldhkdl wants to merge 3 commits into
stablyai:mainfrom
zpdldhkdl:fix/codex-weekly-only-limit-label
Closed

fix(codex): label weekly-only rate limits correctly#8493
zpdldhkdl wants to merge 3 commits into
stablyai:mainfrom
zpdldhkdl:fix/codex-weekly-only-limit-label

Conversation

@zpdldhkdl

@zpdldhkdl zpdldhkdl commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • classify a sole seven-day Codex primary window as weekly usage
  • handle both backend and app-server RPC rate-limit responses
  • derive inactive-account labels and the compact mini meter from the first visible quota window
  • preserve the existing five-hour session behavior when it returns, including plans with both 5h and weekly limits

User-visible change

Codex plans that expose only a weekly quota no longer show that quota as a five-hour session limit. The compact usage bar remains visible and follows the weekly percentage when no five-hour window exists.

Screenshots

Before After
Screenshot 2026-07-13 at 14-47-35 Screenshot 2026-07-13 at 14-48-07

Testing

  • Focused Vitest: 4 files / 32 tests
  • pnpm lint (passes with repository-existing warnings)
  • pnpm typecheck
  • pnpm build
  • pnpm check:max-lines-ratchet
  • git diff --check origin/main...HEAD
  • Full pnpm test: the workstation suite has unrelated Git environment/hook and UTF-8 fixture failures; all changed-area tests pass

AI Review Report

  • Cross-platform: Pure duration classification and existing renderer primitives; no platform-specific APIs or shortcuts.
  • SSH / remote / local: Covers the direct backend path used for WSL and the app-server RPC path used by local/remote Codex runtimes.
  • Agents / integrations: Explicitly scoped to Codex. Claude, Gemini, other agents, GitHub, and GitLab behavior is unchanged.
  • Performance: Constant-time classification during the existing rate-limit refresh; no new polling, I/O, or allocations in hot loops.
  • UI quality: Reuses the existing window-label formatter and status-bar mini meter. No new colors, typography, spacing, shadows, or design tokens.
  • Security: No credential, endpoint, IPC, command execution, or persistence changes.

Compatibility notes

A sole 5h primary window remains session. When 5h and weekly windows both exist, 5h remains first and drives the compact mini meter. A sole weekly primary window is reclassified as weekly and drives that same meter.

Related to #8378 and #8293.

No release/version changes.

X: @KyungyeolB

ELI5

Codex plans that only have a weekly usage quota were wrongly shown as a five-hour session limit. The meter and labels now treat a lone seven-day window as weekly, while still handling plans that have both 5-hour and weekly limits.

@zpdldhkdl
zpdldhkdl marked this pull request as ready for review July 13, 2026 05:48
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Codex rate-limit window classification now detects weekly durations and maps primary and secondary windows into session and weekly fields across backend and RPC fetch paths. New tests cover weekly-only, session-only, and dual-window responses. Status-bar usage labels derive weekly durations dynamically, and mini meters use the first available visible window. Renderer tests cover weekly-only Codex usage displays.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: reclassifying weekly-only Codex rate limits and related labels.
Description check ✅ Passed The description is mostly complete and covers summary, screenshots, testing, review, and notes, but it lacks a dedicated Security Audit section.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gatsby74

Copy link
Copy Markdown
Contributor

Also facing this issue since latest update

@nwparker

Copy link
Copy Markdown
Contributor

Thanks for the Codex weekly-window classification work.

This PR targets a different problem (sole 7-day primary windows mislabeled as session/5h) rather than #8378’s chip-vs-popup remaining-time mismatch. Merged #9004, which syncs the status-bar chip to remaining reset duration when resetsAt is known (verify green).

Closing here for #8378. If the weekly-only labeling issue is still open on main, please re-target a fresh PR against that bug (related: #8293) — happy to review that separately.

@nwparker

Copy link
Copy Markdown
Contributor

Reopening: this PR addresses weekly-only Codex quota labeling (sole 7-day window mis-shown as 5h session), not the #8378 chip-vs-popup remaining-time fix that landed in #9004.

Sorry for the mistaken close during the #8378 duplicate sweep. Please continue review on the weekly-labeling work as a separate change.

@nwparker nwparker reopened this Jul 17, 2026
@zpdldhkdl

Copy link
Copy Markdown
Author

Thanks for catching this and reopening, @nwparker ! I've rebased against main and resolved the merge conflicts in StatusBar.tsx and inline-usage-bars.test.tsx. Ready for review whenever convenient.

@brennanb2025
brennanb2025 force-pushed the fix/codex-weekly-only-limit-label branch from 0a7b736 to 03d4116 Compare July 23, 2026 03:32
@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
@zpdldhkdl zpdldhkdl closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants