Skip to content

feat(mobile): render all active agent usage providers - #32058

Closed
zhangxaochen wants to merge 2 commits into
stablyai:mainfrom
zhangxaochen:zhangxaochen/mobile-accounts-all-providers
Closed

zhangxaochen wants to merge 2 commits into
stablyai:mainfrom
zhangxaochen:zhangxaochen/mobile-accounts-all-providers

Conversation

@zhangxaochen

Copy link
Copy Markdown
Contributor

ELI5

On Orca Mobile, the host Accounts & Usage screen (/h/[hostId]/accounts) previously only decoded and rendered Claude and Codex, even though the desktop host already sends usage data for all active agents (Antigravity, Cursor, Grok, Gemini, OpenCode Go, Kimi, MiniMax, and Z.ai) in the accounts.list / accounts.subscribe snapshot. This updates the mobile Accounts screen to display usage bars and reset countdowns for all active providers on the host.

What Changed

  • Before:
    • AccountsSnapshotSchema in mobile/src/components/accounts-snapshot.ts only declared rateLimits.claude and rateLimits.codex (and omitted 'zcode' from ProviderRateLimitsSchema).
    • MobileAccountsScreen.tsx only rendered Claude and Codex sections, hiding all other active providers (Antigravity, Cursor, Grok, Gemini, OpenCode Go, Kimi, MiniMax, Z.ai) and leaving an empty Claude card visible even when the user had no Claude accounts or usage.
  • After:
    • Extended ProviderRateLimitsSchema and AccountsSnapshotSchema in mobile/src/components/accounts-snapshot.ts to decode optional provider rate-limit snapshots (antigravity, gemini, cursor, grok, opencodeGo, kimi, minimax, zcode), including buckets (group, windowName), planType, and usageMetadata.
    • Added getActiveAdditionalProviders, getAdditionalProviderUsageRows, and hasAnyRenderableUsage in mobile/src/components/account-usage-state.ts:
      • Grouped pool buckets (e.g. Antigravity model groups Gemini Models, Claude and GPT models): renders one row per model group with sorted window bars (5h, 7d) and reset countdowns.
      • Ungrouped buckets & plan total (e.g. Cursor Plan 30d + Cursor Models / Other Models, Gemini Flash / Pro): renders the plan meter (when present) and each named bucket row.
      • Window-based providers (e.g. Grok, OpenCode Go, Kimi, MiniMax, Z.ai): renders the account provenance (usageMetadata.authProvenance email when available, otherwise System default) with active 5h / 7d / Fable / 30d / MCP bars.
    • Added AdditionalProvidersUsageSections in mobile/src/components/AccountUsage.tsx and rendered it on MobileAccountsScreen.tsx, while hiding empty unconfigured Claude / Codex cards when another provider is active.

Why

The desktop host's RuntimeAccountController.getSnapshot() already publishes the full RateLimitState over accounts.list and accounts.subscribe, so no new RPC or protocol change is needed. Keeping the new selectors and section renderer inside account-usage-state.ts and AccountUsage.tsx also preserves the exact route chunk-splitting envelope enforced by verify-mobile-web-app-bundle.mjs.

Linked Issue

Fixes #18469

Visual Proof

Verified on Android (com.stably.orca.mobile connected to Windows desktop host): the Accounts screen now renders Codex, Antigravity (Gemini Models 5h/7d & Claude and GPT models 5h/7d), Cursor (Plan 30d, Cursor Models, Other Models), and Grok ([email protected] 7d) instead of only Codex and an empty Claude card.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • pnpm --dir mobile test src/components/accounts-snapshot.test.ts src/components/account-usage-state.test.ts src/accounts/mobile-accounts-screen-reset-credit.test.ts

  • node config/scripts/build-mobile-web-app-bundle.mjs && node config/scripts/verify-mobile-web-app-bundle.mjs

  • pnpm exec oxlint --deny-warnings mobile/src/accounts/MobileAccountsScreen.tsx mobile/src/components/AccountUsage.tsx mobile/src/components/account-usage-state.ts mobile/src/components/account-usage-state.test.ts mobile/src/components/accounts-snapshot.ts mobile/src/components/accounts-snapshot.test.ts src/shared/codex-reset-credit-scope.ts

AI Disclosure

Assisted by Gemini (Antigravity) and Grok (grok-4.7-build-fast) for implementation and unit tests.

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

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

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)

Accounts only decoded Claude and Codex, so the other providers in the host snapshot never appeared.

