Skip to content

fix(codex): show unlimited Business usage - #16323

Open
hgijeon wants to merge 27 commits into
stablyai:mainfrom
hgijeon:fix/codex-business-unlimited-usage
Open

hgijeon wants to merge 27 commits into
stablyai:mainfrom
hgijeon:fix/codex-business-unlimited-usage

Conversation

@hgijeon

@hgijeon hgijeon commented Aug 25, 2026 •

Copy link
Copy Markdown

ELI5

Codex Business accounts with unlimited usage can show “Refresh failed” because they have no percentage limits. This change shows “Codex · Business Unlimited” instead.

What Changed

  • Read the plan name and unlimited flag from existing Codex usage responses, including on Windows Subsystem for Linux (WSL).
  • Keep confirmed unlimited usage through temporary refresh errors, but let confirmed sign-out show the existing Sign in action.
  • Reuse the existing usage displays, hiding percentage bars for unlimited accounts.

Why

Missing percentage limits can also mean a failed response. Using Codex’s explicit unlimited flag avoids guessing from missing limits or a plan name, while keeping errors visible for accounts with limits.

Linked Issue

Fixes #15764

Visual Proof

Before — unlimited usage was treated as a refresh failure

Codex usage shown as refresh failed before this change

After — the Business plan is shown as Unlimited

Codex Business account shown with unlimited usage after this change

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

2026-10-14, macOS, ORCA_BACKGROUND_LAUNCH=1. Merged main at 5eda0a0dbdc0 normally; HEAD 5db26dfc26 (#22001: 703cd42b2c, identical source tree).

  • 1,417 tests passed across 128 rate-limit/status-bar files; 1 live Antigravity CLI test skipped.
  • Conflicts: the status-bar segment keeps the Unlimited label on top of main's new usage sections, and the refresh-orchestration tests keep both new cases.
  • After the merge, two files crossed their line limits. The RPC probe now reuses the Codex error-result helper, and the unlimited ProviderPanel test moved to its own file. Behavior is unchanged.
  • Changed-code quality, formatting and localization checks passed. The catalog check ran on Node because Bun is not installed locally.
  • pnpm typecheck and repository-wide oxlint fail only on a duplicate now key in structured-agent-session-message-options.ts. That file is unchanged here and fails the same way on main (fix: a Claude model that's gone switches to the list's default when you send #27826, fix(native-chat): pass the clock to a recorded option pick #28571).

Reproduce focused checks:

ORCA_BACKGROUND_LAUNCH=1 pnpm test:node src/main/rate-limits src/renderer/src/components/status-bar

Screenshots are earlier feature evidence, not new captures. Not run: Bun tests, live account login, Linux/Windows/SSH, Electron builds, packaging, and full-repository lint/tests/build. GitHub workflows await maintainer approval (action_required).

AI Disclosure

OpenAI Codex (GPT-5.6, GPT-6 and GPT-6 Astra) was used to investigate, implement and test this change. Claude Opus 5.5 (claude-opus-5-5) in Claude Code was used for the 2026-10-14 main merge, conflict resolution, line-limit fixes and validation; the diff and validation output were checked.

Review

  • Platforms/remote: reuses existing local and WSL fetching paths; new usage fields are optional for older clients. SSH fetching is unchanged.
  • Agents/integrations: limited to Codex usage handling; other agents, integrations, Git providers, and mobile logic are unchanged.
  • Performance/UI/security: reuses existing displays and requests; no new dependencies, credential handling, network destinations, or process launches.

Agent skill upstream boundary

  • Not applicable; this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

#15823 fixed app-server compatibility and #25408 added credit balances. This PR still handles unlimited-plan mapping, account caching and display through refresh errors.

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Author

X (Twitter): @hgijeon

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

@hgijeon
hgijeon requested a review from brennanb2025 as a code owner August 25, 2026 00:56
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 163ec4f2-91b1-45d4-8931-42e891a3ec57

📥 Commits

Reviewing files that changed from the base of the PR and between 12f2c6b and cfc31175871ef12d7d4650f8b4c2d7fa8cb9dee8.

📒 Files selected for processing (24)
  • src/main/rate-limits/codex-backend-usage-client.ts
  • src/main/rate-limits/codex-fetcher-backend.test.ts
  • src/main/rate-limits/codex-fetcher-session-supplement.test.ts
  • src/main/rate-limits/codex-fetcher.test.ts
  • src/main/rate-limits/codex-rpc-rate-limit-probe.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service/service-account-refresh.ts
  • src/main/rate-limits/service/service-result-policy.ts
  • src/renderer/src/components/status-bar/InlineProviderUsage.tsx
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.test.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.tsx
  • src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
  • src/renderer/src/components/status-bar/inline-usage-bars.test.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rate-limit-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Codex fetchers now accept unlimited-credit responses without rate-limit windows and preserve plan metadata. Refresh logic caches and retains unlimited state across account changes and transient failures. Renderer components display “Unlimited” instead of usage windows, sign-in prompts, or refresh-only errors. Tests cover fetch handling, state retention, provider visibility, status-bar rendering, and tooltip output.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to cfc31

Business Codex accounts reporting unlimited usage are now retained across account switches and transient refresh failures, then rendered as Unlimited across usage surfaces. The covered fetch, retention, and rendering paths leave no current merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 26 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed The changes satisfy the coding objectives in [#15764]. They map explicit unlimited metadata from RPC and WSL responses, avoid treating missing windows as failures, preserve unlimited state across refr…
Out of Scope Changes check Passed The changes remain focused on Codex Business unlimited-usage handling. Production changes, localization updates, and regression tests directly support the linked issue. No unrelated feature, dependenc…
Title check Passed The title clearly and concisely describes the primary change: displaying unlimited Business usage for Codex.
Description check Passed The description is complete and closely follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing results, limitations, AI usage, rev…
Full details: Docstring Coverage

Explanation

Docstring coverage is 17.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 26 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/rate-limits/service.ts (1)

2106-2113: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cache unlimited Codex state during account switches.

Line 2107 defines unlimited usage as valid prior data. refreshForCodexAccountChange still caches the outgoing account only when session or weekly exists. A Business unlimited account has neither window, so its inactive roster entry loses usage state after an account switch until a later successful refresh. Include this.state.codex?.isUnlimited in that cache condition.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15375a95-eca7-43b2-8dd5-6012916bad22

📥 Commits

Reviewing files that changed from the base of the PR and between b55836d and cf87b410024aa88e471b5b677ab866b6d96085ac.

📒 Files selected for processing (17)
  • 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/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
  • src/renderer/src/components/status-bar/inline-usage-bars.test.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rate-limit-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1de5f1b-81ed-4931-b210-ac4cf202dbbb

📥 Commits

Reviewing files that changed from the base of the PR and between b55836d and ca0d3641a7af91df7fb0b688447df7c5e64f06db.

📒 Files selected for processing (18)
  • 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/service-account-target-selection.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
  • src/renderer/src/components/status-bar/inline-usage-bars.test.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rate-limit-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/renderer/src/components/status-bar/StatusBar.tsx Outdated
@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from ca0d364 to e1b56ad Compare August 26, 2026 09:38
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from e1b56ad to d0642c7 Compare August 28, 2026 09:02
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from d0642c7 to 9269ab2 Compare August 30, 2026 06:39
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds unlimited usage display for Business plan accounts.

No new blocking issue was established in the reviewed changes; the PR appears safe to merge.

Summary

The PR reads Codex’s explicit unlimited flag from RPC and backend usage responses, retains a recent confirmed result through refresh failures, and displays unlimited usage without percentage bars.

  • Adds regression coverage for RPC, WSL backend, account switching, refresh failures, and status-bar displays.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Codex RPC or backend usage] --> B{Unlimited flag?}
  B -->|Yes| C[Store unlimited snapshot]
  B -->|No| D[Map usage windows or report failure]
  C --> E[Status bar and usage roster]
  E --> F[Show Unlimited without percentage bars]
Loading

Reviews (5) · Last reviewed commit: "test(codex): drop removed PTY fallback o..."

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch 3 times, most recently from 7355b43 to 9a69acf Compare August 31, 2026 23:35
@socar-jian

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from 9a69acf to 75b2dd9 Compare September 2, 2026 01:36
@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch 2 times, most recently from dd6751e to e91ae5d Compare September 3, 2026 00:54
@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from e91ae5d to 3071793 Compare September 3, 2026 01:03
@hgijeon
hgijeon force-pushed the fix/codex-business-unlimited-usage branch from cfc3117 to b784884 Compare September 8, 2026 23:33
@hgijeon

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Incremental review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

hgijeon and others added 5 commits October 7, 2026 13:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After merging main, the RPC probe and tooltip tests crossed their line limits. The missing-windows result reuses the Codex error-result helper, and the unlimited ProviderPanel test moves to its own file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Codex Business unlimited usage shows refresh failure

2 participants