Skip to content

fix(status-bar): show a paired server's usage on its Claude and Codex account rows - #43952

Merged
AmoabaKelvin merged 3 commits into
mainfrom
fix/usage-account-rows-owner
Nov 18, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
fix/usage-account-rows-owner

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

When your workspace lives on a paired Orca server, the Claude account list in the status bar now shows each of that server's accounts with its own usage, the same as it does for a workspace on your own machine.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187 $\color{#cf222e}{\Huge{\mathbf{−}}}$​190 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3

What Changed

  • Before: focus a workspace on a paired server and open Usage → Claude. The top card shows the server's usage, but every account row below it is blank, including the active one.
  • After: each row shows that server account's usage (active and inactive), and the header names the server's active account.

Mechanism: the status bar already watches one owner, the host that owns the focused workspace's accounts (useOwnerUsageRateLimits), and every meter reads from it. The Claude and Codex switchers did not:

  • each resolved its own owner with a different fallback (the Active Server setting, while the bar's numbers fall back to this device);
  • the Claude rows read the viewer's own store (inactiveClaudeAccounts, claudeTarget) and fetched the roster separately from the readings.

Now the owner observation also returns the AccountOwner it resolved. Both switchers take their owner, roster, per-account readings and usage target from it through one projection, getOwnerAccountRows. This replaces the Codex-only projection from #41540. For a local owner, the observation's rateLimits is the store object itself, so local workspaces read exactly what they did before.

Following from the same owner:

  • The Settings links in both switchers open on the rows' owner, not the Active Server.
  • For a remote owner, the Claude runtime toggle is hidden, as Codex already does. It refreshed this desktop's usage, not the server's.
  • On a paired server, the System default row in a WSL group is disabled. accounts.selectClaude carries no runtime, so clearing that slot would clear the server's host slot instead.

The native-chat usage-limit Claude menu keeps its own owner (the chat's host) and is unchanged.

Why

The server already publishes per-account usage in its accounts.subscribe snapshot (#29430). The rows just never read it. Patching Claude the way #41540 patched Codex would have left two per-provider copies of the same owner logic, and the owner mismatch with no focused workspace in place. Reading every row from the one owner observation fixes both providers at the layer that owns "whose usage is this".

I checked the other meters (Gemini, Grok, Muse, Kimi, MiniMax, Cursor, ZCode, OpenCode Go, and the Antigravity account rows). They already read the owner snapshot. Only the Claude and Codex rows read the viewer.

Linked Issue

Fixes #40733

Visual Proof

Real headless orca serve with two seeded Claude accounts, paired to a hidden dev desktop. The host's usage endpoint was answered in-process (A at 30%, B at 75%), so no request left the machine.

Before (main): server rows are blank.

before-claude-rows.png

After: each row shows the server's reading for that account.

after-claude-rows.png

Testing

  • 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

  • Live paired repro on macOS. A throwaway Playwright spec ran a real headless serve plus a hidden paired desktop, with keychain isolation and a scratch HOME.

    • main: the rows were blank.
    • This branch: the rows showed 30% and 75%.
    • After accounts.selectClaude on the server, the rows followed: A became inactive at 30%, and B became active at 75%.
  • account-switchers.remote-usage.test.tsx (renamed from the Codex-only file) adds a Claude case. It fails on main, where it reads the viewer's 99%, and passes here. The existing Codex cases still pass.

  • pnpm check:changed passes. The focus-read baseline was pruned because both switchers stopped reading the Active Server.

Risk

The riskiest part is which host's accounts a switcher lists when no workspace is focused. That is now this device, matching the bar's numbers, where it used to be the Active Server. That is the intended fix, but it is a visible change for anyone who relied on the old fallback.

Older servers: the roster comes from the same accounts.subscribe stream the old one-shot read used. A server that publishes no per-account usage shows empty rows, as before.

Mobile is untouched. A plain revert backs this out.

Level: Medium

AI Disclosure

Review

Two review-loop rounds (Codex + Claude). Round 1 found the settings-scope and remote WSL clear issues, both fixed here. Round 2 came back clean.

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-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Renderer only, so it behaves the same on every platform.
  • SSH-managed servers and paired Orca servers go through the same owner observation.
  • WSL-host workspaces keep {local, distro} ownership.

#40896 (the active Claude row blank on a local workspace) was already fixed on main by #42466.

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)

…apshot

Both switchers now take their owner, roster and per-account readings from
the status bar's owner observation through one projection, so a workspace
on a paired server shows that server's usage on every account row.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The status-bar usage hook now provides the active account owner with its usage data. Claude and Codex switchers use owner-scoped account rosters and readings. The Claude menu accepts either a chat action or owner usage. The Codex menu requires owner usage. A paired-host Claude test checks that displayed quotas come from the host snapshot. The focus-read baseline inventory and a default-host comment were also updated.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 5eb99

The status-bar Claude and Codex switchers now show a paired server's per-account usage. No concrete merge-blocking defect remains after review, and the change is a localized, easily reverted renderer change.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the status-bar Claude and Codex account rows now show a paired server's usage. It uses the fix prefix and stays concise and specific. The changeset matches this, inclu…
Linked Issues check Passed Directly linked issue #40733 requires that Claude and Codex account rows show per-account usage, including the active account, when the focused workspace is on a paired server. The PR meets this from …
Out of Scope Changes check Passed The changes follow one objective: route both switchers through the focused workspace's owner. Supporting changes are part of that objective. These include the owner field on OwnerUsageRateLimits, the …
Description check Passed The description follows the template closely. It has an ELI5, a What Changed section with before and after, a Why section that compares against the alternative (#41540), a linked issue (Fixes #40733),…
Full details: Title check

Explanation

The title names the main change: the status-bar Claude and Codex account rows now show a paired server's usage. It uses the fix prefix and stays concise and specific. The changeset matches this, including the owner-based projection and the remote-owner Claude row behavior.

Full details: Linked Issues check

Explanation

Directly linked issue #40733 requires that Claude and Codex account rows show per-account usage, including the active account, when the focused workspace is on a paired server. The PR meets this from the change summary. The owner observation in use-owner-usage-rate-limits.ts now returns owner: AccountOwner. Both switchers take their roster, inactive-account readings, and usage target from that owner snapshot through getOwnerAccountRows in owner-account-rows.ts. The rows no longer read the viewer's store (inactiveClaudeAccounts, claudeTarget, and the Codex projection). The PR also adds a Claude case to account-switchers.remote-usage.test.tsx. It asserts host quotas (4% active, 25% inactive) and not viewer quotas (91%, 99%). The author reports that this case fails on main and passes on this branch. The issue's suggested fix also asks that the menu refresh the remote host's inactive lists on open. The summary does not show an open-time refresh for remote owners. The issue states the expected outcome as per-account usage on every row, and the summary shows that outcome is met. The open-time refresh is a suggested approach, not a stated requirement, so its absence does not fail this check. Not verified in this review: the automated test run and the live repro are author-reported. The PR checklist leaves lint, typecheck, test, and build unchecked.

Full details: Out of Scope Changes check

Explanation

The changes follow one objective: route both switchers through the focused workspace's owner. Supporting changes are part of that objective. These include the owner field on OwnerUsageRateLimits, the removal of getCodexOwnerUsageProjection, the getAccountOwnerKey helper, StatusBarSurface key derivation, and the Settings scope via hostScope and runtimeTarget. The remote-owner gating of the Claude runtime toggle, and the disabled System default row in a WSL group on a paired server, also follow from the owner change. The focus-read baseline file and the default-creation-host documentation update follow the removed Active Server dependency. The test fixture update supports the new ownerUsage prop. One point needs attention. The summary says chatInactiveClaudeAccounts now populates only for local targets, and the PR says the native-chat Claude menu is unchanged. The summary does not show whether non-local, non-environment chat targets previously read the rate-limit list. This could change native-chat behavior. The summary does not establish a concrete unrelated change, so this check does not fail. Reviewers should confirm the native-chat path against main.

Full details: Description check

Explanation

The description follows the template closely. It has an ELI5, a What Changed section with before and after, a Why section that compares against the alternative (#41540), a linked issue (Fixes #40733), Visual Proof with before and after images, Testing with a manual repro and a new test, a Risk section with level and revert guidance, and the Notes and Checklist sections. The AI Disclosure section is empty, which is acceptable for a StablyAI team member. The last checklist item (lint, typecheck, test, build) is unchecked, and the author gives a reason for this in the Testing section, which only reports that pnpm check:changed passes.

  • 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

Recent 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: e2163476-abfc-43fc-9deb-1dae2bc8164b
Commits

Reviewing files that changed from the base of the PR and between 44599fe and 5eb99e9.

Files selected for processing: 13

  • config/focus-setting-read-baseline.txt
  • src/renderer/src/components/status-bar/StatusBarSurface.tsx
  • src/renderer/src/components/status-bar/account-switchers.remote-usage.test.tsx
  • src/renderer/src/components/status-bar/accounts/ClaudeSwitcherForOwner.tsx
  • src/renderer/src/components/status-bar/accounts/ClaudeSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/accounts/CodexSwitcherMenu.fixture.tsx
  • src/renderer/src/components/status-bar/accounts/CodexSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/accounts/codex-switcher-projection.ts
  • src/renderer/src/components/status-bar/accounts/owner-account-rows.ts
  • src/renderer/src/components/status-bar/accounts/use-claude-switcher-state.ts
  • src/renderer/src/components/status-bar/accounts/use-codex-switcher-controller.ts
  • src/renderer/src/components/status-bar/usage/use-owner-usage-rate-limits.ts
  • src/renderer/src/runtime/hosts/selection/default-creation-host.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.

@AmoabaKelvin
AmoabaKelvin merged commit ca796c5 into main Nov 18, 2026
39 checks passed
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.

[Bug]: Claude and Codex account rows show no usage when the workspace is on a paired server

1 participant