Skip to content

Multi-account 1/4: verified account identity, cards, and naming - #1147

Closed
robinebers wants to merge 24 commits into
mainfrom
codex/account-01-claude-foundations
Closed

Multi-account 1/4: verified account identity, cards, and naming#1147
robinebers wants to merge 24 commits into
mainfrom
codex/account-01-claude-foundations

Conversation

@robinebers

@robinebers robinebers commented Aug 24, 2026

Copy link
Copy Markdown
Owner

TL;DR

Discover multiple Claude CLI accounts and give each account a stable, isolated card.

What was happening

  • Different Claude CLI configuration directories were collapsed into one account.
  • Switching the default CLI login could accidentally replace another account's existing card.

What this changes

  • Discover Claude accounts across supported CLI configuration directories.
  • Assign stable account ownership and keep logs and credentials isolated per account.
  • Preserve existing provider ordering and current main-branch behavior.

Tests

  • Full Swift test suite: 1,206 tests passed, three skipped.
  • Includes focused coverage for account discovery, login switching, card ownership, and scoped credentials.

Screenshots

Multiple Claude account cards


Note

High Risk
Touches Claude OAuth/credential selection, keychain scoping, and per-card identity verification—security-sensitive paths where mis-routing could show the wrong account’s usage.

Overview
Adds multi-account Claude support: launch-time discovery of extra CLI logins in custom config dirs, each mapped to its own provider card (claude@…) with scoped credentials, usage logs, and identity checks so one account cannot borrow another’s Desktop login, env token, or spend history.

Introduces an observable account registry (ProviderAccountsStore v2) with derived titles, user renames (customLabel), and live display-name resolution across the dashboard, menu bar, notifications, share cards, local HTTP API, and CLI—cached snapshots keep baked derived names; human-facing output re-resolves at read time.

Layout and ordering adapt for account cards: default metrics seed per extra card, absent cards persist as tombstones until the login returns, and new account ids slot next to their family on the dashboard. Telemetry normalizes account card ids back to provider families. CI also runs on codex/account-* branches.

Reviewed by Cursor Bugbot for commit 3932758. Bugbot is set up for automated code reviews on this repo. Configure here.

robinebers and others added 3 commits August 24, 2026 15:35
- ClaudeConfigDirDiscovery: bounded dot-dir/.config scan; identity-extraction-is-validation, credential shape (file or attributes-only keychain probe), token-free support trail
- ProviderAccountAssembly: folds same-account dirs onto the default card as extra log roots, mints records+cards for distinct accounts; bare family id now reserved for default-home holders
- ClaudeAuthStore: .configDir scope (own keychain item + credentials file only; no Desktop/env fallback); default card drops unpinned Desktop fallback while extra cards exist
- ClaudeProvider/ProviderCatalog: injectable Provider identity, per-card descriptor ids, scoped scanner roots with partitioned parse cache
- Layout: account cards seed their family's default metric set (translatedForAccountCards); unknown saved layout state is retained as invisible tombstones so an absent card's customization returns with it

Co-authored-by: Cursor <cursoragent@cursor.com>
…seeding/tombstones

Co-authored-by: Cursor <cursoragent@cursor.com>
@robinebers robinebers added the gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) label Aug 24, 2026 — with Cursor
@robinebers robinebers changed the title Claude accounts 1/6: stable CLI account discovery and isolation Claude accounts 1: stable CLI account discovery and isolation Aug 24, 2026
@robinebers
robinebers marked this pull request as ready for review August 24, 2026 12:29
Comment thread Sources/OpenUsage/Services/ProviderAccountAssembly.swift Outdated
Comment thread Sources/OpenUsage/Services/ProviderAccountAssembly.swift Outdated
robinebers and others added 5 commits August 24, 2026 16:56
…he account registry

The account registry (ProviderAccountsStore) is now @observable and shared
between the launch pass and the UI, so a rename (customLabel) re-titles the
card everywhere without a relaunch. "Rename…" lives in the card's right-click
menu (alert with a text field; empty clears back to the derived name) and as a
Name field at the top of the card's Customize detail. Share cards render
outside the environment, so the live name is passed in explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Renames never bake into the launch Provider anymore — Provider.displayName only
ever carries the derived default, and everything human-facing resolves the live
name through the account registry at render time: Total Spend slices carry a
caller-resolved title (legend + share export), menu bar VoiceOver text,
notification titles, and the CLI/HTTP API resolve at their boundaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread Sources/OpenUsage/Providers/Claude/ClaudeAuthStore.swift Outdated
Comment thread Sources/OpenUsage/Providers/Claude/ClaudeProvider.swift
@github-actions github-actions Bot added the docs label Aug 24, 2026
@robinebers
robinebers marked this pull request as draft August 24, 2026 13:26
@robinebers robinebers changed the title Claude accounts 1: stable CLI account discovery and isolation Multi-account 1/4: verified account identity, cards, and naming Aug 24, 2026
@robinebers
robinebers marked this pull request as ready for review August 24, 2026 13:57
Comment thread Sources/OpenUsage/Services/ProviderAccountAssembly.swift
@robinebers
robinebers marked this pull request as draft August 24, 2026 17:10
@github-actions github-actions Bot added the ci label Aug 24, 2026
@robinebers
robinebers marked this pull request as ready for review August 24, 2026 18:33
Comment thread Sources/OpenUsage/Services/ProviderAccountAssembly.swift Outdated
Comment thread Sources/OpenUsage/Providers/Claude/ClaudeConfigDirDiscovery.swift Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bcbd0c9. Configure here.

Comment thread Sources/OpenUsage/Providers/ProviderCatalog.swift Outdated
@robinebers

Copy link
Copy Markdown
Owner Author

Closing in favor of a single, minimal Claude organization-based replacement.

@robinebers robinebers closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci docs gate-passed Passed the automated PR gatekeeper checks (gatekeeper skips it on later runs) provider tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant