Skip to content

feat(accounts): add native accounts and guided sign-in - #919

Open
Adam-Dalloul wants to merge 69 commits into
spacering-net:mainfrom
Adam-Dalloul:native-built-in-agent-accounts
Open

Adam-Dalloul wants to merge 69 commits into
spacering-net:mainfrom
Adam-Dalloul:native-built-in-agent-accounts

Conversation

@Adam-Dalloul

@Adam-Dalloul Adam-Dalloul commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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.

Updated against v0.40.0 while preserving the previous published heads. Account-aware connection reuse retains the existing owner, and active CLI runs must finish before switching. Fresh codeg-cli runs continue to use Default. Native account-targeted mentions and saved-child-account resume are included in the combined #472 branch.

Includes #1029: the Token Usage dropdown includes configured and historical custom agents, reported ACP usage is recorded, and recoverable isolated-Claude usage survives session continuations. Estimates remain based on public API-list rates.

Migration IDs from the previous published heads stay registered in chronological order. A terminal compatibility marker keeps account-schema backups distinct from v0.40, and #669 adds a later marker for handoff backups. Existing PR databases retain their applied migration history.

Validation for the v0.40 refresh: all-target server/MCP/CLI Clippy, TypeScript, production UI export and 837 combined UI regressions passed. Native migration and backup suites passed, including upgrades from both earlier PR schemas without renamed migration IDs. Token usage, recorded ACP usage, transcript and ZCode regressions passed. The standalone usage fix also passes the ordinary production server/MCP/CLI check without test-only features. An isolated server upgrade preserved the previous database, account bindings, commands, migration ledger and saved context files. Combined-branch HTTP/MCP and browser fixtures passed native task restoration, unavailable-model refusal, rollback, paged full-history and image handoff, named-account selection, draft/title preservation, fresh @ targeting, retry, restart and import deduplication. Desktop, 390/320px phone and Arabic RTL layouts were checked. A continued custom-Claude history retained its native token totals through handoff without adding overlapping ACP counters. These fixtures do not establish live provider sign-in/generation for every agent or OS. The platform CI matrix runs on this published head.

Includes the compatibility work from #470 and #471; maintainer edits are enabled.

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.
@Adam-Dalloul
Adam-Dalloul marked this pull request as ready for review October 11, 2026 04:40
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.
@Adam-Dalloul
Adam-Dalloul force-pushed the native-built-in-agent-accounts branch from 4c9548b to 9ee89cc Compare October 11, 2026 05:23
@Adam-Dalloul Adam-Dalloul changed the title feat(accounts): keep extra accounts on built-in agent types feat(accounts): add native accounts and in-place Claude account switching Oct 11, 2026
Adam-Dalloul and others added 4 commits October 11, 2026 08:35
…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.
@Adam-Dalloul Adam-Dalloul changed the title feat(accounts): add native accounts and in-place Claude account switching feat(accounts): native accounts with guided setup and in-place Claude switching Oct 17, 2026
@Adam-Dalloul Adam-Dalloul changed the title feat(accounts): native accounts with guided setup and in-place Claude switching feat(accounts): add native accounts and guided sign-in Oct 17, 2026
@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

@xintaofei, could we prioritize landing the account and usage work for an upcoming release? #470 and #471 are green and mergeable. The latest published heads of #919, #472 and #669 also passed all CI checks; I am refreshing their conflicts with v0.39 now.

The requested flows are account setup and in-chat switching (#919), account-specific remaining usage (#472), and continuing the same chat across agents/accounts (#669). Is there anything else blocking review or a preferred merge order? I would like to get these into the official app and avoid carrying the stack through another release.

@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

@xintaofei, the account/quota/handoff stack (#919, #472, #669) is refreshed onto v0.40, and #1029 fixes the missing custom agents in Token Usage. Could you review these for an upcoming release while the remaining platform checks finish?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants