Skip to content

[Bug]: Claude account switched from mobile takes effect, but the desktop keeps showing and attributing usage to the old account #17261

Closed

Description

@Tauri-EPO

Operating system

Windows

Orca version

v1.4.192

Details

Short summary

Switching the active Claude account from the paired mobile app takes effect — new sessions consume the NEW account's quota — but the desktop keeps displaying the OLD account as active, and the status-bar usage meter attributes the numbers to it. Consumption moves; attribution does not.

What happens

  1. Desktop and phone paired; two managed Claude accounts, A active.
  2. On the phone: Accounts → select account B (accounts.selectClaude RPC).
  3. The switch is real: credentials are re-materialized and the next usage fetch on the host measures account B.
  4. The desktop status bar still shows account A as the active account, with the incoming numbers painted under A's label. Account B's row reads as inactive with no data. Restarting the switcher popover does not fix it; the desktop only corrects after some unrelated action forces a settings refetch.

Why (traced in the source)

  • Both paths call the same service: the mobile RPC (src/main/runtime/rpc/methods/accounts.ts → runtime.selectClaudeAccount) and the desktop IPC (claudeAccounts:select) both land in ClaudeAccountSelection.select.
  • That selection writes the new active id with store.updateSettings({ activeClaudeManagedAccountId, ... }) — without notifyListeners. Store.updateSettings only broadcasts when notifyListeners === true (src/main/persistence/applying-settings/settings-update.ts:246), so no settings:changed ever reaches the renderer.
  • The desktop UI never notices because it normally compensates client-side: after a switch initiated in the status bar, the renderer itself calls fetchSettings() (StatusBar.tsx) and re-derives the active-account label from its own settings copy. A comment in runtime-provider-accounts-client.ts states the gap outright: "Local: one-shot reads of the desktop services (they have no push channel here; the pane refetches after each mutation)."
  • The rateLimits:update push the desktop does receive carries usage numbers and the runtime target, but no active-account id — so fresh numbers from account B arrive and are rendered under the stale label of account A. Measurement on the main process is actually correct (credentials are resolved per fetch via syncForCurrentSelection); only the desktop's attribution/labeling is stale.

Scope — the trigger is "any selection not initiated by the desktop renderer", not mobile specifically

  • CLI: orca account add selects the new account through the same no-notify writes (claude-account-registration.ts), so it should reproduce the same stale desktop label.
  • Codex: the codex account service writes activeCodexManagedAccountId with the same pattern (src/main/codex-accounts/service.ts), so a Codex switch from mobile should show the same symptom.

Suggested fix

Minimal: pass { notifyListeners: true } on the selection writes (claude-account-selection.ts, claude-account-registration.ts, and the Codex counterparts). The renderer side already merges settings:changed into the app store (settings-sidebar-ipc-bridge.ts), and the status bar's claudeAccountSyncKey is derived from those settings, so the label and the roster refetch correct themselves with no new wire surface. Main-side onSettingsChanged listeners are all keyed to specific settings keys, so the extra broadcast is low-risk.

More robust alternative: give the desktop renderer the same push the mobile client already gets (runtime.onAccountsChanged), unifying both paths on one channel.

Related, not duplicates

  • #16466 — same family of symptom (meter attributed to the wrong account) but a different mechanism: remote-runtime scope resolution of the meter's source. This report is about local selection mutations never notifying the desktop renderer.
  • #14833 — adjacent: per-account usage display gaps for inactive accounts.
  • #12098 — broad account-switching report; this issue isolates one specific mechanism with a code trace.

Activity

  1. added a commit that references this issue on Aug 31, 2026
    5063814
  2. added theissue type on Sep 19, 2026
  3. ryofukutani commented on Sep 22, 2026

    @ryofukutani

    Reproduced on macOS (Darwin 25.6), Orca 1.4.207, with a trigger that is neither the mobile app nor the desktop renderer: a local script on the same Mac calls accounts.selectClaude through the Orca runtime to rotate to another managed Claude account when the active one runs low.

    What we observed (2026-09-22, JST). Account names are replaced with letters.

    1. 23:24 — the script switched the active Claude account from E to S.
      • settings.activeClaudeManagedAccountId in profiles/local-default/orca-data.json became S.
      • ~/.claude/.credentials.json was rewritten. We confirmed the token belongs to S: the anthropic-organization-id header returned by /api/oauth/usage for that token matches S's organizationUuid in claudeManagedAccounts.
    2. 23:37 — the status-bar usage popover showed "Claude account: I" (a third account), with S's numbers. The numbers and both reset times matched /status in Claude Code exactly.
    3. Restarting Orca fixed the label. The user has seen the same symptom before.

    This matches the analysis in the issue body. The selection path writes the settings without notifyListeners, so the renderer keeps its own stale copy.

    One additional data point. The stale label was not the previously active account (E); it was I. I is the first entry of claudeManagedAccounts. We did not confirm why I was shown. A renderer copy that is several RPC-initiated switches old would explain it, since the script had switched accounts several times that day without any switch from the desktop UI. So the wrong label can point at an account that has not been active for hours, which makes the mismatch harder to spot than "one switch behind".

    — Claude (session: dev-project-ca), posting on behalf of the reporter

  4. nwparker commented on Oct 24, 2026

    @nwparker
    Contributor

    Thanks for the report! Please retest on 1.4.239+ (desktop and mobile). If the desktop still shows the old account, share: Orca desktop and mobile versions, OS, and a screenshot of the status bar before and after switching. A refresh behavior detail helps too: does it correct itself after reopening Settings or restarting Orca?

  5. nwparker commented on Oct 27, 2026

    @nwparker
    Contributor

    Thanks for the report! This is fixed on main by #26801 (8b2a5e4, re-landing #24434): ClaudeAccountSelection.saveSettings now writes with notifyListeners: true, so selections made from mobile, the CLI, or another window broadcast settings:changed and the desktop switcher/status bar update. Closing — please reopen if you still see it on the latest build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions