Skip to content

fix(codex): display unlimited Business usage - #22001

Open
hgijeon wants to merge 15 commits into
stablyai:mainfrom
hgijeon:fix-codex-unlimited-usage-display
Open

hgijeon wants to merge 15 commits into
stablyai:mainfrom
hgijeon:fix-codex-unlimited-usage-display

Conversation

@hgijeon

@hgijeon hgijeon commented Sep 21, 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 703cd42b2c (#16323: 5db26dfc26, 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

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in 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: 687e1c44-fc38-4107-8a73-cbff343fae0a

📥 Commits

Reviewing files that changed from the base of the PR and between 0c10dbc and 72604ec.

📒 Files selected for processing (7)
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rate-limit-types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

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

📝 Walkthrough

The change adds isUnlimited to Codex rate-limit results and recognizes unlimited backend and RPC responses without rate-limit windows. Service refresh and account-switch paths preserve unlimited data through transient failures. Status-bar components now show translated unlimited labels instead of usage windows, sign-in prompts, or refresh-failure placeholders. Tests cover backend, RPC, service, caching, and renderer behavior.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 72604

Explicit unlimited Codex responses are displayed as Unlimited, and the state is retained across transient refresh failures. No concrete issue requiring resolution before merge was established; the change is mergeable subject to normal checks.

Security architecture risk: 🔵 Low · up to 72604

The change affects how Codex usage is reported and retained after refresh failures. The reviewed paths do not show it granting access, changing billing, or changing deployment behavior. Some wider integration coverage remains uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A false upstream unlimited value could affect the usage labels for the corresponding Codex account in the inspected displays. No inspected consumer uses the field to grant privileges or enforce a quota.

Trust Boundaries and Controls

  • observed — Codex backend and local RPC responses cross into the shared usage snapshot only after an explicit unlimited check. Account-switch clearing, generation checks, and provenance checks constrain when fetched state can replace the active account’s result.

Resilience and Maintainability Implications

  • observed — Transient errors retain recent unlimited metadata only within the stale-data threshold; unavailable and successful fresh results do not inherit that prior unlimited flag. Backend supplementation receives a current fetch result rather than the service’s cached snapshot in the inspected call path.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 23 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 PR satisfies the coding requirements in [#15764]. Backend and RPC parsing read planType and the explicit credits.unlimited flag. Unlimited responses without rate-limit windows return `status: …
Out of Scope Changes check Passed The changed source, locale, and test files support [#15764]. They implement explicit unlimited mapping, fallback handling, state retention, compatible RPC probing, and unlimited usage display. No unre…
Title check Passed The title clearly and concisely identifies the main change: displaying unlimited Codex Business usage.
Description check Passed The description includes all required sections, links issue #15764, explains the user-visible change and implementation, provides visual proof, documents testing and limitations, discloses AI use, and…
Full details: Docstring Coverage

Explanation

Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 23 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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — the whole PR at 455b1e3 (single commit, 24 files): Codex unlimited-plan detection and its display across the status bar.

  • Unlimited wire detection: reads credits.unlimited from both the app-server account/rateLimits/read snapshot and the wham/usage backend response, and surfaces planType from the RPC snapshot. An empty non-unlimited RPC reply now errors ('RPC response did not include rate-limit windows') instead of settling a silent empty ok.
  • Backend metadata supplement: supplementCodexSessionWindow merges planType/isUnlimited into weekly-only RPC results instead of only carrying reset credits.
  • Service retention: isUnlimited counts as prior data for stale fallback and lets an outgoing unlimited account be cached across an account switch.
  • Renderer: status-bar segment, inline bars, usage-roster row, and tooltip render "Unlimited" and hide percentage windows; isUnavailableInactiveUsage and isProviderConfigured treat unlimited as present data.
  • i18n: three new en.json keys (StatusBar, UsageRosterPanel, tooltip namespaces).

I verified the two load-bearing external wire shapes against the openai/codex source (app-server RateLimitSnapshot nests credits/planType; /wham/usage flattens top-level plan_type + credits.unlimited), and confirmed the new tests exercise the new behavior (the WSL/RPC unlimited tests fail without the change). All 888 tests in src/main/rate-limits and src/renderer/src/components/status-bar pass, pnpm tc:web is clean, and the changed-code quality gate reports 0 findings. pnpm tc:node was OOM-killed in this sandbox (exit 137), so it was not independently confirmed here.

Two intentional behavior changes worth being aware of (not defects): every Codex account now shows its plan name in the usage roster, and a non-unlimited RPC reply with no windows now falls through to the PTY fallback rather than showing a silent empty state.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

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

The PR should not merge until confirmed sign-out remains actionable after an unlimited usage snapshot.

Findings

  1. P1 Signed-out accounts still show Unlimited ▶

Summary

The PR reads Codex’s explicit unlimited flag and plan name from RPC and backend usage responses, retains confirmed unlimited usage across transient failures and account switches, and replaces percentage displays with an Unlimited label.

  • Adds regression coverage for RPC, backend/WSL, stale-state, and status-bar presentation paths.
  • Confirmed sign-out after an unlimited result needs a visible reauthentication path.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Codex RPC or backend usage] --> B[Plan and unlimited mapping]
  B --> C[Rate-limit service]
  C --> D[Active usage and inactive account cache]
  D --> E[Status bar, roster, tooltip, and switcher]
Loading

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

Comment thread src/renderer/src/components/status-bar/usage-roster-row-state.ts Outdated
@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.

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

1 participant