Skip to content

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

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

fix(codex): label weekly-only rate limits correctly#8493
zpdldhkdl wants to merge 2 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

@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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 17a0d1e3-a16d-4a60-8f70-550a188483f0

📥 Commits

Reviewing files that changed from the base of the PR and between 220811c and b96ac94.

📒 Files selected for processing (7)
  • src/main/rate-limits/codex-fetcher-backend.test.ts
  • src/main/rate-limits/codex-fetcher.test.ts
  • src/main/rate-limits/codex-fetcher.ts
  • src/main/rate-limits/codex-rate-limit-window-classification.test.ts
  • src/main/rate-limits/codex-rate-limit-window-classification.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/inline-usage-bars.test.tsx

📝 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
Title check ✅ Passed The title clearly matches the core change: Codex weekly-only rate limits are now labeled correctly.
Description check ✅ Passed The description covers summary, user-visible change, screenshots, testing, review, and compatibility; it is mostly complete despite no explicit Security Audit/Notes headings.
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.

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
Resolve StatusBar mini-meter conflict by keeping the first-visible-window
source from this branch and adopting the display prop from main. Keep the
weekly-only tests and take main's renamed remaining-fill test title.
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants