Repository navigation
fix(codex): show live usage on the active account row, including System default - #20842
Conversation
|
No actionable comments were generated in the recent review. ℹ️ Recent review info
Walkthrough
Priority: Severity of issue fixed: Medium Merge Risk:
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Active account row renders live usage —
CodexSwitcherMenu.tsxnow checkstarget.activefirst and rendersInlineUsageBarsfrom thecodexprop, so the System default row (and any managed active row) shows usage instead of falling through the inactive-usage cache that has no entry for it. - Regression coverage —
codex-status-sign-in.test.tsxthreads an optionalcodexoverride throughrenderSwitcherAndOpenAccountsand adds anit.each([null, 'account-1'])case asserting the active row shows11% used wkfor both the system default and a managed active account.
The data source is correct: codex is rateLimits.codex, which the service fetches from the active account's Codex home for codexTarget, and selectedGroup is derived from that same codexTarget — so the active row's account and the rendered usage can't diverge across host/WSL/remote lanes. I also confirmed the new test is falsifiable: reverting the target.active branch makes both new cases fail on within(activeRow).getByText('11% used wk'). Targeted run of the two touched suites passes 12/12.
ℹ️ The same active-row gap remains in the Claude switcher
ClaudeSwitcherMenu.tsx:282-289 still only consults inactiveClaudeAccounts, so its active row (including System default) stays blank for the exact same reason. That's deliberately outside this Codex-scoped fix, but it's the same shape and will surface as an equivalent bug report — worth a follow-up issue or a shared active-row helper rather than leaving the two switchers divergent.
Technical details
# Claude active row has no usage source
## Affected sites
- `src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx:282` — `inactiveUsage` is `inactiveClaudeAccounts.find(...)`; the active target is never in that list, so the row renders `null`.
- Contrast with the fixed `CodexSwitcherMenu.tsx:254` `target.active` branch.
## Required outcome
- The Claude active row should render `InlineUsageBars` from the `claude` prop (the active runtime target's usage), mirroring the Codex fix.
## Open questions for the human
- Is this intentionally left out of scope for #20841, or should both switchers be aligned now (possibly via a shared active-row component)?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…em default The Codex switcher only rendered usage bars on inactive account rows from the per-account cache, so the active row (and System default, which never has a managed account id) showed nothing. Render the live Codex usage on the active row when this desktop owns the accounts; a remote owner's usage belongs to that host's target and stays off desktop-selected rows. Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
bd1e1c8 to
d5118c2
Compare

ELI5
In the Codex account list, the other accounts show how much usage they have left, but the account you are actually using (including "System default") showed nothing, even though its numbers are right at the top of the same menu. Now the active row shows its usage too.
What Changed
codexrate limits it already has with the existingInlineUsageBars(loading state followscodex.status === 'fetching'). No new request is made.codexTarget, while a remote account owner's usage belongs to that host's target. When the active account owner is a runtime environment, the live usage stays off the desktop-selected row, so another machine's usage never shows up on the wrong row.Why
The usage was already fetched and shown in the summary at the top. Reusing it on the active row fixes the gap without adding a cache entry for System default or another usage fetch.
Linked Issue
Fixes #20841
Visual Proof
Testing
I manually tested these changes locally
Automated tests added/updated
Reproduced on macOS: opened the Codex usage menu with System default active and expanded the account list. On main the active row is blank. With the fix it shows the same 5h and weekly usage as the summary (screenshots above).
pnpm test src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx: all 8 pass, including the new active-row and remote-owner cases.Ran
oxlint/oxfmtand CI's anti-slop, code-quality, ast-grep, and changed-code quality gates on the touched files. All clean.Renderer-only change with no platform-specific code. SSH/remote is covered by the remote-owner guard above.
Notes
Original fix by @moonrailgun in #20842, with a follow-up guard so a remote owner's usage stays off desktop-selected rows. No wire formats, stored data, or public interfaces change, so mixed-version remotes are unaffected.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)