PR #10045 review: one accounts flow for agents

Summary

The PR merges the three places that held agent accounts into one. Settings › Agents (now under Personal) and Usage share one AgentAccounts list for Claude and Codex. Each local account gets a "Sync to cloud" button or a ☁ Cloud chip, and Settings › Cloud › Agents is removed. The new-workspace screen now asks to set up a cloud sign-in before it creates a cloud workspace with an agent that has none. Most of the 104 files are moves (CloudAuthDialog, useAgentCredential, the Usage account parts).

Verdict

Needs changes

Removing Cloud › Agents leaves no way to set up, see, or disconnect a cloud sign-in unless a local login for that agent exists on this machine. Also, "Sync to cloud" labels an API key or gateway credential with a subscription account's email, so the ☁ Cloud chip can be wrong.

Findings

ImportantThe cloud sign-in can only be reached from a local account card

apps/desktop/src/renderer/routes/_authenticated/settings/components/AgentAccounts/AgentAccounts.tsx:171-192. openCloudDialog is only called from cloudFooter(account), which only renders on an account card. With zero local logins the section shows "No Claude Code logins on this host" and has no cloud entry point. See screenshot 2: this is the real state of this cloud workspace.

Who is affected:

The old Cloud › Agents page had a per-agent Set up / status row; this PR deletes it (settings/agent-accounts/page.tsx now redirects). The chat's "open agent settings" fallback (useAgentSignIn.ts:24-31) now lands on this page too. Because "Not now" is permanent (finding 3), a user who declines once and has no local login is left with no path at all.

Fix: in AgentAccounts, when cloudEnabled, always render one agent-level "Cloud" row above the cards. It shows the stored method and label ("Subscription · a@x.dev", "API key", "Manual", "Not set up") and has a Set up / Manage button that opens CloudAuthDialog with forEmail: null. Keep the per-card chip for the email match.

Important"Sync to cloud" stamps the account email on any credential kind

AgentAccounts.tsx:100-104 and NewWorkspaceScreen.tsx:1086-1092 set accountLabel: input.accountLabel ?? forEmail for every save, including kind: "api_key" and provider: "gateway".

Concrete case:

  1. Click "Sync to cloud" on the local account a@x.dev (a Claude Max subscription).
  2. Choose API key and save an sk-ant-… key.
  3. The row is saved with accountLabel = "a@x.dev", so isAccountInCloud shows ☁ Cloud on a@x.dev.

Cloud actually bills that API key, not the subscription. The "Subscription ✓ a@x.dev" line in CloudAuthDialog only shows for subscriptions, so the two views disagree.

Fix: add forEmail only when input.kind === "subscription" && !input.provider, or make isAccountInCloud also require state.subscriptionConnected. Add a test case for each.

Minor"Not now" is remembered forever, with no way to undo it

apps/desktop/src/renderer/stores/workspace-create-defaults.ts:165 appends to cloudSignInDeclined, and nothing ever removes the entry. No UI resets it, and a later sign-in followed by a disconnect does not clear it. Together with finding 1, a decline hides the only remaining prompt for good.

Fix: remove the agent from the list when its cloud credential becomes configured (so a later disconnect prompts again), or store a timestamp and ask again after N days.

MinorA failed credential fetch is treated as "not signed in"

NewWorkspaceScreen.tsx:1014 passes credentialsLoaded: !cloudCredential.isLoading. If agentCredential.list errors (API down, auth blip), isLoading is false and data is undefined. The prompt then says "Claude is not signed in for cloud workspaces" to a user who is signed in, and "Set up" offers to replace their credential.

Fix: expose isSuccess from useAgentCredential and pass credentialsLoaded: cloudCredential.isSuccess.

NitThe settings search entry is no longer gated by the cloud flag

apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.ts:1752-1756. The item moved from agentAccounts (cloud-gated) to agents, which has no gate. Users without CLOUD_WORKSPACES now see "Accounts agents sign in with, on this machine and in cloud". Drop "and in cloud" or pick the description by flag.

NitA doc still lists the removed route as a page

docs/desktop-error-cdp-verification.md:109 lists /settings/agent-accounts as a route that renders. It is now a redirect to /settings/agents.

Checked with no problems found: the persisted store gets a new field inside an already-registered key (v2-workspace-create-defaults), bounded by the 3 cloud agent ids, and the default shallow merge fills it for old profiles. No tRPC procedure changed; agentCredential.set already accepted accountLabel. The moves keep co-location, and imports were updated. The new strings have catalog entries in all 17 locales.

Evidence

Desktop dev app from this branch (c7b4e7a1), renderer at localhost:3005 and CDP on port 9333, against the workspace's local API (localhost:3001), signed in as Local Admin (dev). The CLOUD_WORKSPACES flag is on. Navigation used real clicks over CDP.

Settings nav
1. The Settings nav after sign-in. Agents is under Personal, next to Usage, and the Cloud group holds only Environments (Cloud › Agents is gone). Captured right after opening Settings from the org menu.
Agents › Claude with no local login
2. Agents › Claude on a machine with no local Claude login. The Accounts section says "No Claude Code logins on this host", and nothing on the page can set up or show the cloud sign-in (finding 1). Claude and Codex have the cloud icon in the list.
Agents › Gemini
3. Agents › Gemini shows "Cloud workspaces don't include Gemini yet." as described.
Usage page
4. Usage renders the shared AgentAccounts section for Claude Code and Codex, each with Add account. There are no local logins, so no cards and no Sync to cloud buttons.
New workspace with Cloud device
5. The new-workspace screen with Device set to Cloud. The project pickers had not finished loading when the app was killed (see below).

Not verified

Questions for the author

Test / CI notes