Skip to content

feat(mobile): show usage for every agent desktop tracks on the Accounts screen - #38187

Merged
AmoabaKelvin merged 4 commits into
mainfrom
feat/mobile-provider-usage
Nov 4, 2026
Merged

AmoabaKelvin merged 4 commits into
mainfrom
feat/mobile-provider-usage

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

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.

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.

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. 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
before-accounts-s.png after-accounts-s.png

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:

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)
  • I stated the risk: what could break, for whom, and how to back it out
  • 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 Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

@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: 3

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7694a74e-1a65-4abb-bca7-9220d821a72c
Commits

Reviewing files that changed from the base of the PR and between e15bd08 and 4a881d9.

Files selected for processing: 30
  • mobile/src/accounts/MobileAccountsScreen.tsx
  • mobile/src/accounts/ProviderUsageWindows.tsx
  • mobile/src/accounts/mobile-accounts-screen-styles.ts
  • mobile/src/components/AccountUsage.tsx
  • mobile/src/components/account-usage-state.test.ts
  • mobile/src/components/account-usage-state.ts
  • mobile/src/components/accounts-snapshot.ts
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • src/renderer/src/components/status-bar/InlineProviderUsage.tsx
  • src/renderer/src/components/status-bar/ProviderIdentityCard.tsx
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/UsageRosterPanel.tsx
  • src/renderer/src/components/status-bar/owner-usage-rate-limits.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/status-bar-usage-sections.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/components/status-bar/usage-pool-label.ts
  • src/shared/rate-limit-window-label.ts
  • src/shared/usage-provider-windows.ts
Files with no reviewable changes: 1
  • mobile/src/accounts/mobile-accounts-screen-styles.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.

Comment on lines +27 to +28
if (section.kind === 'bucket') {
return section.name

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.

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)

Comment on lines +89 to +92
const parsed = ProviderRateLimitsSchema.safeParse(value)
// Hidden or signed-out providers come back idle or unavailable with no windows.
if (parsed.success && (hasUsageData(parsed.data) || parsed.data.status === 'error')) {
providers.push(parsed.data)

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.

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)

Comment on lines +61 to +63
<Text style={styles.usageLabel} numberOfLines={1}>
{label}
</Text>

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.

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)

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

Suggested fix
             detail={
               // Show system-default login usage for users without managed accounts.
               activeAccountId === null && hasActiveProviderUsage(activeUsage) ? (
-                <ProviderUsageWindows limits={activeUsage} now={now} showEmptyWindows />
+                <>
+                  <ProviderUsageWindows limits={activeUsage} now={now} showEmptyWindows />
+                  {activeUsage?.error ? (
+                    <Text style={styles.errorText} numberOfLines={1}>
+                      {activeUsage.error}
+                    </Text>
+                  ) : null}
+                </>
               ) : undefined
             }
Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant