Skip to content

feat(mobile): show Grok, Antigravity and other provider usage on Accounts - #22626

Closed
hutune wants to merge 1 commit into
stablyai:mainfrom
hutune:feat/mobile-accounts-all-usage-providers
Closed

hutune wants to merge 1 commit into
stablyai:mainfrom
hutune:feat/mobile-accounts-all-usage-providers

Conversation

@hutune

@hutune hutune commented Sep 24, 2026

Copy link
Copy Markdown

ELI5

The desktop status bar can show usage for Grok, Antigravity, Gemini, OpenCode Go, Kimi and MiniMax, but the phone's Accounts screen only ever showed Claude and Codex. The phone was already receiving the other numbers from the desktop and throwing them away. This PR shows them.

What Changed

Before: Mobile → host → Accounts lists Claude and Codex only, even when the desktop has live Grok (or other) usage.

After: Below Claude and Codex, each other provider that has usage on the host gets its own read-only section with the same bars the Claude/Codex rows use: 5h, 7d and, new here, 30d (Grok and OpenCode Go report a monthly window). Reset countdowns and the last error line work the same way. Providers the host has no sign-in for stay hidden, so a Claude-only user sees no change.

Mechanism:

  • The host already sends the full RateLimitState (RuntimeAccountController.getSnapshot() returns rateLimits: rateLimits.getState()), so there is no host or wire change.
  • extra-provider-usage.ts reads grok, antigravity, gemini, opencodeGo, kimi, minimax from the snapshot, decodes each one on its own with the existing ProviderRateLimitsSchema, checks the provider identity, and keeps only entries that hasActiveProviderUsage says are worth showing.
  • ProviderUsageSection.tsx renders one section per provider, reusing UsageBar, getUsageBarState and getWindowResetLabel. Those two selectors now also accept 'monthly'.
  • The sections have no account rows or checkmarks, because desktop manages accounts only for Claude and Codex.

Why

  • Per-provider decoding instead of adding the fields to the strict snapshot schema. decodeAccountsSnapshot fails closed on purpose. If a newer host sends an extra provider in a shape this phone does not understand, adding the fields to the strict schema would blank the Claude and Codex sections too. Decoding each extra provider on its own means a bad entry only hides that provider.
  • Mobile-only, no new RPC. The data is already on the wire, and old hosts that omit a provider simply show nothing extra. Per docs/reference/remote-wire-compatibility.md, this needs no capability negotiation.
  • Smaller than the earlier attempt (feat(mobile): show all usage providers with visibility controls #9274). That PR also added per-provider visibility preferences and home-card changes, and it was closed during backlog cleanup after going stale. This PR only covers what the issue asks for, the Accounts screen. The home usage card and a visibility toggle can follow separately if wanted.

Linked Issue

Fixes #18469

Visual Proof

Before/after screenshots of the Accounts screen from the iOS simulator will be added in a follow-up comment (dev-client build in progress). The only visual change is the extra read-only sections below Codex. Existing Claude/Codex sections are untouched.

Testing

  • mobile/src/components/extra-provider-usage.test.ts (9 tests), each run through decodeAccountsSnapshot so it covers what the phone keeps from a real host payload:

    • Grok weekly + monthly windows, in display order.
    • Stable provider order regardless of payload order.
    • Hosts that only publish Claude/Codex show nothing extra.
    • Unavailable providers with no windows stay hidden.
    • Stale windows plus the error survive a failed refresh.
    • A malformed Grok entry is dropped while the Claude snapshot still decodes.
    • An entry stamped with another provider identity is ignored.
    • opencodeGo maps to the opencode-go provider id.
    • The monthly bar and reset countdown work.
  • vitest run for the account usage files: 37/37 pass (28 existing + 9 new).

  • Full mobile suite: 9432 passed. The 14 failing files fail identically on unmodified main in this checkout because they import root-workspace packages (typescript-api, oxc-parser) that a mobile-only install does not provide.

  • tsc --noEmit: same 7 pre-existing errors as main, none in the changed files. oxlint is clean on the changed files, and oxfmt --check is clean.

  • Platforms: logic tested on macOS. The UI uses only existing React Native primitives and styles, with no platform branches.

  • I manually tested these changes locally (simulator screenshots pending, see Visual Proof)

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

AI Disclosure

Written with Claude Code (Claude Opus 5.5). The author reviewed the change and the test results.

Review

Self-review:

  • Cross-platform: pure TypeScript selectors plus existing RN views, with no platform-specific code.
  • SSH/remote: the host that runs the rate-limit service is the one that publishes the snapshot. The phone only renders it.
  • Backwards compatibility: old hosts omit the new keys, so no extra sections appear. Unknown or malformed entries are dropped individually.
  • Performance: one safeParse per extra provider per snapshot, six at most.
  • Security: read-only display of data the host already sends. No new RPC and no credentials.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No desktop, host or protocol change. Mobile only.

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 (to follow in a comment)
  • 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). Mobile-scoped checks were run locally as listed above; the root desktop checks are left to CI because this PR does not touch the desktop.

