Skip to content

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

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

Adam-Dalloul wants to merge 78 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 and imports. Each chat keeps its selected account when reopened. Missing, removed or wrong-family accounts cannot silently become Default.

Settings > Agents offers an account name and supported connection method. Claude Code and Codex offer official 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 host command. Default model configuration remains scoped to Default, including the new Codex JSON configuration override.

An idle Claude conversation can switch accounts while retaining its native transcript, session sidecars, file history, session tasks and legacy todos. The target must acknowledge restoration and the selected model. Failed loads preserve the source. Remote Control, active CLI runs, unavailable models and shared custom task lists have explicit refusal paths.

Live Claude context resets require a new chat with the desired account. The guard tracks public and observed private session IDs plus the conversation binding, including draining processes, so it cannot copy an obsolete file or race a writer after a reset. Custom sessions sharing either home must close before a native copy. Account settings and memory stay account-specific.

Named accounts cover 14 families on Windows/Linux and 13 on macOS. Cursor uses Default on macOS; Kiro, ZCode, TRAE CLI, Command Code and MiniMax Code do not support named accounts, and OpenClaw uses its gateway account. Existing-chat native transfer is Claude-only. #472 adds account-targeted mentions, saved child-account resume and quota; #669 adds portable saved-context handoff.

Includes compatibility work from #470/#471. The filter fix #1029 and recording fix #1048 are now merged upstream and included here with the maintainer's fixes for model labels, relayed-message usage and duplicate imports. The account import paths retain those protections for Default and named accounts. Native usage recovery remains a separate policy discussion in #1047; API-list estimates shipped with #503.

All previously published migration IDs remain registered. New compatibility markers prevent old release/account builds from accepting newer schema backups. This update preserves published history with fast-forward branch updates.

Validation after the usage merges: production server/MCP/CLI compilation and build, all-target Clippy, the production frontend export and 1,144 UI regressions passed. Focused backend tests cover account-scoped imports, Codex environment handling, handoff, token usage, reported counters and ACP transcript projection. Real HTTP/MCP/browser fixtures cover native task restoration, unavailable-model refusal, rollback, paged history and images, account/agent switching, drafts/titles, @ routing, retry, restart, import deduplication and reset refusal, including phone and RTL layouts. A custom-agent recording fixture also verifies concrete model labels, no duplicate import through a named account, reopening, and schema-triggered refresh. The old database and frozen usage fixtures remain intact. These use isolated synthetic data and CLI fixtures, not live sign-in/generation for every provider or OS. The only change after the browser/runtime run was a test helper argument; production code is unchanged. CI runs again on the refreshed commits.

Maintainer edits are enabled. The fixtures do not establish live provider sign-in/generation for every agent or OS.

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): 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?

@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

@xintaofei, #470/#471/#919/#472/#669 are updated for current main, with the native reset/teardown cases addressed and local end-to-end checks passing. CI is running on the new commits; usage is split into #1029 (filters), #1048 (recording), and #1047 (recovery policy).

@Adam-Dalloul

Copy link
Copy Markdown
Contributor Author

@xintaofei, #919/#472/#669 now include your merged usage fixes, with local checks passing and CI running on the refreshed commits. I also fixed a retained custom-Claude source becoming importable again after handoff, and clarified the Stop limitation in #1048.

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