You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(bots): pick the Claude account a bot's chats use - #49370
#48466 lets a bot remember which Claude account its chats should use, but there is no way to set it in the app yet. This adds a "Claude account" select to the bot's Agent and model settings, so someone with a work and a personal account can point each bot at the right one without switching the whole computer.
What Changed
Stacked on #48466. This branch is #48466's commit (f870db423c5) plus one commit on top. Until #48466 merges, the diff here includes it; the change in this PR is only the last commit.
"Use this computer's selected account" (or "Use {host}'s selected account" for a bot on a paired server). It saves an empty string, which clears account.
"System default", saved as system.
Every Claude account saved on the bot's host, saved by id and labelled the way the status-bar Claude switcher labels it.
The list comes from the bot's own host: this computer's account list, or a paired server's own snapshot through the existing useProviderAccountList subscription. No new RPC and no main-process change.
Before: the Agent and model page has only the agent picker. After: fixture screenshots (default, open on a paired server, unavailable saved account; light and dark) will be attached here shortly.
Testing
bot-claude-account-choices.test.ts: a duplicated login keeps the saved record, matching by id / email / name / system / empty, and the unknown case.
Component fixtures for the three states, rendered headlessly in both themes with pnpm fixtures:shot.
Windows only. Not yet exercised in the running Electron app, on macOS or Linux, or against a real paired server.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because the select only renders on a Claude bot's Agent and model settings page and reuses the account list subscription the status-bar switcher already keeps; nothing new runs elsewhere.
Risk
Level: Low. It only writes the account field #48466 already accepts through bots.update. The riskiest part is a paired server whose account list fails to load: the select then shows the raw saved value without calling it unavailable, and choosing "Use the host's selected account" still clears it. Mobile is unchanged: its bot agent page would need its own account subscription and drill-in page, left for a follow-up. Back out with a plain revert.
AI Disclosure
Written with Claude Code (Claude Opus 5.5). Opened as a draft until #48466 settles and the screenshots are attached.
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Bots and automations can name the account their launches run under (a saved account's id, email or
name, or system). Claude native chats honour it before the host selection, for that launch only.
A new plugin hook, agent.account.resolve, lets a plugin change the account for a launch. It has the
usual 2 s deadline and falls back to the saved account.
Refs stablyai#46994, stablyai#47020, stablyai#47954
Builds on stablyai#48466, which added the bot `account` field and makes Claude
launches honour it but left the choice without UI.
The bot's Agent and model page gains a Claude account select under the
agent picker, shown for Claude bots. It lists the accounts saved on the
bot's own host (this computer, or a paired server through its existing
account subscription) with the status-bar switcher's labels, plus
"System default" and "Use the host's selected account", which clears the
field. A saved account the host no longer has stays visible as
unavailable instead of being rewritten.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry-picks upstream draft stablyai#48466 (bot and automation
`account` field, Claude launches honour it) and adds the bot account
picker on a Claude bot's Agent and model page (upstream follow-up
stablyai#49370). The fork's dashboard launch composition moves into
withDashboardClaudeLaunch to keep the launch file under its line limit.
Co-authored-by: Siddharth Pandalai <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The change adds account references for bots and automations, and adds the agent.account.resolve plugin hook. Session launch wiring resolves the requested account and passes it into Claude launch preparation. Bot settings now provide Claude account choices, including a follow-host option. The plugin reference documents the new hook and its manifest contribution.
Merge Risk: Moderate · up to fbb7c
Choosing a specific Claude account for a bot can launch with the wrong home or an unauthenticated profile in some setups, such as a custom config directory or a legacy account that shares the System default login. Resuming a session in a custom config directory can fail. Fix these launch-routing issues before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(bots): pick the Claude account a bot's chats use" matches the main change: a Claude account selector in the bot's Agent and model settings that saves the bot's account field. It is con…
Description check
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (Refs #46994, #47020, depends on #48466), Visual Proof, Testing, Performance, Risk with level, AI Disclosu…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(bots): pick the Claude account a bot's chats use" matches the main change: a Claude account selector in the bot's Agent and model settings that saves the bot's account field. It is concise, single-sentence, and specific. The summary and objectives also describe this selector as the main change of the PR.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed, Why, Linked Issue (Refs #46994, #47020, depends on #48466), Visual Proof, Testing, Performance, Risk with level, AI Disclosure, the upstream boundary checkbox, and Notes/Checklist. It explains the stacked dependency and the before/after behavior. Gaps: the Visual Proof section has no attached before/after screenshots yet (it says they will be attached), the Linked Issue uses 'Refs' rather than 'Fixes' with a real linked issue, and the Risk level is given without a backout detail beyond a plain revert. The checklist also leaves screenshots and the pnpm build/lint items unchecked. These are non-critical or acknowledged as pending, so the description is mostly complete.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Route covered managed requests through the System default.
An explicit managed request for an account that coveredBySystemDefault reports as covered still describes that account's private profile. The covered account has no login of its own. Setup for that profile copies settings and state, but not .credentials.json or a Keychain credential, and it still reports prepared. The launch can therefore run with CLAUDE_CONFIG_DIR set to a folder that cannot authenticate. Host selection avoids this profile for the same account and uses the System default login. Apply the same rule to explicit requests.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Requested System must honor the launch-environment CLAUDE_CONFIG_DIR.
When the environment sets a per-agent CLAUDE_CONFIG_DIR, an explicit { kind: 'system' } request resolves to the router's system default. prepareClaudeLaunchAccount takes preparation.configDir, which is systemDefaultHome(), because the !requested guard skips the override-aware resolver. launchEnv(null) also omits the override. The returned recipe therefore has home set to the system default while configDir keeps the override.
With CLAUDE_CONFIG_DIR=/custom and a system default of /home/u/.claude, launchHome becomes /home/u/.claude. The resumed session's transcript is under /custom, so the resume check throws historyInOtherAccount before launch. The unrequested System path returns /custom and resumes correctly. The launch env at claude-structured-launch-resolution.ts:296 is also rewritten to /home/u/.claude, so the process does not use the override either.
Resolve a requested System home the same way the unrequested System path does. Keep the launch-environment override, and do not apply host account selection. Use that one home for the recipe, the withClaudeLaunchAccountPin requested-System branch, the env patch, and the transcript lookup. Do not call resolveStructuredClaudeAccountHomePath unchanged for this case, because it routes through the selected account.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Heavy lift
The Claude account picker cannot choose a usable duplicate login when the selected record needs sign-in.
For a Claude login that appears more than once, the host group keeps one row per identity. When the selected record needs sign-in, that row's value is the signed-out record's id, and the usable record's id is dropped. A bot saved to that record can keep a signed-out account, and this picker offers no row that selects the usable duplicate. A saved reference that still resolves must stay selected and must not be rewritten to another account.
Fix the selection so a bot can choose the usable duplicate login from this picker. Keep a saved reference that still resolves selected as written. Choose the representation for that case explicitly.
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
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.
ELI5
#48466 lets a bot remember which Claude account its chats should use, but there is no way to set it in the app yet. This adds a "Claude account" select to the bot's Agent and model settings, so someone with a work and a personal account can point each bot at the right one without switching the whole computer.
What Changed
Stacked on #48466. This branch is #48466's commit (
f870db423c5) plus one commit on top. Until #48466 merges, the diff here includes it; the change in this PR is only the last commit.accountin feat(accounts): account field on bots and automations, resolve hook #48466).account.system.useProviderAccountListsubscription. No new RPC and no main-process change.resolveClaudeAccountRef(from feat(accounts): account field on bots and automations, resolve hook #48466) now accepts any accounts withidandemail, a type-only widening, so the renderer's account summaries can use the same matching a launch uses.Why
Asked for in #46994 and #47020. #48466 says UI is out of its scope on purpose; this is that piece.
Linked Issue
Refs #46994, #47020. Depends on #48466.
Visual Proof
Before: the Agent and model page has only the agent picker. After: fixture screenshots (default, open on a paired server, unavailable saved account; light and dark) will be attached here shortly.
Testing
bot-claude-account-choices.test.ts: a duplicated login keeps the saved record, matching by id / email / name /system/ empty, and the unknown case.Component fixtures for the three states, rendered headlessly in both themes with
pnpm fixtures:shot.pnpm check:changedagainst feat(accounts): account field on bots and automations, resolve hook #48466's commit: 39 of 39 checks pass (typecheck, lint, design-system and React Doctor code-quality, localization, focused unit tests).Windows only. Not yet exercised in the running Electron app, on macOS or Linux, or against a real paired server.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
None, because the select only renders on a Claude bot's Agent and model settings page and reuses the account list subscription the status-bar switcher already keeps; nothing new runs elsewhere.
Risk
Level: Low. It only writes the
accountfield #48466 already accepts throughbots.update. The riskiest part is a paired server whose account list fails to load: the select then shows the raw saved value without calling it unavailable, and choosing "Use the host's selected account" still clears it. Mobile is unchanged: its bot agent page would need its own account subscription and drill-in page, left for a follow-up. Back out with a plain revert.AI Disclosure
Written with Claude Code (Claude Opus 5.5). Opened as a draft until #48466 settles and the screenshots are attached.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)