Repository navigation
feat(accounts): add native accounts and guided sign-in - #919
Adam-Dalloul wants to merge 59 commits into
Conversation
Settings MCP still targets the built-in family row. Extra custom agents whose spec.env sets CLAUDE_CONFIG_DIR, CODEX_HOME, GROK_HOME, GEMINI_CONFIG_DIR, or OPENCODE_CONFIG_DIR now receive the same server on upsert and lose it on remove. Claude extra homes only get enabledPlugins; server defs stay in the shared ~/.claude.json. Auth files are never copied.
Custom agents whose spec.env sets a family isolator now have a Sign in card on the Agents page. That opens the official CLI login (claude/codex/grok/gemini/opencode) with the isolator env set. No tokens are copied. Account 1 stays on the built-in home. Headless and unit-test paths return the command instead of spawning a terminal.
Settings MCP still targets the built-in family row. Extra custom agents whose spec.env sets CLAUDE_CONFIG_DIR, CODEX_HOME, GROK_HOME, GEMINI_CONFIG_DIR, or OPENCODE_CONFIG_DIR now receive the same server on upsert and lose it on remove. Claude extra homes only get enabledPlugins; server defs stay in the shared ~/.claude.json. Auth files are never copied.
Custom agents whose spec.env sets a family isolator now have a Sign in card on the Agents page. That opens the official CLI login (claude/codex/grok/gemini/opencode) with the isolator env set. No tokens are copied. Account 1 stays on the built-in home. Headless and unit-test paths return the command instead of spawning a terminal.
4c9548b to
9ee89cc
Compare
…tches A connection whose task ends on its own (the agent failed to load or exited, or the task panicked) now parks its child in the manager's draining list, as every explicit teardown does, so a missing map entry is never taken as proof that the process stopped. The deferred cleanup is spawned on the connection's runtime handle, because the guard drops outside any runtime context. Account switches wait for every writer of the session before copying it and before rolling a target back, and a child parked after its task finished leaves the list as soon as it is reaped. A switch's staging copies are removed once the switch is committed, a rollback completes, or staging itself fails. They are kept only when a rollback fails.
Launching a named account re-applies the shared MCP servers to config files that the account's own CLIs rewrite too. The config writers now leave a file alone when its content would not change, and the config staleness check no longer syncs account folders at all. Pi accounts mirror pi's own server list instead of the empty ACP forwarding view, which removed their servers again on every launch. A missing account folder no longer fails the import scan or every MCP change; that account is skipped until its folder is restored.
…ount A conversation switched to another account keeps its session in that account's folder. Work-task retries, returns and merges, their fresh-session fallback, and chat-channel resumes now launch with the conversation's saved account instead of the Default one, which the prompt gate then refused.
|
@xintaofei, the account and usage PRs (#470, #471, #919, and #472) are refreshed on v0.36.0, with conflicts resolved and desktop/mobile checks passing locally. Could you take another look when the remaining CI checks finish? |
The account migration is now m20261017_000001_agent_account and is registered last, after the four migrations v0.36.0 shipped. A backup records only the last registered migration, and a release restores any backup whose last migration it knows. With the account migration in the middle of the list, a backup from this build named m20261016_000002_conversation_assistant, so v0.36.0 restored it and then failed to start, since it has no file for the account migration. Now v0.36.0 refuses such a backup as coming from a newer version. A database that already ran a build with the old name must have its seaql_migrations row renamed to the new one.
The locale files now differ from main only by this branch's own strings. Merging v0.36.0 had moved four of main's blocks to the end of their sections in all ten locales: MentionPanelSettings, WindowAttentionSettings, and AcpAgentSettings' kiro and distribution. No string was lost, but every locale conflicted with later changes next to those blocks, and keeping main's side of a conflict listed kiro twice.
Kiro's and ZCode's settings showed the server's English reason, "Named accounts are not yet supported for this agent.", in every locale. The accounts card now shows a translated note for any built-in agent without accounts, and keeps the OpenClaw gateway note.
|
@Adam-Dalloul thanks for refreshing the stack on v0.36.0. The conflict resolutions hold up: I went through I pushed three commits on top of 1. The account migration now runs after v0.36.0's (
|
|
Thanks @xintaofei, I've addressed the isolation and backup points and carried your fixes into #472. The updated description includes the exact validation, including two existing Claude sign-ins on Windows. |
Add named accounts to built-in agents while retaining their native identity, model controls, history, imports, @ targeting and delegation behavior. A chat keeps its selected account when reopened; missing, removed or wrong-family accounts cannot silently become Default.
Settings > Agents offers a name and supported connection method. Claude Code and Codex offer native account sign-in or an API key; other supported agents use their own setup. Existing-folder adoption preserves sign-in and history. Desktop starts official sign-in, and web provides the command to run on the host.
Native Claude account switches retain the transcript, session sidecars, file history, session task lists and legacy todos. Mutable task updates/deletions carry over, with replaced task files retained for recovery. The target must acknowledge native restoration and the requested model after its selectors finish loading. An unavailable model or custom shared task list refuses the switch. Account settings and memory remain account-specific. Explicit switching also works after a viewer reattach; implicit viewer teardown still only detaches.
Named accounts cover 14 families on Windows/Linux and 13 on macOS. Cursor uses Default on macOS. Kiro, ZCode, TRAE CLI and Command Code do not support named accounts; OpenClaw uses its gateway account. Existing-chat native account transfer is Claude-only. Cross-agent/context handoff is in #669.
Validation: server/MCP all-target Clippy with warnings denied, TypeScript, picker/hook tests, and the combined-stack account/API/MCP/browser regressions. Fixtures verify task round trips, model refusal, rollback, account-specific routing, imports, credentials isolation and preserved drafts. Provider sign-in and generation have not been exercised live for every vendor/OS. See docs/agent-accounts.md for the supported flow and backup scope.
Includes the compatibility work from #470 and #471; maintainer edits are enabled.