Repository navigation
feat(mobile): account switcher and rate-limit usage on mobile - #1467
Merged
Merged
Conversation
Bridge desktop ClaudeAccountService/CodexAccountService/RateLimitService through new accounts.* RPC methods so the mobile companion can view live rate-limit usage and switch active Claude/Codex accounts per host. - Backend: new ACCOUNT_METHODS RPC manifest (list/select/remove/subscribe); RateLimitService.onStateChange() listener and OrcaRuntimeService account bridge with refreshAccountsForMobile() to repopulate inactive-account usage on first mobile open - Multi-socket fix: ws-transport passes (clientId, ws, hasOtherConnections) to onConnectionClose; runtime uses exact ws->channel match and skips per-client teardown when other sockets share the same deviceToken, so closing one mobile screen no longer destroys the channel another screen is using - Mobile: per-host accounts screen at /h/[hostId]/accounts with Claude + Codex sections, % remaining 5h/7d usage bars (matching desktop StatusBar semantics), tap-to-switch, streaming subscribe + pull-to-refresh - Home: new 'Active accounts' section after Resume showing one card per connected host with at least one account, with the same usage bars - Shared AccountUsage module and real Claude / OpenAI SVG icons extracted to AgentIcons Co-authored-by: Orca <[email protected]>
…pshot Addresses code-review findings and home-screen UX feedback on top of the initial mobile account-switcher PR. Subscription correctness (server) - Eliminate Date.now() subscriptionId collision in accounts.subscribe and notifications.subscribe by replacing with a per-process counter scoped to a stable per-WebSocket connectionId. Two near-simultaneous subscribes from different mobile screens can no longer evict each other through registerSubscriptionCleanup's existing-key path. - Plumb connectionId through RpcContext + RpcDispatcher.dispatchStreaming so every streaming handler can scope its cleanup by socket. - Track subscriptionsByConnection on OrcaRuntimeService and add cleanupSubscriptionsForConnection(); the WebSocket transport's on-close hook now sweeps every subscription registered for the closing socket regardless of hasOtherConnections, so listeners no longer leak across reconnects (RateLimitService.stateListeners, notificationListeners). Home screen - Add 'Account usage' section (renamed from 'Active accounts') after Resume showing one card per host with at least one Claude/Codex managed account, using shared UsageBar. - Drop redundant 'Claude'/'Codex' label rows since the icon already identifies the provider; promote the email to the primary line. - Compact Quick Actions to a horizontal icon+label row to save vertical space. - Persist worktreeInfo + accountsByHost to AsyncStorage in a debounced home-snapshot cache; cold-start hydrates immediately so Resume and Account-usage cards no longer flash empty for ~1s while the WS reconnects. - Render Resume + Account-usage memos from cached data regardless of current connection state (previous gating on hostStates === 'connected' caused the cards to vanish during reconnects). - Don't clobber worktreeInfo[hostId] with a zeroed record on transient worktree.ps failures; only seed an empty record when no prior entry exists. Fixes the host card briefly flipping to '0 worktrees' and the Resume card disappearing during reconnects. Co-authored-by: Orca <[email protected]>
7 of 9 tasks
9 tasks done
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…ai#1467) Co-authored-by: Orca <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1438.
Bridges the desktop's
ClaudeAccountService/CodexAccountService/RateLimitServicethrough newaccounts.*RPC methods on the mobile WebSocket transport so the companion app can view live rate-limit usage and switch active Claude/Codex accounts per host. Interactive add / re-auth stays desktop-only since they require browser-based PTY login.Backend
ACCOUNT_METHODSRPC manifest exposingaccounts.list / selectClaude / selectCodex / removeClaude / removeCodex / subscribe / unsubscribe.OrcaRuntimeServicegainssetAccountServices(),getAccountsSnapshot(),select*Account(),remove*Account(),onAccountsChanged(), andrefreshAccountsForMobile()(the last one drivesrateLimits.refresh()+fetchInactive*AccountsOnOpen()so usage data is populated when a mobile screen first connects).RateLimitServicegains anonStateChange()listener API used to fan out live snapshots to subscribed mobile clients.Multi-socket reconnect fix
Two parallel sockets from the same device (e.g. host page + accounts page) used to clobber each other:
OrcaRuntimeRpcServer.onConnectionCloselooked up the E2EE channel by deviceToken and the first match won, so closing one screen could destroy the channel the other screen was still using and the device would get stuck reconnecting. Fixed by:WebSocketTransport.onConnectionClosenow passes(clientId, ws, hasOtherConnections).e2eeChannels.get(ws)and skipsruntime.onClientDisconnected()when other sockets exist for the same deviceToken.Mobile
/h/[hostId]/accountswith Claude + Codex sections, system-default rows, tap-to-switch, streamingaccounts.subscribe+ pull-to-refresh.AgentIconsmodule.Home redesign
New Active accounts section between Resume and Quick Actions on the home page. Shows one card per connected host that has at least one account configured, with the active Claude/Codex emails and live 5h / 7d bars. Tap routes to the per-host accounts screen.
Verification
pnpm exec tsc --noEmit(mobile) — cleanpnpm lint(mobile) — cleanpnpm typecheck(root) — cleanMade with Orca 🐋