feat(desktop): one accounts flow for agents, on this machine and in cloud

HA
2d ago
+1603-1058

Summary

  • Settings › Agents replaces "Agent commands" (now under Personal, next to Usage). Settings › Cloud › Agents is removed; /settings/agent-accounts redirects.
  • Usage and Agents › Claude/Codex share one AgentAccounts component: add, make default, switch sign-in, remove, and Sync to cloud for an account that is only on this machine (☁ Cloud once synced).
  • New cloud workspace asks first when the chosen agent has no cloud sign-in, naming the local account it found. "Not now" still creates the workspace and is remembered per agent.

Screenshots from the dev build: https://app.superset.sh/page/agents-settings-dev-build-preview-ux71x8

Why / Context

Agent accounts lived in three places: Usage (this machine), Cloud › Agents (cloud, one per agent, no link to any local account) and Agent commands (launch settings only). People could not tell which local account cloud used, and found out cloud was not signed in only when an agent in a cloud workspace asked them to sign in.

How It Works

  • settings/components/AgentAccounts/ holds the account list, its dialogs, hooks and utils (moved from settings/usage/...). Usage renders it for Claude and Codex; the agent detail page renders it for the same agents. Read-only quota agents (Grok, Antigravity, OpenCode) keep their cards on Usage.
  • Cloud match: agent_credentials holds one sign-in per agent with an accountLabel. A local account shows ☁ Cloud when its email equals that label (isAccountInCloud). Sync to cloud opens the existing cloud sign-in dialog (subscription, API key, Custom provider / Vercel AI Gateway, Manual) and saves with that account's email as the label. A cloud sign-in saved without an email matches no account.
  • CloudAuthDialog and useAgentCredential move to routes/_authenticated/{components,hooks} because Settings and the new workspace screen both use them. useAgentCredential gains an enabled option so it does not query when cloud is off.
  • New workspace: handleSubmit checks shouldOfferCloudSignIn (cloud host, cloud agent, credentials loaded, not signed in, not declined) and opens CloudSignInPrompt. "Set up" opens CloudAuthDialog; when the credential becomes configured the create continues. Declines are stored in workspace-create-defaults (cloudSignInDeclined, bounded by the cloud agent ids).
  • Cloud support uses the existing isCloudAgentId (agents the sandbox image installs). The agent list shows a cloud icon; other agents say "Cloud workspaces don't include X yet." All cloud UI is hidden when CLOUD_WORKSPACES is off.

Manual QA Checklist

Verified in the desktop dev app (CDP) with two test Claude profiles (no real sign-in):

  • Settings menu: Agents under Personal, Cloud › Agents gone
  • Usage and Agents › Claude show the same accounts section with Add account, Make default, Sync to cloud
  • Make default from Agents: pointer file state/default-claude-config-dir updated, toast shown
  • Gemini shows "Cloud workspaces don't include Gemini yet."; Claude and Codex have the cloud icon
  • New cloud workspace with Codex (no cloud sign-in) → Create → prompt → Set up opens the Codex cloud sign-in; closing it creates nothing
  • Sync to cloud opens the Claude cloud sign-in dialog
  • Not verified: a real sync that ends with the ☁ Cloud chip (needs a real Claude/Codex sign-in)
  • Not verified: "Not now" path (would start a real cloud workspace) and create continuing after a real sign-in
  • Not verified in the UI: /settings/agent-accounts redirect (same pattern as /settings/links)

Testing

  • bunx tsc --noEmit (apps/desktop): 0 errors
  • bunx biome check on changed files
  • bun test (apps/desktop): 9115 pass before the final move; after the move, settings + new workspace + stores (267) and ChatSession (569) suites pass
  • bun run check:i18n: new strings translated in all 17 locales
  • New unit tests: isAccountInCloud, shouldOfferCloudSignIn

Known Limitations

  • Cloud still holds one sign-in per agent. Syncing a second account replaces the first. Many cloud accounts with one default needs an agent_credentials migration (follow-up).
  • Sync for Claude still uses the existing token paste (claude setup-token); reading the token automatically is a follow-up and needs a test with a real account.
  • Conflicts with #9979 (it edits AddAccountDialog.tsx, which moves here); the second to merge needs a rebase.
  • For Claude the token cannot read the profile, so the saved label is the account the user picked, not one Paradev confirmed.

Follow-ups

  • agent_credentials: many accounts per agent + is_default, so Make default sets this machine and cloud together.
  • Run claude setup-token for the user and read the token.

Summary by cubic

Unifies agent account management across local and cloud so the same accounts list works on this machine and in cloud workspaces.

  • Settings › Agents (under Personal) replaces "Agent commands"; the old Cloud › Agents section is removed and its route redirects.
  • Usage and the Claude/Codex agent pages share one AgentAccounts component, which now shows a ☁ Cloud chip when a local account is also signed in for cloud, and a "Sync to cloud" action to set that up.
  • Creating a cloud workspace with an agent that has no cloud sign-in asks first, naming the local account it found; "Not now" creates the workspace anyway and is remembered per agent.

Note: cloud still holds one sign-in per agent, so syncing a second account replaces the first. Follow-up work will allow many accounts per agent.

Summary by CodeRabbit

  • New Features
    • New cloud workspaces can prompt you to sign in to an eligible agent. You can set it up immediately or choose “Not now” and continue creating the workspace.
    • Agent settings now bring account management together, with options to add accounts, choose a default, switch sign-ins, remove accounts, and refresh usage.
    • Agent settings identify cloud-compatible agents and indicate when an agent isn’t available for cloud workspaces.
  • Updates
    • Agent account settings now open from the Agents section; the previous account-settings route redirects there.