- Group Antigravity pools, and show Cursor plan meters plus named buckets.
- Use email provenance when the host sends it, otherwise System default.
- Hide an empty Claude or Codex card when another provider is active.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The mobile snapshot schema now accepts limits for eight additional providers and related bucket and usage metadata. Selectors convert those limits into provider usage rows. The Accounts screen renders active additional-provider sections and conditionally renders Claude and Codex sections. The Codex reset-credit scope input now uses a narrower limits type.

Priority: Normal

Merge Risk: Low · up to 8b82e

A mismatched host snapshot can show a misleading usage label, but the impact is limited to read-only display. The change is mergeable with this bounded issue tracked.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rendering usage for all active mobile agent providers.
Description check Passed The description covers the required sections, explains the user-facing change and implementation, links issue #18469, documents visual verification, testing, AI disclosure, and checklist items.
Linked Issues check Passed Issue #18469 requires the mobile Accounts screen to decode optional non-Claude/Codex provider data and show read-only usage, reset times, and provider errors while retaining older-host compatibility. …
Out of Scope Changes check Passed The changes stay within the Accounts snapshot and usage-screen feature. The added providers extend the desktop-provider usage set described by issue #18469. The selector tests and the `codex-reset-cre…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Linked Issues check

Explanation

Issue #18469 requires the mobile Accounts screen to decode optional non-Claude/Codex provider data and show read-only usage, reset times, and provider errors while retaining older-host compatibility. The schema adds optional fields for Grok, Gemini, OpenCode Go, Kimi, MiniMax, Antigravity, Cursor, and Z.ai. The selectors and AdditionalProvidersUsageSections render grouped buckets, named buckets, plan totals, standard windows, reset text, provenance, and errors. Existing Claude and Codex rendering remains supported. The PR adds schema and selector tests.

Full details: Out of Scope Changes check

Explanation

The changes stay within the Accounts snapshot and usage-screen feature. The added providers extend the desktop-provider usage set described by issue #18469. The selector tests and the codex-reset-credit-scope.ts type narrowing support the snapshot type expansion and preserve existing Codex behavior. No unrelated product behavior is demonstrated.

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

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects the mobile Accounts workflow across active agent providers.

Fix the Antigravity bucket decoder before merging; a supported host value can make the entire Accounts screen unavailable.

Findings

  1. P1 Valid buckets break Accounts ▶

Summary

This PR adds mobile usage sections for eight more providers.

  • Mobile Accounts shows usage rows for all active host providers.
  • The reset-credit helper accepts only the rate-limit fields it uses.

Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile

Comment on lines +52 to +56
RateLimitWindowSchema.extend({
name: z.string().min(1),
group: z.string().optional(),
windowName: z.string().optional()
}).passthrough()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Valid buckets break Accounts

The host uses windowMinutes: 0 for Antigravity windows it cannot map, such as monthly, and sends those buckets unchanged. These buckets inherit the .positive() check from RateLimitWindowSchema, so one valid bucket rejects the entire snapshot. Mobile then clears all account sections and shows Invalid accounts snapshot from host.

Allow zero for bucket durations while keeping ordinary windows strict, and add a decoder test for this host-supported case.

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


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: 5d3c8e8c-2bfe-4d30-b3c1-b1a4cbf0d96f
Commits

Reviewing files that changed from the base of the PR and between 4685830 and 8b82ef3.

Files selected for processing: 5
  • mobile/src/accounts/MobileAccountsScreen.tsx
  • 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

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

Comment on lines +196 to +203
gemini: ProviderRateLimitsSchema.nullable().optional(),
opencodeGo: ProviderRateLimitsSchema.nullable().optional(),
kimi: ProviderRateLimitsSchema.nullable().optional(),
antigravity: ProviderRateLimitsSchema.nullable().optional(),
minimax: ProviderRateLimitsSchema.nullable().optional(),
grok: ProviderRateLimitsSchema.nullable().optional(),
cursor: ProviderRateLimitsSchema.nullable().optional(),
zcode: ProviderRateLimitsSchema.nullable().optional(),

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

Validate each additional provider’s identity.

A snapshot with rateLimits.grok.provider: 'zcode' passes decoding. The screen then presents those limits under Grok, while the row selector can label the monthly quota MCP from the embedded zcode identity. Add provider-identity checks for the new keys, as the schema already does for Claude and Codex. (raw.githubusercontent.com)

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for working on this! #38187 just merged and shows usage on mobile for every provider the desktop tracks, so I'm closing this in favour of it. Your work here helped shape that change.

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.

[Feature]: Mobile Accounts screen should show usage for Grok (and the other desktop providers), not just Claude/Codex

3 participants