Skip to content

Show whole credit balances in usage displays - #28887

Merged
nwparker merged 2 commits into
mainfrom
nwparker/fix-credit-decimal-codex-usage
Oct 15, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/fix-credit-decimal-codex-usage

Conversation

@nwparker

@nwparker nwparker commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 0

ELI5

Credit balances now show whole numbers instead of a long decimal tail.

What Changed

The status bar and usage details share a credit formatter. Round that formatter to whole credits, so 51,809.811786 credits becomes 51,810 credits. Keep locale-specific grouping; the underlying balance stays unchanged.

Why

Long decimals waste space in the status bar. Updating the existing formatter keeps both displays consistent without duplicating rounding logic or reducing the precision of stored balances.

Linked Issue

Reported directly; no linked issue.

Visual Proof

Captured the actual Orca renderer on macOS through Playwright CDP with a seeded balance matching the report, using an isolated profile and a hidden window.

Before:

Before: long credit decimal

After:

After: whole credits in both views

Testing

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

Verified the rounded balance in the status bar and opened the Codex usage submenu to verify 51,810 credits available.

  • All 78 focused tests passed: ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/credit-count-format.test.ts src/renderer/src/components/status-bar/provider-segment-balance.test.tsx src/renderer/src/components/status-bar/tooltip.test.ts.
  • ORCA_BACKGROUND_LAUNCH=1 pnpm tc:web passed.
  • pnpm run check:code-quality:changed passed.
  • Formatting and git diff --check passed.

Regression cases cover the reported balance, rounding up and down, the half-credit boundary, whole numbers, and fractional balances below one credit. Full lint, build, and suite are left to CI.

Review

Independent sub-agent review found no actionable issues after tracing both displays and checking rounding boundaries, locale grouping, invalid inputs, unlimited balances, currency isolation, and platform/SSH behavior. The reviewer also ran the formatter tests (8 passed).

Agent skill upstream boundary

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

Notes

Display-only change using the existing locale-aware formatter. No changes to execution, SSH, folder workspaces, provider APIs, stored balances, or wire formats. Rendered validation ran on macOS; Linux and Windows were not run locally.

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)

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: a764bfb4-83bc-4674-84ed-1749cac4dbc2
📥 Commits

Reviewing files that changed from the base of the PR and between 67c17f8 and 11e3528.

📒 Files selected for processing: 2
  • src/shared/credit-count-format.test.ts
  • src/shared/credit-count-format.ts

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

📝 Walkthrough

The credit count formatter now limits output to whole numbers. Tests use the default locale formatter and check results for fractional, half-value, and integer inputs.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 11e35

Balances display as rounded whole credits in both usage surfaces, matching the final behavior shown and tested. No concrete issue remains that should block merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is detailed and covers the required change, rationale, visual proof, testing, review, and checklist. It does not provide the required linked issue and states that no issue exists. It a… Add a valid linked issue under “Linked Issue” and reconcile the documented behavior with the PR objective and implementation. State consistently whether credit balances display whole numbers or up to two fractional digits.
Passed Passed checks: 3 passed
Check name Status Explanation
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 summarizes the main change: credit balances now display as whole numbers in usage displays.
Full details: Description check

Explanation

The description is detailed and covers the required change, rationale, visual proof, testing, review, and checklist. It does not provide the required linked issue and states that no issue exists. It also describes whole-number rounding, which conflicts with the stated objective of displaying up to two fractional digits.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker nwparker changed the title Fix long decimal credit balances in usage display Show whole credit balances in usage displays Oct 14, 2026
@nwparker
nwparker merged commit a90ff59 into main Oct 15, 2026
32 checks passed
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.

1 participant