🤖 Generated with Claude Code

…unts

The host already publishes every provider in the accounts snapshot, but the
Accounts screen only rendered Claude and Codex. Add a read-only usage section
for Grok, Antigravity, Gemini, OpenCode Go, Kimi and MiniMax, shown only when
the host has usage for that provider.

Each extra provider is decoded on its own, so a malformed or foreign entry
hides only that provider and never fails the Claude/Codex snapshot closed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

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

Important

Including antigravity renders a second section carrying the Gemini numbers (or nothing). The host still produces Antigravity as { ...gemini, provider: 'antigravity' }, and desktop only shows that slot behind PATH detection plus a checked status-bar item — gates this screen cannot evaluate. The linked issue already flagged landing #9122 first.

Reviewed changes

  • New extra-provider reader — mobile/src/components/extra-provider-usage.ts decodes grok/antigravity/gemini/opencodeGo/kimi/minimax from the snapshot's passthrough rateLimits, checks each provider identity, and keeps only entries that hasActiveProviderUsage accepts.
  • New read-only section — ProviderUsageSection.tsx renders one card per provider using UsageBar/getUsageBarState/getWindowResetLabel, pairing windows into two-bar rows with a filler for odd counts.
  • Monthly window support — UsageWindowKey gains 'monthly'; getUsageBarState and getWindowResetLabel widen to it, with no behavior change for existing callers.
  • Accounts wiring — extra sections render below Codex, above the footer hint.
  • Tests — 9 new cases, each decoded through decodeAccountsSnapshot, with exact toEqual assertions.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

// RateLimitState field, provider is the identity the host stamps on it.
export const EXTRA_USAGE_PROVIDERS = [
{ key: 'grok', provider: 'grok', title: 'Grok' },
{ key: 'antigravity', provider: 'antigravity', title: 'Antigravity' },

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.

Antigravity is still the Gemini mirror on the host, so this entry produces a section with Gemini's exact numbers (or, when Gemini fails, nothing at all). Desktop only grants the slot when the Antigravity status-bar item is checked and PATH detection confirms the CLI; this screen has neither signal, and an identical duplicate is worse than the desktop behaviour it is copying.

Technical details
# Antigravity duplicates the Gemini section

## Affected sites
- `src/main/rate-limits/antigravity-usage-mirror.ts:13-15` — returns `{ ...gemini, provider: 'antigravity' }` whenever `gemini.status === 'ok'`; there is no independent Antigravity fetch.
- `src/renderer/src/components/status-bar/use-status-bar-controller.ts:107-123` — desktop requires `statusBarItems.includes('antigravity')`, `isStatusBarItemAvailable('antigravity', detectedAgentIds)`, and `geminiCliOAuthEnabled`.
- `mobile/src/components/extra-provider-usage.ts:12` — mobile applies none of those gates.

## Required outcome
- Two sections must not show the same usage, and Gemini usage must not be attributed to Antigravity.

## Suggested approach
- Skip the `antigravity` entry while a Gemini snapshot has active usage, or drop it until #9122 gives Antigravity a real source. If the entry is removed, `extra-provider-usage.test.ts` ("stable order") asserts `antigravity` is present and needs updating.

## Open questions for the human
- Is #9122 a prerequisite for surfacing Antigravity here, or should it be omitted until then?

continue
}
const limits = parsed.data
if (!hasActiveProviderUsage(limits)) {

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.

A provider whose first fetch failed (status: 'error', no windows) is dropped here, so a signed-in Grok with an expired session or a Kimi with an expired token shows no section and no error text. That differs from desktop, which hides only unavailable and keeps error visible, and from #18469's ask for the existing "run X to refresh" states.

Technical details
# Error-only providers disappear

## Affected sites
- `mobile/src/components/extra-provider-usage.ts:42` — `hasActiveProviderUsage` returns false for `status: 'error'` with no windows.
- `mobile/src/components/account-usage-state.ts:63-76` — deliberate, and covered by `account-usage-state.test.ts:81`.

## Required outcome
- Decide whether a configured provider that has never fetched successfully should show its error copy. If yes, `error` needs to be distinguished from `unavailable` at this gate rather than folded into `hasActiveProviderUsage`.

## Open questions for the human
- Is hiding error-only providers intentional to keep the screen quiet, or an oversight from reusing `hasActiveProviderUsage`?

import type { ExtraProviderUsage } from '../components/extra-provider-usage'

const WINDOW_LABELS: Record<UsageWindowKey, string> = {
session: '5h',

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.

Gemini's session is synthesized from its buckets, whose windowMinutes is 60, so labelling it 5h misstates the window (it can read "5h … Resets in 50m"). Desktop renders one row per model bucket instead of this synthetic summary.

Technical details
# Gemini's synthesized session is labelled as a 5h window

## Affected sites
- `src/main/rate-limits/gemini-usage-fetcher.ts:72` — `session: deriveSessionSummary(buckets)` picks the most-constrained bucket.
- `src/main/rate-limits/gemini-bucket-formatting.ts:43` — that bucket's `windowMinutes` is `60`.
- `mobile/src/accounts/ProviderUsageSection.tsx:12` — `WINDOW_LABELS.session = '5h'`.
- `src/renderer/src/components/status-bar/tooltip.tsx:145-153` — desktop renders bucket names instead.

## Required outcome
- Don't label a 60-minute window `5h`. Either render Gemini buckets by name or omit the synthetic session bar.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The mobile Accounts screen now displays usage sections for supported providers beyond Claude and Codex. The new extraction helper validates provider rate limits and returns available session, weekly, and monthly windows. Usage bars show window labels, reset text, loading or empty states, and errors. The usage state helpers now support monthly windows.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 39b12

Fix the missing first-poll error guidance and the misleading Gemini usage label before merging.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed and covers the change, rationale, linked issue, implementation, testing, compatibility, and review considerations. However, the required visual proof for this UI change is … Attach before-and-after screenshots or a video of the mobile Accounts screen, then mark the corresponding checklist item complete. Do not use N/A because this PR changes the UI.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding usage display for Grok, Antigravity, and other providers on the mobile Accounts screen.
Linked Issues check ✅ Passed Issue #18469 requires mobile usage sections for Grok, Gemini, Kimi, MiniMax, OpenCode Go, and Antigravity. The Accounts screen now renders these providers below Claude and Codex when active usage exis…
Out of Scope Changes check ✅ Passed The changes stay within issue #18469. They add the requested mobile usage rendering, provider decoding, shared monthly-window typing, layout support, and automated tests. No unrelated feature, account…
Full details: Description check

Explanation

The description is detailed and covers the change, rationale, linked issue, implementation, testing, compatibility, and review considerations. However, the required visual proof for this UI change is not attached, and the checklist confirms that it is still pending.

  • Fix all pre-merge checks with AI

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.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a7c4f4f8-21d5-44e0-ad62-3ef1f0cdfc58

📥 Commits

Reviewing files that changed from the base of the PR and between 122b8c2 and 39b1265.

📒 Files selected for processing (7)
  • mobile/app/h/[hostId]/accounts.tsx
  • mobile/src/accounts/ProviderUsageSection.tsx
  • mobile/src/accounts/mobile-accounts-screen-styles.ts
  • mobile/src/components/AccountUsage.tsx
  • mobile/src/components/account-usage-state.ts
  • mobile/src/components/extra-provider-usage.test.ts
  • mobile/src/components/extra-provider-usage.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +10 to +15

const WINDOW_LABELS: Record<UsageWindowKey, string> = {
session: '5h',
weekly: '7d',
monthly: '30d'
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,76p' mobile/src/accounts/ProviderUsageSection.tsx
rg -n 'session.*(hour|duration)|weekly.*(hour|day)|monthly.*(day|hour)|5h|7d|30d' mobile/src src | head -100

Repository: stablyai/orca

Length of output: 12682


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- changed-file diff ---'
git diff --no-ext-diff --unified=80 122b8c25d7c16f76e395bf9a65887d7c4bc5003b 39b1265e3149829602403255c83308251faa286f -- mobile/src/accounts/ProviderUsageSection.tsx mobile/src/components/extra-provider-usage.ts mobile/src/components/AccountUsage.tsx mobile/src/accounts

printf '%s\n' '--- candidate files ---'
git ls-files | rg '(^|/)(extra-provider-usage|AccountUsage|ProviderUsageSection|.*provider.*usage.*|.*usage.*provider.*)' || true

printf '%s\n' '--- usage type and symbol references ---'
rg -n -S 'ExtraProviderUsage|ProviderUsageSection|UsageWindowKey|windowKey|session|weekly|monthly|resetAt|reset' mobile/src --glob '*.{ts,tsx}' | head -240

Repository: stablyai/orca

Length of output: 43024


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions

Length of output: 36896


🏁 Script executed:

git diff --no-ext-diff --unified=80 122b8c25d7c16f76e395bf9a65887d7c4bc5003b 39b1265e3149829602403255c83308251faa286f -- mobile/src/accounts/ProviderUsageSection.tsx mobile/src/components/extra-provider-usage.ts mobile/src/components/AccountUsage.tsx mobile/src/accounts
rg -n -S 'ExtraProviderUsage|ProviderUsageSection|UsageWindowKey|session|weekly|monthly|resetAt|reset' mobile/src --glob '*.{ts,tsx}' | head -240

Repository: stablyai/orca

Length of output: 41392


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- exact type/schema definitions ---'
rg -n -S 'ProviderRateLimitsSchema|type ProviderRateLimits|interface ProviderRateLimits|UsageWindowKey|RateLimitState' mobile/src src --glob '*.{ts,tsx}' | head -240

printf '%s\n' '--- accepted-provider producers and provider registrations ---'
rg -n -S 'grok|antigravity|opencode-go|opencodeGo|gemini|kimi|minimax' src/main mobile/src --glob '*.{ts,tsx}' | head -320

printf '%s\n' '--- section callers and screen wiring ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS|extraProvider' mobile/src --glob '*.{ts,tsx}' | head -200

printf '%s\n' '--- display conventions ---'
rg -n -S 'getProviderDisplayName|usage.*window|window.*label|reset.*label|Resets in|5h|7d|30d' src/renderer/src mobile/src --glob '*.{ts,tsx}' | head -260

Repository: stablyai/orca

Length of output: 41582


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- exact type/schema definitions ---'
rg -n -S 'ProviderRateLimitsSchema|type ProviderRateLimits|interface ProviderRateLimits|UsageWindowKey|RateLimitState' mobile/src src --glob '*.{ts,tsx}' | head -240
printf '%s\n' '--- accepted-provider producers and registrations ---'
rg -n -S 'grok|antigravity|opencode-go|opencodeGo|gemini|kimi|minimax' src/main mobile/src --glob '*.{ts,tsx}' | head -320
printf '%s\n' '--- section callers and screen wiring ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS|extraProvider' mobile/src --glob '*.{ts,tsx}' | head -200
printf '%s\n' '--- display conventions ---'
rg -n -S 'getProviderDisplayName|usage.*window|window.*label|reset.*label|Resets in|5h|7d|30d' src/renderer/src mobile/src --glob '*.{ts,tsx}' | head -260

Repository: stablyai/orca

Length of output: 41558


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- shared rate-limit contract ---'
sed -n '40,145p' src/shared/rate-limit-types.ts

printf '%s\n' '--- mobile schema and usage state ---'
sed -n '1,115p' mobile/src/components/accounts-snapshot.ts
sed -n '1,145p' mobile/src/components/account-usage-state.ts

printf '%s\n' '--- mobile caller reachability ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS' mobile/src --glob '*.{ts,tsx}'
rg -n -S 'rateLimits|accountsSnapshot|AccountsSnapshot' mobile/src/accounts mobile/src --glob '*.{ts,tsx}' | head -180

printf '%s\n' '--- rate-limit producer files ---'
git ls-files src/main | rg 'rate.limit|rate-limits|usage|provider' | head -220
rg -n -S 'ProviderRateLimits|session:|weekly:|monthly:|resetsAt|resetAt|window' src/main/rate-limits src/main/*usage* src/main/*provider* --glob '*.{ts,tsx}' 2>/dev/null | head -320

Repository: stablyai/orca

Length of output: 41408


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- shared rate-limit contract ---'
sed -n '40,145p' src/shared/rate-limit-types.ts
printf '%s\n' '--- mobile schema and usage state ---'
sed -n '1,115p' mobile/src/components/accounts-snapshot.ts
sed -n '1,145p' mobile/src/components/account-usage-state.ts
printf '%s\n' '--- mobile caller reachability ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS' mobile/src --glob '*.{ts,tsx}'
rg -n -S 'rateLimits|accountsSnapshot|AccountsSnapshot' mobile/src/accounts mobile/src --glob '*.{ts,tsx}' | head -180
printf '%s\n' '--- rate-limit producer files ---'
git ls-files src/main | rg 'rate.limit|rate-limits|usage|provider' | head -220
rg -n -S 'ProviderRateLimits|session:|weekly:|monthly:|resetsAt|resetAt|window' src/main/rate-limits src/main/*usage* src/main/*provider* --glob '*.{ts,tsx}' 2>/dev/null | head -320

Repository: stablyai/orca

Length of output: 42240


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- account route files and composition ---'
git ls-files mobile/src/accounts | sort
rg -n -S 'MobileAccounts|AccountsScreen|AccountUsage|ProviderUsage|snapshot|accounts' mobile/src/accounts --glob '*.{ts,tsx}' | head -260

printf '%s\n' '--- exact extra-provider tests ---'
sed -n '1,155p' mobile/src/components/extra-provider-usage.test.ts

printf '%s\n' '--- Gemini producer ---'
sed -n '1,255p' src/main/rate-limits/gemini-usage-fetcher.ts
rg -n -S 'deriveSessionSummary|windowMinutes|session:' src/main/rate-limits/gemini* --glob '*.{ts,tsx}'

printf '%s\n' '--- Kimi producer ---'
sed -n '160,270p' src/main/rate-limits/kimi-fetcher.ts

printf '%s\n' '--- OpenCode and Grok producer assignments ---'
rg -n -S 'windowMinutes|session:|weekly:|monthly:' src/main/rate-limits/opencode-go* src/main/rate-limits/grok* --glob '*.{ts,tsx}' | head -220

Repository: stablyai/orca

Length of output: 28322


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- account route files and composition ---'
git ls-files mobile/src/accounts | sort
rg -n -S 'MobileAccounts|AccountsScreen|AccountUsage|ProviderUsage|snapshot|accounts' mobile/src/accounts --glob '*.{ts,tsx}' | head -260
printf '%s\n' '--- exact extra-provider tests ---'
sed -n '1,155p' mobile/src/components/extra-provider-usage.test.ts
printf '%s\n' '--- Gemini producer ---'
sed -n '1,255p' src/main/rate-limits/gemini-usage-fetcher.ts
rg -n -S 'deriveSessionSummary|windowMinutes|session:' src/main/rate-limits/gemini* --glob '*.{ts,tsx}'
printf '%s\n' '--- Kimi producer ---'
sed -n '160,270p' src/main/rate-limits/kimi-fetcher.ts
printf '%s\n' '--- OpenCode and Grok producer assignments ---'
rg -n -S 'windowMinutes|session:|weekly:|monthly:' src/main/rate-limits/opencode-go* src/main/rate-limits/grok* --glob '*.{ts,tsx}' | head -220

Repository: stablyai/orca

Length of output: 28322


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- all mobile account route files ---'
git ls-files mobile | rg -i '(^|/)(app|accounts?)(/|\\.|$)|accounts' | head -220
printf '%s\n' '--- complete mobile references ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS' mobile --glob '*.{ts,tsx}' || true
printf '%s\n' '--- account route entrypoint candidates ---'
rg -n -S '\\[hostId\\]/accounts|mobileAccountsRouteTarget|accounts route|Accounts' mobile/app mobile/src --glob '*.{ts,tsx}' 2>/dev/null | head -220

Repository: stablyai/orca

Length of output: 23616


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- all mobile account route files ---'
git ls-files mobile | rg -i '(^|/)(app|accounts?)(/|\.|$)|accounts' | head -220
printf '%s\n' '--- complete mobile references ---'
rg -n -S 'ProviderUsageSection|getExtraProviderUsage|EXTRA_USAGE_PROVIDERS' mobile --glob '*.{ts,tsx}' || true
printf '%s\n' '--- account route entrypoint candidates ---'
rg -n -S '\[hostId\]/accounts|mobileAccountsRouteTarget|accounts route|Accounts' mobile/app mobile/src --glob '*.{ts,tsx}' 2>/dev/null | head -220

Repository: stablyai/orca

Length of output: 24036


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- line-numbered reviewed path ---'
nl -ba mobile/src/accounts/ProviderUsageSection.tsx | sed -n '8,52p'
nl -ba mobile/app/h/'[hostId]'/accounts.tsx | sed -n '376,392p'
nl -ba mobile/src/components/extra-provider-usage.ts | sed -n '8,47p'

printf '%s\n' '--- Gemini duration producer ---'
nl -ba src/main/rate-limits/gemini-bucket-formatting.ts | sed -n '32,88p'
nl -ba src/main/rate-limits/gemini-bucket-formatting.test.ts | sed -n '20,45p'
nl -ba src/main/rate-limits/gemini-usage-fetcher.ts | sed -n '64,78p'

printf '%s\n' '--- existing duration-label helpers/conventions ---'
rg -n -S 'format.*(Duration|Window|Minutes)|windowMinutes.*(60|300|10080|43200)|minutes.*(hour|day)|\\b[0-9]+h\\b|\\b[0-9]+d\\b' mobile/src src/shared src/main/rate-limits --glob '*.{ts,tsx}' | head -240

Repository: stablyai/orca

Length of output: 20207


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- line-numbered reviewed path ---'
nl -ba mobile/src/accounts/ProviderUsageSection.tsx | sed -n '8,52p'
nl -ba mobile/app/h/'[hostId]'/accounts.tsx | sed -n '376,392p'
nl -ba mobile/src/components/extra-provider-usage.ts | sed -n '8,47p'
printf '%s\n' '--- Gemini duration producer ---'
nl -ba src/main/rate-limits/gemini-bucket-formatting.ts | sed -n '32,88p'
nl -ba src/main/rate-limits/gemini-bucket-formatting.test.ts | sed -n '20,45p'
nl -ba src/main/rate-limits/gemini-usage-fetcher.ts | sed -n '64,78p'
printf '%s\n' '--- existing duration-label helpers/conventions ---'
rg -n -S 'format.*(Duration|Window|Minutes)|windowMinutes.*(60|300|10080|43200)|minutes.*(hour|day)|\b[0-9]+h\b|\b[0-9]+d\b' mobile/src src/shared src/main/rate-limits --glob '*.{ts,tsx}' | head -240

Repository: stablyai/orca

Length of output: 38309


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- existing window-label implementations ---'
rg -n -S 'formatWindowLabel|window label|windowMinutes' src/renderer/src src/main/rate-limits mobile/src --glob '*.{ts,tsx}' | rg -v 'test|__fixtures__' | head -220
printf '%s\n' '--- shared duration formatter ---'
nl -ba src/shared/rate-limit-reset-format.ts | sed -n '1,38p'

Repository: stablyai/orca

Length of output: 5675


Derive extra-provider labels from windowMinutes.

The accounts route renders Gemini usage. Gemini emits a 60-minute session window, but this component labels every session as 5h. The desktop usage convention formats labels from windowMinutes. Use the payload duration here as well.

Suggested fix
-const WINDOW_LABELS: Record<UsageWindowKey, string> = {
-  session: '5h',
-  weekly: '7d',
-  monthly: '30d'
+function getWindowLabel(limits: ExtraProviderUsage['limits'], windowKey: UsageWindowKey): string {
+  const windowMinutes = limits[windowKey]?.windowMinutes
+  if (windowMinutes == null) return ''
+  if (windowMinutes % (60 * 24) === 0) return `${windowMinutes / (60 * 24)}d`
+  if (windowMinutes % 60 === 0) return `${windowMinutes / 60}h`
+  return `${windowMinutes}m`
 }
...
-                        label={WINDOW_LABELS[windowKey]}
+                        label={getWindowLabel(limits, windowKey)}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const WINDOW_LABELS: Record<UsageWindowKey, string> = {
session: '5h',
weekly: '7d',
monthly: '30d'
}
function getWindowLabel(limits: ExtraProviderUsage['limits'], windowKey: UsageWindowKey): string {
const windowMinutes = limits[windowKey]?.windowMinutes
if (windowMinutes == null) return ''
if (windowMinutes % (60 * 24) === 0) return `${windowMinutes / (60 * 24)}d`
if (windowMinutes % 60 === 0) return `${windowMinutes / 60}h`
return `${windowMinutes}m`
}

Comment on lines +42 to +43
if (!hasActiveProviderUsage(limits)) {
continue

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'errorProvider|status: .error.|fetch.*[Gg]emini|fetch.*[Gg]rok|fetch.*[Mm]ini[Mm]ax' src/main/rate-limits | head -110
sed -n '1,170p' src/main/rate-limits/service-live-claude-usage.test.ts

Repository: stablyai/orca

Length of output: 17521


🏁 Script executed:

set -eu
printf '%s\n' '--- helper and related mobile code ---'
cat -n mobile/src/components/extra-provider-usage.ts
rg -n -A35 -B10 'ProviderRateLimitsSchema|hasActiveProviderUsage|ProviderUsageSection|getExtraProviderUsage' mobile/src/components mobile/src/accounts mobile/app/h/\[hostId\]/accounts.tsx
printf '%s\n' '--- service provider ingestion and state shaping ---'
rg -n -A35 -B12 'fetchGeminiRateLimits|fetchGrokRateLimits|fetchKimiRateLimits|fetchOpenCodeGoUsage|fetchMiniMaxRateLimits|status: .error.|set.*Rate|provider.*status' src/main/rate-limits/service.ts src/main/rate-limits/gemini-usage-fetcher.ts src/main/rate-limits/grok-fetcher.ts src/main/rate-limits/kimi-fetcher.ts src/main/rate-limits/opencode-go-usage-fetcher.ts src/main/rate-limits/minimax/minimax-fetcher.ts

Repository: stablyai/orca

Length of output: 42561


🏁 Script executed:

set -eu
printf '%s\n' '--- helper and related mobile code ---'
cat -n mobile/src/components/extra-provider-usage.ts
rg -n -A35 -B10 'ProviderRateLimitsSchema|hasActiveProviderUsage|ProviderUsageSection|getExtraProviderUsage' mobile/src/components mobile/src/accounts 'mobile/app/h/[hostId]/accounts.tsx'
printf '%s\n' '--- service provider ingestion and state shaping ---'
rg -n -A35 -B12 'fetchGeminiRateLimits|fetchGrokRateLimits|fetchKimiRateLimits|fetchOpenCodeGoUsage|fetchMiniMaxRateLimits|status: .error.|set.*Rate|provider.*status' src/main/rate-limits/service.ts src/main/rate-limits/gemini-usage-fetcher.ts src/main/rate-limits/grok-fetcher.ts src/main/rate-limits/kimi-fetcher.ts src/main/rate-limits/opencode-go-usage-fetcher.ts src/main/rate-limits/minimax/minimax-fetcher.ts

Repository: stablyai/orca

Length of output: 42637


🏁 Script executed:

set -eu
cat -n mobile/src/components/extra-provider-usage.ts
rg -n -A35 -B10 'ProviderRateLimitsSchema|hasActiveProviderUsage|getExtraProviderUsage' mobile/src/components
rg -n -A35 -B12 'fetchGeminiRateLimits|fetchGrokRateLimits|fetchKimiRateLimits|fetchOpenCodeGoUsage|fetchMiniMaxRateLimits|status: .error.|set.*Rate|provider.*status' src/main/rate-limits/service.ts src/main/rate-limits/gemini-usage-fetcher.ts src/main/rate-limits/grok-fetcher.ts src/main/rate-limits/kimi-fetcher.ts src/main/rate-limits/opencode-go-usage-fetcher.ts src/main/rate-limits/minimax/minimax-fetcher.ts

Repository: stablyai/orca

Length of output: 42897


🏁 Script executed:

set -eu
rg -n -A45 -B20 'fetchOpenCodeGoUsage|fetchKimiRateLimits|fetchGeminiRateLimits|fetchGrokRateLimits|fetchMiniMaxRateLimits|rateLimits|apply.*Provider|update.*Provider|providerResult' src/main/rate-limits/service.ts

Repository: stablyai/orca

Length of output: 151


🏁 Script executed:

set -u
printf '%s\n' '--- service files ---'
fd -t f -i 'service|rate-limit' src/main/rate-limits | head -80
printf '%s\n' '--- service bindings ---'
rg -n -i -A30 -B15 'opencode|fetch.*rate.?limit|ProviderRateLimits|rateLimits' src/main/rate-limits --glob '*.ts' | head -260

Repository: stablyai/orca

Length of output: 25151


🏁 Script executed:

set -eu
rg -n -A55 -B20 -i 'opencode|fetch.*provider|ProviderRateLimits|apply.*result|status.*error|rateLimits' \
  src/main/rate-limits/service/service-provider-cycles.ts \
  src/main/rate-limits/service/service-full-cycle-application.ts \
  src/main/rate-limits/service/service-state.ts \
  src/main/rate-limits/service.ts

Repository: stablyai/orca

Length of output: 41990


🏁 Script executed:

set -eu
cat -n src/main/rate-limits/service/service-result-policy.ts
sed -n '120,195p' src/main/rate-limits/service/service-full-cycle-application.ts

Repository: stablyai/orca

Length of output: 7515


🐛 Suggested fix
-    if (!hasActiveProviderUsage(limits)) {
+    if (!hasActiveProviderUsage(limits) && !(limits.status === 'error' && limits.error)) {
       continue

Keep initial extra-provider errors visible.

OpenCode Go fetch failures return status: 'error' with an error message and no usage windows. On the initial poll, the service applies that result because no previous state exists. The mobile filter then drops it, so the Accounts screen cannot display the error. Retain error entries with a message while continuing to hide unavailable entries.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!hasActiveProviderUsage(limits)) {
continue
if (!hasActiveProviderUsage(limits) && !(limits.status === 'error' && limits.error)) {
continue

@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

2 participants