Repository navigation
feat(claude): select optional cswap accounts for local sessions - #217
Merged
Merged
Conversation
…ide the model menu (#229)
Owner report: with cswap installed, a per-user web login still got
"No cswap accounts are assigned to this identity". Only the admin token
resolves to Operator; every personal-link login is a Tenant that needs an
explicit `cswap_account_grants` entry, and nothing could write one (a
tenant cannot even discover the ids first), so the feature was dead for
all personal logins and the picker blamed cswap for it.
- Admin-only GET/PUT /api/v1/users/{id}/cswap-accounts (inside the
existing admin `/users*` family). Grants accept only the 64-hex stable
account id, never a slot, alias or `*`; deleting a user drops its grant.
- Settings → Admin → Users gains a per-user Claude account editor that
also lists grants cswap no longer reports so they can be revoked.
- Discovery returns `reason: "not_granted"` and the picker says who can
grant access instead of "cswap unavailable".
- The account picker leaves the model menu and becomes its own composer
button + drop-up beside it. On phones the row already overflowed at
390px (send at 428px); HITL/account go icon-only, effort hides and the
model label ellipsizes so mic + send stay on screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner decision 2026-11-06: per-account grants are dropped. The default
login is already the box owner's subscription and every identity that can
start a Claude session spends it, so a grant gated nothing the default
path did not already expose.
Removes config.yaml cswap_account_grants, identity::can_use_cswap_account,
the gateway CswapAccountDenied / cswap_account_access / authorize_cswap_account
checks, the admin GET/PUT /api/v1/users/{id}/cswap-accounts routes, the
Settings grant editor and the not_granted discovery reason. Keeps the
local-Claude-stream-json-only guard, the web-token gate, label redaction,
the discovery cache and isolated-profile drift refusal.
Refs: docs-local/issues/#229
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Local Claude sessions can select an authorized account from a preinstalled cswap in the new-session model menu's advanced options. Default login and other vendors work without cswap. Selecting the current default account allows cswap's native fallback; isolated accounts retain their identity and profile across resumes, role switches and delegated children. Explicit grants are checked independently of project access.
The launcher wraps the existing stream-json argv with
cswap run, using pipes and a child-local exec relay. The relay preserves binary overrides, keeps auth probes off SDK stdin, verifies the effective profile, and selects fresh/resume in that profile. cswap and Claude retain credential/refresh ownership. Public DTOs expose no profile paths or raw email. Account discovery rejects cswap's optional model-based quota probe. Remote, terminal and non-Claude selection are unsupported.Maps to local issue
docs-local/issues/#229. Based on dev and targets dev. No version bump or deployment.Validation:
make check,make test, real-PTYmake test-web, fmt and diff checks passed.make web-check: 871 tests passed; DSH pluginnpm test: 287 passed.make perf-gatepassed without changing thresholds: session-list p95 41.51ms, status p95 31.32ms, gateway lock hold p99 0.196ms.