You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mobile): show usage for every agent desktop tracks on the Accounts screen - #38187
The phone's Accounts screen only showed usage for Claude and Codex. Desktop also shows Grok, Antigravity, Gemini, Kimi, MiniMax, OpenCode Go, Cursor and ZCode. Now the phone lists every agent the desktop has usage for, with the same windows desktop shows.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$70
$\color{#cf222e}{\Huge{\mathbf{−}}}$72
$\color{#cf222e}{\Huge{\mathbf{−}}}$2
Prod
29
$\color{#1a7f37}{\Huge{\mathbf{+}}}$418
$\color{#cf222e}{\Huge{\mathbf{−}}}$233
$\color{#1a7f37}{\Huge{\mathbf{+}}}$185
What Changed
Before: mobile Accounts had a Claude section and a Codex section, each with a 5h and 7d bar. Everything else the desktop tracked was silently dropped, and Claude's Fable window never appeared.
After:
A new "Other agents" section lists every provider the desktop reports usage for, in the desktop's order, with its icon and one bar per window. Antigravity shows each model-group pool (for example "Gemini Models · 5 Hour Limit Remaining"), Grok shows its weekly and monthly windows, and so on.
Claude and Codex rows render the same window list, so Claude now shows Fable too.
A provider that is signed out, not installed, or hidden on desktop (the host reports it unavailable or idle with no windows) stays off the list. A provider that failed but still has stale numbers keeps its bars and shows the error underneath.
How:
The host already sent every provider in accounts.subscribe / accounts.list (rateLimits is RateLimitService.getState()). Mobile's zod schema only named nine provider ids and the screen only read the claude and codex slots, so the rest was thrown away.
The rules for which windows a provider shows and what it is called lived only in the desktop renderer. They now live in src/shared/usage-provider-windows.ts:
getUsageWindowSections (desktop's getWindowSections rule, returning kind-tagged sections; desktop maps the kinds to its existing translated labels, so the status bar is unchanged);
getProviderDisplayName (now a table checked with satisfies, so a new provider without a name fails the typecheck);
hasUsageData.
formatWindowLabel moved from src/renderer/src/lib/window-label-formatter.ts to src/shared/rate-limit-window-label.ts.
Mobile decodes each rateLimits slot on its own with a string provider id. A provider desktop adds later shows up with no mobile change, and an odd entry is skipped instead of failing the whole snapshot. The Claude and Codex slots keep their strict identity checks.
Window lengths may be 0, because agy reports unknown windows that way.
Why
This is a generic fix, not a per-provider addition. Mobile reads the same provider shape the host already sends and the same window rule desktop uses. The outside PRs either add one provider (#36417 Antigravity, #23247 Grok) or keep a hard-coded mobile list of provider keys and titles (#32058, #22626, #36755), which drifts the next time desktop adds a provider. No host or wire change: the page is served by the desktop it talks to, and an older desktop serves its older page.
The one place mobile can't copy desktop is the status-bar visibility toggles, which are desktop-only settings. Mobile shows what the host has data or an error for. A provider hidden from desktop's status bar still appears on mobile if the host keeps polling it, except Antigravity, which the host stops polling.
iOS simulator, paired to a headless serve built from this branch. Claude, Codex and Grok are real logins on this Mac. agy isn't installed here, so Antigravity comes from a stub agy on the serve's PATH that prints the real agy 1.2.11 /usage envelope shape with a 5h and a weekly pool per group.
Before (main)
After
To try (needs blessing): build this branch's desktop (pnpm run build:mobile-web, then start the app or a serve from /Users/kelvinamoaba/orca/workspaces/orca/mobile-provider-usage), pair a phone, then open the host's ⋯ menu → Accounts. Every agent the desktop status bar has usage for appears under "Other agents" with its windows; Claude's row also shows Fable. Sign one of them out on desktop and tap refresh: it drops off the list.
Testing
iOS simulator against a headless serve from this branch: main shows only Claude and Codex; this branch adds Antigravity's four pools plus its weekly summary, Grok's weekly window and Claude's Fable window.
accounts.list read from that serve and from the installed app: unconfigured providers come back unavailable, configured ones ok, matching what the screen filters on.
Focused tests: src/renderer/src/components/status-bar (469), mobile src/accounts, account-usage-state, accounts-snapshot, codex-reset-credit, test-support/rpc-recording.
tc:web and mobile typecheck, check:code-quality:changed, mobile localization verify and coverage.
New test getOtherUsageProviders fails on main's schema: the Antigravity pool with windowMinutes: 0 drops the whole provider.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part is the desktop refactor: getWindowSections, the provider display names and hasUsageData now come from src/shared. If the mapping were wrong, desktop's usage tooltip and roster would show different labels or windows. The status-bar tests (469) pass unchanged, and the sections, order and window object identity are the same as before.
On mobile, the schema now accepts any provider id and zero-length windows. Claude and Codex slots still reject the wrong identity, so account switching and Codex reset credits are untouched. No wire, saved-data or host change. A plain revert backs it out.
Level: Low
AI Disclosure
Review
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
Cross-platform: the page is the same React Native Web page on iOS and Android; no platform branches. Desktop changes are renderer-only label wiring.
Remote/SSH: the phone reads whichever host it is paired with; no new RPC.
Follow-ups, not in this PR:
OpenCode Go and MiniMax show a letter tile instead of their logo, because mobile has no icon for those ids.
Error-only rows show the host's raw error string, as Claude and Codex rows already do, not desktop's friendlier wording.
Shared utilities now provide provider display names, usage detection, and usage-window sections for status-bar components. Mobile snapshot validation accepts nonempty provider identifiers and zero-minute windows, while account slots remain limited to Claude and Codex. The mobile Accounts screen renders usage windows for other eligible providers, with provider icons and errors. Usage bars support alternate layouts, and account-screen translations add Fable, MCP, and other-agent labels.
Merge Risk: Low · up to 127ff
Some usage rows can misidentify providers, truncate or untranslated labels, and hide errors behind stale quota bars. These are localized display issues with straightforward fixes.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title names the main change: mobile Accounts screen now shows usage for every agent that desktop tracks. The changeset matches this. It adds an "Other agents" section, moves provider display names…
Linked Issues check
The PR meets the coding requirements in [#18469] and [#36416]. Mobile accepts provider IDs and zero-minute windows, while Claude and Codex retain strict identity validation. getOtherUsageProviders p…
Out of Scope Changes check
The changes stay within [#18469] and [#36416]. The shared provider-window helpers, desktop import refactor, mobile schema and state changes, UI changes, tests, and locale updates directly support gene…
Description check
The description follows the repository template closely. It has an ELI5, a detailed What Changed section with before/after and mechanism, a Why section that compares the alternatives (#36417, #23247, …
Full details: Title check
Explanation
The title names the main change: mobile Accounts screen now shows usage for every agent that desktop tracks. The changeset matches this. It adds an "Other agents" section, moves provider display names and usage-window rules to shared modules, and relaxes the mobile rate-limit schema so any provider id is accepted. The title is specific, one sentence, and free of file lists or vague terms. Its length (78 characters) is acceptable.
Full details: Linked Issues check
Explanation
The PR meets the coding requirements in [#18469] and [#36416]. Mobile accepts provider IDs and zero-minute windows, while Claude and Codex retain strict identity validation. getOtherUsageProviders preserves host order and excludes unavailable or idle entries without usage data. MobileAccountsScreen renders provider icons, usage bars, reset data, and errors. Shared window rules render Antigravity buckets and fallback windows. Locale updates support the added labels. Existing host snapshot behavior supplies the provider data without a new wire or fetcher change.
Full details: Out of Scope Changes check
Explanation
The changes stay within [#18469] and [#36416]. The shared provider-window helpers, desktop import refactor, mobile schema and state changes, UI changes, tests, and locale updates directly support generic provider usage and Antigravity quota display. No unrelated authentication, account-switching, fetcher, or host protocol changes are introduced.
Full details: Description check
Explanation
The description follows the repository template closely. It has an ELI5, a detailed What Changed section with before/after and mechanism, a Why section that compares the alternatives (#36417, #23247, #32058, #22626, #36755), a Linked Issue (Fixes #18469, Fixes #36416), Visual Proof with before/after images, Testing steps, a Risk section with level Low and a revert path, and a Notes section. The AI Disclosure section is empty. The template says to fill it in only for non-StablyAI team members, so this is acceptable only if the author is a team member. The Review section is empty and the Agent skill upstream boundary box is checked. The unchecked item is the pnpm lint, typecheck, test, and build item, and the author marks it as unchecked. The PR's Testing section lists tc:web, mobile typecheck, and focused test runs, so the core verification is described. The Notes section lists follow-ups and cross-platform impact. Overall the description is mostly complete.
Full details: Docstring Coverage
Explanation
Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 19 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Localize the duration in Antigravity bucket labels.
For a bucket, this branch returns the host’s English name without using the translated 5h or 7d labels below. A Japanese or German Accounts screen therefore shows English quota-window text even though the linked Antigravity requirement calls for localized bucket meters. Use the bucket’s known duration to build a translated window label, while retaining a fallback for unknown-duration buckets. (github.com)
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Reject additional-provider entries with a mismatched slot.
If rateLimits.grok contains a valid payload with provider: 'kimi', this code accepts it and the Accounts screen labels Grok’s usage as Kimi. A second Kimi entry also produces duplicate row keys. Compare parsed.data.provider with slot before adding the entry, as the Claude and Codex slots already do for their identities. (raw.githubusercontent.com)
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Let wide bucket labels wrap.
On a narrow screen or with larger text, numberOfLines={1} truncates long Antigravity labels. Labels such as “Claude and GPT models · 5 Hour Limit Remaining” and its weekly counterpart can lose the suffix that distinguishes the two bars. Allow multiple lines when wideLabel is true. (github.com)
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 GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Show the provider error in the system-default usage row. · MobileAccountsScreen.tsx:230-237
mobile/src/accounts/MobileAccountsScreen.tsx:230-237 Minor · Functional Correctness · Quick win
Show the provider error in the system-default usage row.
When the active system-default provider reports an error, the row still shows the retained usage bars. The row does not show usage.error. The managed-account row and the additional-provider rows show that error text, so users of the system-default row cannot tell that the displayed quota may be stale.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 3d854124-02ac-4ddb-9325-5b8dc132afcc
Commits
Reviewing files that changed from the base of the PR and between 4a881d9 and 127ffff.
Files selected for processing: 4
mobile/src/components/account-usage-state.test.ts
mobile/src/components/account-usage-state.ts
mobile/src/components/accounts-snapshot.ts
mobile/src/components/codex-reset-credit.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
The phone's Accounts screen only showed usage for Claude and Codex. Desktop also shows Grok, Antigravity, Gemini, Kimi, MiniMax, OpenCode Go, Cursor and ZCode. Now the phone lists every agent the desktop has usage for, with the same windows desktop shows.
What Changed
Before: mobile Accounts had a Claude section and a Codex section, each with a 5h and 7d bar. Everything else the desktop tracked was silently dropped, and Claude's Fable window never appeared.
After:
unavailableoridlewith no windows) stays off the list. A provider that failed but still has stale numbers keeps its bars and shows the error underneath.How:
accounts.subscribe/accounts.list(rateLimitsisRateLimitService.getState()). Mobile's zod schema only named nine provider ids and the screen only read theclaudeandcodexslots, so the rest was thrown away.src/shared/usage-provider-windows.ts:getUsageWindowSections(desktop'sgetWindowSectionsrule, returning kind-tagged sections; desktop maps the kinds to its existing translated labels, so the status bar is unchanged);getProviderDisplayName(now a table checked withsatisfies, so a new provider without a name fails the typecheck);hasUsageData.formatWindowLabelmoved fromsrc/renderer/src/lib/window-label-formatter.tstosrc/shared/rate-limit-window-label.ts.rateLimitsslot on its own with a string provider id. A provider desktop adds later shows up with no mobile change, and an odd entry is skipped instead of failing the whole snapshot. The Claude and Codex slots keep their strict identity checks.agyreports unknown windows that way.Why
This is a generic fix, not a per-provider addition. Mobile reads the same provider shape the host already sends and the same window rule desktop uses. The outside PRs either add one provider (#36417 Antigravity, #23247 Grok) or keep a hard-coded mobile list of provider keys and titles (#32058, #22626, #36755), which drifts the next time desktop adds a provider. No host or wire change: the page is served by the desktop it talks to, and an older desktop serves its older page.
The one place mobile can't copy desktop is the status-bar visibility toggles, which are desktop-only settings. Mobile shows what the host has data or an error for. A provider hidden from desktop's status bar still appears on mobile if the host keeps polling it, except Antigravity, which the host stops polling.
Linked Issue
Fixes #18469
Fixes #36416
Visual Proof
iOS simulator, paired to a headless serve built from this branch. Claude, Codex and Grok are real logins on this Mac.
agyisn't installed here, so Antigravity comes from a stubagyon the serve's PATH that prints the real agy 1.2.11/usageenvelope shape with a 5h and a weekly pool per group.To try (needs blessing): build this branch's desktop (
pnpm run build:mobile-web, then start the app or a serve from/Users/kelvinamoaba/orca/workspaces/orca/mobile-provider-usage), pair a phone, then open the host's ⋯ menu → Accounts. Every agent the desktop status bar has usage for appears under "Other agents" with its windows; Claude's row also shows Fable. Sign one of them out on desktop and tap refresh: it drops off the list.Testing
iOS simulator against a headless serve from this branch: main shows only Claude and Codex; this branch adds Antigravity's four pools plus its weekly summary, Grok's weekly window and Claude's Fable window.
accounts.listread from that serve and from the installed app: unconfigured providers come backunavailable, configured onesok, matching what the screen filters on.Focused tests:
src/renderer/src/components/status-bar(469), mobilesrc/accounts,account-usage-state,accounts-snapshot,codex-reset-credit,test-support/rpc-recording.tc:weband mobile typecheck,check:code-quality:changed, mobile localization verify and coverage.New test
getOtherUsageProvidersfails on main's schema: the Antigravity pool withwindowMinutes: 0drops the whole provider.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
The riskiest part is the desktop refactor:
getWindowSections, the provider display names andhasUsageDatanow come fromsrc/shared. If the mapping were wrong, desktop's usage tooltip and roster would show different labels or windows. The status-bar tests (469) pass unchanged, and the sections, order and window object identity are the same as before.On mobile, the schema now accepts any provider id and zero-length windows. Claude and Codex slots still reject the wrong identity, so account switching and Codex reset credits are untouched. No wire, saved-data or host change. A plain revert backs it out.
Level: Low
AI Disclosure
Review
Agent skill upstream boundary
Notes
getOtherUsageProvidersonce both land.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)