Skip to content

fix(status-bar): show remote Codex account usage in account rows - #41540

Merged
AmoabaKelvin merged 10 commits into
stablyai:mainfrom
gentslava:fix/remote-account-usage
Nov 17, 2026
Merged

AmoabaKelvin merged 10 commits into
stablyai:mainfrom
gentslava:fix/remote-account-usage

Conversation

@gentslava

@gentslava gentslava commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you open another Orca host from this desktop, Codex's account rows now show that host's percentages and reset times, alongside its upper quota card.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​233 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​233
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​185 $\color{#cf222e}{\Huge{\mathbf{−}}}$​52 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​133

What Changed

Pass the existing owning-host observation from the status bar into the Codex switcher. Keep the account roster and active/inactive quotas from the same accounts.subscribe snapshot, so a host account switch updates names, selection and readings together. The existing owner fence also applies to that roster; the separate one-shot remote roster load is disabled. Local account loading retains the existing hook.

The remote menu follows the quota runtime published by its host. Runtime selection remains local-only: the existing runtime-target refresh operates through the viewer's preload API, and there is no supported owner-targeted quota-runtime RPC to call. The remote menu omits that control, and its handler rejects remote runtime changes. No wire method is added. Missing remote readings never fall back to the viewer cache, unverifiable inactive readings stay hidden, and pending switch/reset UI remains keyed by owner.

Why

The upper card already followed the execution host. The row controller read the viewer's local inactive cache and runtime target, while remote mode skipped the local preview fetch and hid the active row. The existing accounts stream already carries the needed remote data; the correction consumes that observation without adding another quota probe or wire method.

Linked Issue

Fixes #41536

Visual Proof

Real component fixtures, English, with synthetic paired-host accounts. Before uses unchanged main; after uses this branch, with separate fresh headless renderers. These are presentation captures, not physical paired-device acceptance.

After — light:

Remote Codex account usage after, English light

Before and dark theme

Before — light:

Remote Codex account usage before, English light

Before — dark:

Remote Codex account usage before, English dark

After — dark:

Remote Codex account usage after, English dark

Testing

  • I manually tested these changes locally on a physical paired client; pending. Headless component inspection is recorded below.

  • Automated tests added/updated.

  • Every added regression fails without the correction and checks rendered quota attribution.

  • Final head: ae79d29f517c8c84bd48af4630b0fae88b6bf8a2, tree 648a3cc4f0f9f48be4481a2c12fb1752816e61ec. Frozen PR base: fbec96cf29dc4c93ba442a1958f5ecb4000b1f1a; source/check merge base: 61a69df3a6df9fb997672577e162e96354abf9d6. The review correction is an ordinary forward commit from 450c082f848d6880e3297107a450ebd7cb120a40.

  • All 30 check:changed checks pass against the frozen PR base, including node/web types, related tests, lint, changed-code quality, formatting, localization and source/React ratchets. The required pre-push invocation confirms the same passing content after normal commit hooks.

  • Five focused rendered-menu regressions pass, plus the three existing owning-host stream cases. The initial three cover conflicting viewer runtime/account IDs, absent host readings and unverifiable ownership; their original reverted-code control is retained. Two review regressions reproduce the old code exactly: the previous account row displays 25% instead of its own 4% after a host switch, and a host with WSL accounts exposes the viewer-backed runtime selector. Both fail at 450c082f848d6880e3297107a450ebd7cb120a40 and pass with this correction. The stream case runs the real owner hook and account-list hook; it does not mock those hooks.

  • The published English before/after PNGs retain their initial 450c082 capture source and verification. Post-review cold headless renders of both pairedHost and pairedHostWithWsl pass in light and dark themes, without console errors. The existing image gallery remains intact; no physical paired-device acceptance is implied.

  • Normal managed commit hooks run. Installed Windows-to-Mac, Linux and physical-device acceptance remain pending; no live account was switched, signed in or reset during validation.

Risk

Level: Medium. A wrong owner or runtime could label one account with another host's quota. A single owner-fenced snapshot owns both roster and readings; missing remote rows cannot fall back to the viewer cache, and unverifiable-host rows do not show old percentages. Remote runtime controls cannot invoke the viewer's refresh action. Reverting these files restores the old switcher data source.

AI Disclosure

Implemented and checked with OpenAI Codex assistance.

Review

Self-review only. macOS, Linux and Windows use the same renderer path. Paired-host account identity, readings and the published WSL usage target come from the same observation; folder and Git workspaces keep the existing owner resolver. The remote runtime selector is intentionally unavailable until there is an owner-targeted API; local runtime selection is unchanged. Existing local-only sign-in and reset capabilities remain guarded. Mobile already consumes the host account snapshot and needs no wire change. Older hosts that omit per-account readings yield empty rows rather than viewer values.

Agent skill upstream boundary

  • Not applicable; no agent skill source, tests, registry or documentation is copied or modified.

Notes

This changes quota attribution in the desktop menu. The existing Used/Remaining display preference and account-row styling are independent. Upstream Actions await maintainer approval before running.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I stated the risk and rollback
  • Before/after screenshots attached
  • Self-reviewed for correctness, security and performance
  • Cross-platform, SSH/remote and shortcut/path scope considered
  • Full lint, typecheck, test and application build pass; local selected checks pass, hosted CI awaits maintainer approval
  • One focused fix with a linked issue
  • Exact-base local checks and meaningful reverted-code regression control pass
  • English visual proof attached with explicit validation limits
  • Cross-platform, remote, WSL, mobile and folder-workspace scope considered
  • Full hosted checks pass at the final head
  • Physical paired-client acceptance completed

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

No actionable comments were generated in the recent review.

Walkthrough

The owner-usage hook now retains provider-account snapshots and returns the snapshot when it matches the current owner. The status bar passes owner usage and an owner-scoped key to the Codex switcher. The switcher uses remote account and quota data for an active remote runtime, and renders active usage from that data. The provider account list can disable loading and observation. New fixtures and tests cover paired-host quotas, account switching, unverifiable ownership, and WSL accounts.

Severity of issue fixed: Medium

Merge Risk: Moderate · up to f5ee4

When a paired host does not publish usage, the Codex account list for that host may come up empty, so the user cannot pick accounts. This should be fixed or confirmed before merge. The rest of the change preserves owner-scoped quota display and looks sound.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: remote Codex account usage now appears in the account rows of the status-bar switcher. The change set matches it: the owning-host accounts snapshot feeds the switcher…
Linked Issues check Passed [#41536] asks that the owning-host snapshot drive the upper card, active-account row, inactive-account rows, and runtime target, without viewer substitution. At head f5ee4a5, use-codex-switcher-contro…
Out of Scope Changes check Passed The changed files serve the #41536 data-source correction. use-codex-switcher-controller.ts and CodexSwitcherMenu.tsx carry the owner-scoped data path, activeUsage, and the remote runtime guard. Statu…
Description check Passed The description is thorough and follows the template. It has an ELI5, What Changed, Why, a linked issue (Fixes #41536), Visual Proof with before and after images, Testing, Risk with level and rollback…
Full details: Title check

Explanation

The title states the main change: remote Codex account usage now appears in the account rows of the status-bar switcher. The change set matches it: the owning-host accounts snapshot feeds the switcher's roster and quotas, and the remote menu omits the viewer-backed runtime control. The title is short, specific, and uses a conventional fix(scope) prefix.

Full details: Linked Issues check

Explanation

[#41536] asks that the owning-host snapshot drive the upper card, active-account row, inactive-account rows, and runtime target, without viewer substitution. At head f5ee4a5, use-codex-switcher-controller.ts derives runtimeTarget from ownerUsage.remoteOwner when present. When a remote runtime is active, activeUsage comes from ownerUsage.rateLimits.codex, inactiveCodexAccounts from the owner snapshot (emptied when usageMetadata.unverifiableOwner is set), and codexTarget from the owner snapshot with a host default. Remote account state comes from ownerUsage.accounts.codex. The local account-list load is disabled for remote owners through the enabled argument of useProviderAccountList. handleSelectRuntime returns early for an active remote runtime, so the viewer refresh action is not called. Local paths keep the viewer fallback. The incremental change since 605b6fd is small in the controller and is consistent with the prior verdict. Regression tests in CodexSwitcherMenu.remote-usage.test.tsx cover colliding viewer account IDs, absent host readings, unverifiable ownership, and WSL runtime exposure. Physical paired-host acceptance and hosted checks are non-coding or pending and are not assessed. Limit: I did not read the full incremental diff across all files; the whole-PR diff of the controller was read.

Full details: Out of Scope Changes check

Explanation

The changed files serve the #41536 data-source correction. use-codex-switcher-controller.ts and CodexSwitcherMenu.tsx carry the owner-scoped data path, activeUsage, and the remote runtime guard. StatusBarSurface.tsx, use-status-bar-controller.ts, and use-owner-usage-rate-limits.ts pass ownerUsage and ownerUsageKey so the menu and its pending state are keyed per owner. use-provider-account-list.ts adds the enabled option used by the owner fence. codex-sign-in-action.ts changes a dependency type to match the direct setAccounts value. The fixture and the remote-usage test file support the regression coverage, including the pairedHostWithWsl case. No unrelated feature or refactor was found. Limit: the full incremental diff since 605b6fd was not read hunk by hunk because the diff exceeded the inspection buffer; the scope check of that range rests on the change summary and the controller diff read.

Full details: Description check

Explanation

The description is thorough and follows the template. It has an ELI5, What Changed, Why, a linked issue (Fixes #41536), Visual Proof with before and after images, Testing, Risk with level and rollback, AI Disclosure, Review, the agent skill boundary section, Notes, and a checklist. Some items are unchecked, including manual testing on a physical paired client, full hosted CI, and physical paired-client acceptance. The author states these openly as pending, and the rest of the description is substantive, so the check 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: 3b7f1ae1-6c91-4db2-aaaa-3c5527b2caff
Commits

Reviewing files that changed from the base of the PR and between 605b6fd and f5ee4a5.

Files selected for processing: 2

  • src/renderer/src/components/status-bar/StatusBarSurface.tsx
  • src/renderer/src/components/status-bar/accounts/CodexSwitcherMenu.tsx

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

@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

  • 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: a39d2c0f-c27e-4217-a3cb-86fc3dffcb31
Commits

Reviewing files that changed from the base of the PR and between fbec96c and 450c082.

Files selected for processing: 7

  • src/renderer/src/components/status-bar/CodexSwitcherMenu.fixture.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.remote-usage.test.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/StatusBarSurface.tsx
  • src/renderer/src/components/status-bar/codex-sign-in-action.ts
  • src/renderer/src/components/status-bar/use-codex-switcher-controller.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Clear inactive Codex rows when the owner is… · use-codex-switcher-controller.ts:73-76

src/renderer/src/components/status-bar/use-codex-switcher-controller.ts:73-76
Minor · Functional Correctness · Quick win

Clear inactive Codex rows when the owner is unverifiable.

When the owner is unverifiable and the last-known snapshot has no stamped Codex slot, the menu can show cached inactive Codex rows as current. The Codex marker in use-codex-switcher-controller.ts is absent in two cases. The first is a null Codex slot. The second is a non-null Codex slot that is unconfigured and has no usage data, which the mapper returns without stamping it. The retained inactiveCodexAccounts list then passes the hook's guard.

Clear the list in the projection, next to the spread of base:

Suggested fix

   return {
     ...base,
+    inactiveCodexAccounts: [],
     ...mapProviders((key) => {
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: c6c1f7d8-190f-4c8d-9bfe-0d85a7d9bf8a
Commits

Reviewing files that changed from the base of the PR and between 450c082 and ae79d29.

Files selected for processing: 6

  • src/renderer/src/components/status-bar/CodexSwitcherMenu.fixture.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.remote-usage.test.tsx
  • src/renderer/src/components/status-bar/CodexSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/use-codex-switcher-controller.ts
  • src/renderer/src/components/status-bar/use-owner-usage-rate-limits.ts
  • src/renderer/src/components/status-bar/use-provider-account-list.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.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks for this, the owner-snapshot approach is the right fix. I pushed a few commits on top so it can land: merged current main (fixing a moved shared/constants import in the test), kept the host's account roster when a host publishes no usage (the open CodeRabbit thread), and moved the switcher's owner key into StatusBarSurface so the controller stays under the 300-line lint cap. The remote Codex reset (#40219) builds on your plumbing in a separate PR.

@AmoabaKelvin
AmoabaKelvin merged commit 39887f5 into stablyai:main Nov 17, 2026
40 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]: Codex account usage rows are blank on a paired desktop client

2 participants