Skip to content

fix(rate-limits): show saved account usage in the switcher - #24365

Open
innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:mac-per-account-usage
Open

innocarpe wants to merge 3 commits into
stablyai:mainfrom
innocarpe:mac-per-account-usage

Conversation

@innocarpe

@innocarpe innocarpe commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If you keep several Claude or Codex logins, each row in the account list now shows that login's limit, the same way the iOS accounts screen does. The row that is currently in use shows the session, weekly, and Fable numbers already in the header. Each other saved login shows its own numbers after a usage read. A dead login is not given a made-up percent.

What Changed

Before: the active account row only said Active. The limit in the header was not drawn on that row, so the login you would switch away from had no meter. Saved Claude rows stayed empty when the usage read failed. Refresh posted a form body with no scopes, which Claude Code 2.1.286 does not send, and a rejected access token whose expiry was still in the future was not refreshed at all.

After:

  • The active row draws the header's session, weekly, and Fable windows (Codex draws the weekly window it already has). System default gets those windows only while that row is the selected login. The Active label stays.
  • Other rows still draw the windows from their own usage read, using the existing used/remaining percentage setting.
  • Inactive Claude refresh matches Claude Code 2.1.286: JSON, the public client id, the prod scope list, and one retry with the stored scopes when the token endpoint returns invalid_scope.
  • If that usage read is a stale token and this call has not already refreshed, Orca refreshes once and reads usage again. A still-valid refresh token becomes windows. A refresh that fails does not invent a percent, and the CLI usage supplement still does not run for a different login.
  • An invalidated Codex login still offers Sign in. Other probe errors stay a status line.

Why

People who keep several saved logins pick the next account from the limit that is left. Painting the header windows on the active row uses numbers the app already has. Matching the Claude Code refresh request is what turns a rejected access token into those windows, instead of replacing the blank row with a status sentence. A dead refresh token still cannot show a real percent.

This does not persist the last reading across restart. That remains part of #14833 and is not what this change claims to finish.

Linked Issue

Part of #14833. Related: #21034. Does not close either issue.

Visual Proof

N/A for a packaged app screenshot: this change was not run inside a rebuilt desktop app. Unit tests cover the active row receiving the header windows, system default staying empty unless it is the selected login, the JSON refresh grant and the invalid_scope retry, and a not-yet-expired access token that is rejected, refreshed once, and then read as session and weekly windows.

Testing

Platforms: macOS (unit tests only).

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

node node_modules/vitest/vitest.mjs run --config config/vitest.config.ts on:

  • src/main/claude-accounts/oauth-refresh.test.ts
  • src/main/rate-limits/claude-fetcher-managed-account-usage.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/shared/codex-auth-errors.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/inline-usage-bars.test.tsx
  • src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx

67 tests passed. oxlint reported 0 warnings on the production files this change edits.

AI Disclosure

Grok, xAI, was used to implement this change and the tests.

Review

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

Security: a failed OAuth read does not write or trust a CLI usage reading for a different login. The refresh log records status and error code only, not the token. Cross-platform: the grant and the row state are platform-neutral. SSH/remote: a remote-owned Codex account still does not get a local sign-in button. Mobile already draws these windows on each account row; this change is the desktop list catching up.

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)

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Refactors OAuth token refresh and rate-limit display for saved accounts.

The PR appears safe to merge based on the changes since the previous review and the current state of prior findings.

Summary

The PR shows usage windows on the selected account row and uses each other saved account’s own usage read. It also updates Claude OAuth refresh requests, retries a rejected access token once, and shows account-specific error or sign-in states.

  • The changes since the previous review make credential rotation per-account and recognize a replaced access token even when the refresh token stays the same.
  • No new actionable issue was established in those changes.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Menu[Account switcher] --> Active[Selected row: header usage]
  Menu --> Inactive[Saved row: account usage read]
  Inactive --> Queue[Per-account credential rotation queue]
  Queue --> OAuth[Claude token refresh when needed]
  Inactive --> Windows[Usage windows or status]
Loading

Reviews (6) · Last reviewed commit: "fix(rate-limits): keep a refreshed acces..."

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

✅ No new issues found.

Reviewed changes

  • Inactive Claude previews now return a classified failure — readInactiveClaudeOAuthUsage catches a rejected OAuth read and stores a makeClaudeUsageResult('error', …) with failureKind, attemptedSources: ['oauth'], and authProvenance: managed:<id>:inactive-preview, so the switcher row renders a real status instead of going blank.
  • Usage-panel supplement stays on the success path — fetchInactiveClaudeAccountUsage returns early when oauthLimits.status !== 'ok', so a 401 never falls through to a CLI reading that could belong to another login.
  • Inactive batches persist thrown failures — both Claude and Codex catch blocks store inactiveAccountPreviewFailure(...) through applyStalePolicy instead of deleting the cache, and skip the debounce stamp only when a whole batch threw with zero settlements so the next open retries.
  • Shared row-state maps inactive entries to a preview — new previewInactiveAccountUsage drives the switcher menus; isConfirmedSignedOut gains a Codex branch so an invalidated ChatGPT token becomes a sign-in while other probe errors keep their status line.
  • New Codex auth-error patterns — /please try signing in again/i and /authentication token has been invalidated/i.

One thing worth being aware of, not a defect: the new Codex branch lives in getUsageRosterRowState, which also backs UsageRosterPanel, so active-Codex rows can now flip from an error row to a sign-in row whose click routes to onSignIn rather than opening the provider. That matches the stated intent and existing component tests still pass.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

Claude and Codex inactive-account fetch cycles now cache current, non-aborted failures as error previews. Shared row-state helpers classify active limits and inactive-account data. The Claude and Codex switcher menus use these previews to render loading, usage, sign-in, or message states. Codex authentication matching now recognizes invalidated-token messages, with tests covering authentication classification, preview states, and retry after a failed Claude fetch.

Merge Risk: Low · previous review dfa08

A failed usage read can leave an old percentage visible without warning. This is a bounded display risk; retained readings should be identified as stale.

Security architecture risk: Low · up to 64fdf

Refreshes remain tied to account-owned storage, and retries are bounded. No new account-boundary bypass or credential disclosure was established. The changed permission requests and incomplete recovery coverage warrant a low, rather than minimal, risk assessment.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated credential-write scope is the saved account being processed, using its managed file or account-specific keychain entry. The shared coordinator does not itself confer authority over another account.

Trust Boundaries and Controls

  • observed — Managed credential reads and writes retain account-owned path resolution. WSL ownership checks include managed-root/path constraints and an account-matching ownership marker.
  • observed — The changed runtime refresh method is protected and called through runtime synchronization. The supplied test ranges exercise concurrency and token reuse; their public-API classification does not demonstrate a newly exposed external route.
  • observed — Inactive usage returns failed OAuth results before invoking a usage-panel supplement. The concurrency tests also expect token reuse without the token endpoint or PTY fallback.

Resilience and Maintainability Implications

  • inferred — A successful server-side rotation followed by a failed local write can leave storage holding an invalidated refresh token. Inactive usage keeps the new token only for the current fetch, without a demonstrated durable recovery mechanism. The base expiring-token path already had this limitation; the new stale-token retry inherits it.
  • observed — Inactive-preview cancellation and account-currentness checks prevent stale results from repopulating the usage cache, but an entered credential rotation has no caller abort signal. Cache cancellation is therefore distinct from cancellation of credential mutation.

Hardening Proposals

  • proposed — Consider an explicit recovery policy for rotated credentials that cannot be persisted, and verify removal/relogin interleavings against the same account identity. This would strengthen credential-lifecycle recovery rather than address a demonstrated account-boundary exploit.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "fix(rate-limits): show saved account usage in the switcher" matches the main change. The diff adds usage windows to account rows in the status bar switcher for both Claude and Codex. It als…
Description check Passed The description follows the repository template and fills in every required section: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Agent skill upstream boundary, Notes, …
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(rate-limits): show saved account usage in the switcher" matches the main change. The diff adds usage windows to account rows in the status bar switcher for both Claude and Codex. It also fixes inactive account fetch errors and Claude refresh behavior. The title is specific and concise, and it follows a conventional commit style.

Full details: Description check

Explanation

The description follows the repository template and fills in every required section: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Agent skill upstream boundary, Notes, and Checklist. It states the before and after behavior, the mechanism, and the reasons for the approach. The Linked Issue section refers to #14833 as 'Part of' and does not close it. The Visual Proof section gives N/A with a reason. Some checklist items remain unchecked, including the lint, typecheck, test, and build item, and the Testing section lists macOS unit tests only. The template asks for a Linked Issue with a closing reference from outside contributors, and this description uses 'Part of' and 'Related' with no 'Fixes' line. The description is mostly complete, so it passes, but the reviewer should confirm the issue linking requirement and the unchecked build and test items.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

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

@innocarpe
innocarpe force-pushed the mac-per-account-usage branch from 11e25e2 to 3d27958 Compare October 1, 2026 11:59

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 891110b6-76ec-48aa-b6e6-559f4f03efcf

📥 Commits

Reviewing files that changed from the base of the PR and between 11e25e2af7cef1f05b501d9132e1a91626d8df75 and 3d27958b0af37d5da2e2a83cafb2a6561e18bbdb.

📒 Files selected for processing (8)
  • src/main/claude-accounts/oauth-refresh.test.ts
  • src/main/claude-accounts/oauth-refresh.ts
  • src/main/rate-limits/claude-fetcher-managed-account-usage.test.ts
  • src/main/rate-limits/claude-managed-account-usage.ts
  • src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.ts

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

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

ℹ️ No critical issues — one scope-selection edge case worth a look inline.

Reviewed changes

  • OAuth refresh posts a JSON grant with an explicit scope list — refreshClaudeOauthCredentials now builds a plan from the stored blob (client id, scopes, subscription) and posts application/json with scope, retrying once with the stored scopes on 400 invalid_scope.
  • Inactive usage re-reads the windows after a 401 — fetchInactiveClaudeAccountUsage refreshes once (and persists the rotation) when the OAuth read classifies as stale-token and no proactive refresh already ran.
  • Active rows paint the header windows — new previewAccountRowUsage drives both switcher menus, so the selected account's own row renders session/weekly/Fable meters (or its status line) instead of nothing.
  • Tests cover the JSON/scope body, the invalid_scope retry, the stored-client-id path, the 401 re-read, and active-row previews; the touched suites pass.

ℹ️ The new refresh body is covered only by a mocked net.fetch

refreshClaudeOauthCredentials now sends application/json with an explicit scope list, but the only coverage is a mocked net.fetch; the real token endpoint's accepted content type and scope semantics are not exercised. That module also backs the active managed-account launch refresh (runtime-auth-managed-credentials.ts:66), so a wrong contract would surface as a launch-time refresh failure rather than just a blank preview row. Since the PR notes no packaged-app run, a manual refresh against a real managed login would close the gap.

Technical details
# Real token-endpoint contract is unverified

## Affected sites
- `src/main/claude-accounts/oauth-refresh.ts:223-233` — posts `application/json` with `client_id` + `scope`; every test stubs `net.fetch`.
- `src/main/claude-accounts/runtime-auth/runtime-auth-managed-credentials.ts:66` — the same function refreshes the active managed account at launch.

## Required outcome
- Confidence that the JSON body and scope list are accepted by the live `https://platform.claude.com/v1/oauth/token` endpoint for managed logins.

## Open questions for the human
- Was the new body checked against a real account (not only the disassembled CLI), and does the active launch path still refresh?

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

@innocarpe
innocarpe force-pushed the mac-per-account-usage branch from 3d27958 to dcab0ee Compare October 1, 2026 12:56
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (dcab0ee93f)

A subscription login whose stored scopes do not include user:inference now retries with those stored scopes when the expanded list is rejected. A third-party client with no stored scopes omits scope instead of sending the first-party list.

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

✅ No new issues found.

Reviewed changes

  • Third-party clients with no stored scopes now omit scope — scopes is string[] | null; a stored client id with an empty scope list sends no scope, so the server keeps that client's existing grant instead of being handed the first-party CLAUDE_CODE_REFRESH_SCOPES.
  • The invalid_scope retry is no longer gated on user:inference — storedScopeFallback now fires for any expanding first-party login with non-empty stored scopes that differ from the expanded list, so a subscription login whose blob only carries user:profile retries with that stored list.
  • postClaudeRefreshGrant only emits scope when non-empty — null/empty scope is dropped from the JSON body.
  • Tests cover both: omitting scope for a third-party client with none, and the subscription-login retry. Both fail against the prior logic, so they are real coverage.

The two scope-selection gaps raised in the previous review (oauth-refresh.ts:176-186) are addressed by this commit, and that thread is already resolved.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@innocarpe
innocarpe force-pushed the mac-per-account-usage branch from dcab0ee to 2fa79a3 Compare October 1, 2026 13:39
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (2fa79a3c1e)

A saved Claude account whose managed credentials were removed reports exactly "No credentials" and no failure kind. That row is a missing sign-in, so the roster offers sign-in instead of "Refresh failed".

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

ℹ️ No critical issues — one maintainability note inline.

Reviewed changes

  • A bare No credentials inactive Claude preview now renders as signed out — isConfirmedSignedOut treats an exact No credentials error carrying no usageMetadata as a missing sign-in, so the saved-account row shows not signed in instead of a generic refresh-failure line. Covered by new assertions in usage-roster-row-state.test.ts for both getUsageRosterRowState and previewInactiveAccountUsage, which fail against the pre-commit logic.

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

@innocarpe
innocarpe force-pushed the mac-per-account-usage branch from 2fa79a3 to 3ff08d9 Compare October 1, 2026 22:10

@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

The account-selection path can keep a stale access token when an inactive preview refreshed it without the server issuing a new refresh token — a response applyRefreshedToken explicitly supports. The fix is a one-condition change; details inline.

Reviewed changes

  • Introduced a shared credential-rotation queue — a module-global promise chain (managed-credential-rotation.ts) now serializes the inactive-preview refresh with account selection, so the two callers cannot rotate the same single-use Claude token concurrently.
  • Both paths re-read the managed blob inside the queue — persistRefreshedInactiveCredentials and refreshManagedAccountTokenIfNeeded re-read the latest credentials and materialize/keep that blob instead of refreshing the snapshot captured earlier, using the refresh token to detect a rotation by the other caller.
  • Structured the missing-credentials signal — noClaudeManagedCredentialsResult() now emits usageMetadata.failureKind: 'missing-credentials', and isConfirmedSignedOut drops its exact-string 'No credentials' match in favor of that field.
  • Added coverage — a new serialization test, a launch-refresh test for a refresh token another caller already rotated, and a fetcher test for a rotated token during a stale 401.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes

Delta since Pullfrog's prior review (3ff08d95c8 → 64fdf7134b), which follows up on the earlier selection-path finding.

  • Rotation queue is now per-account — withClaudeManagedCredentialRotation(accountId, …) keeps one in-flight rotation per saved login in a Map, so a slow refresh for one account no longer head-of-line blocks another (the prior global chain's documented risk).
  • New storedOauthCredentialDiffers detects an access or refresh token change — replaces the refresh-token-only comparison in both the selection path and the inactive preview; token-based, so it ignores blob formatting differences.
  • Selection materializes a refreshed access token whose refresh token did not rotate — refreshManagedAccountTokenIfNeeded now returns the re-read blob when only the access token changed, resolving the prior [!IMPORTANT] finding (applyRefreshedToken supports a response with no refresh_token).
  • readAccessToken helper added and shared by the comparator; tests cover the new queue signature, per-account independence, and the access-token-only interleaving (launch-refresh and stale-401 fetcher cases).

The prior runtime-auth-managed-credentials.ts:80 thread is already resolved; no open Pullfrog threads remain. All four touched suites pass locally (44 tests).

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Oct 29, 2026

Copy link
Copy Markdown

Greptile encountered an error while reviewing this PR. Please reach out to [email protected] for assistance and include this reference: 06c6579e-9d77-49bc-9643-5e0ef085b77a.

@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: 931497a8-5982-4373-bb41-86a934ceb256
Commits

Reviewing files that changed from the base of the PR and between 64fdf71 and dfa0817.

Files selected for processing: 6
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service/service-inactive-accounts.ts
  • src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/usage-roster-row-state.test.ts
  • src/renderer/src/components/status-bar/usage-roster-row-state.ts

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

const cached = this.inactiveClaudeCache.get(account.id) ?? null
this.inactiveClaudeCache.set(
account.id,
this.applyStalePolicy(inactiveAccountPreviewFailure('claude', error), cached)

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

Supported by static analysis

Script executed:

git diff 7f2d223211cb53f958b182a473b97e7868ac9fac dfa081714f224f3114cc8260598be93a4f2324d1 -- src/main/rate-limits/service/service-inactive-accounts.ts
sed -n '1,240p' src/main/rate-limits/service/service-result-policy.ts
rg -n 'stale|previewAccountRowUsage|InlineUsage' src/renderer/src/components/status-bar/{usage-roster-row-state.ts,ClaudeSwitcherMenu.tsx,CodexSwitcherMenu.tsx}

Repository: stablyai/orca

Length of output: 11420


Script executed:

set -o pipefail
printf '%s\n' '--- row-state ---'
nl -ba src/renderer/src/components/status-bar/usage-roster-row-state.ts | sed -n '1,230p'
printf '%s\n' '--- inline usage definitions ---'
rg -n -F --glob '*.tsx' -e 'function InlineUsageBars' -e 'const InlineUsageBars' -e 'export function InlineUsageBars' -e 'InlineUsageBars' src/renderer/src/components/status-bar
printf '%s\n' '--- switcher row blocks ---'
nl -ba src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx | sed -n '300,410p'
nl -ba src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx | sed -n '185,300p'
printf '%s\n' '--- stale policy references/tests ---'
rg -n -F --glob '*.{ts,tsx}' -e 'applyStalePolicy' -e 'stale' -e 'lastSuccessfulSource' src/main/rate-limits src/renderer/src/components/status-bar | head -240

Repository: stablyai/orca

Length of output: 41301


Script executed:

set -o pipefail
nl -ba src/renderer/src/components/status-bar/InlineProviderUsage.tsx | sed -n '1,220p'
printf '%s\n' '--- relevant inline usage tests ---'
nl -ba src/renderer/src/components/status-bar/inline-usage-bars.test.tsx | sed -n '50,210p'
printf '%s\n' '--- codex row remainder ---'
nl -ba src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx | sed -n '247,290p'

Repository: stablyai/orca

Length of output: 16532


Show when retained usage is stale.

A thrown read can retain recent windows with status: 'error'. The row-state helper treats any retained window as kind: 'usage', and InlineUsageBars renders only the percentages and reset labels. It does not show the error or the age of the data.

Preserve the stale-window retention policy, but mark retained windows as stale or display the associated error in the switcher row. Removing the windows would conflict with the policy that preserves recent usage during transient failures.

A failed OAuth read for an inactive Claude account threw out of the batch, so the switcher kept no row. Return a classified result, retry a batch that stored nothing, and offer Codex sign-in only when the probe says that login is dead.
The active row only said Active, so the session, weekly, and Fable windows
already on the header never appeared on the login you would switch away
from. System default gets those windows only while it is the selected
login, matching the mobile accounts screen.

Inactive Claude logins also stayed blank when the access token was
rejected. Refresh posted a form body without scopes, which Claude Code
2.1.286 no longer sends, and a 401 before expiresAt never tried refresh.
The grant is now the CLI's JSON body, with one stored-scope retry on
invalid_scope. A stale-token usage read refreshes once and reads again,
so a still-valid refresh token becomes windows instead of an empty row.
A dead login is not given a made-up percent.
A saved Claude account whose managed credentials were removed reports that exact error and no failure kind. The roster was calling it a refresh failure, so the row offered no sign-in.
@innocarpe
innocarpe force-pushed the mac-per-account-usage branch from dfa0817 to fd0299b Compare November 2, 2026 10:21

This branch has not been deployed

No deployments
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.

1 participant