Repository navigation
feat(handoff): continue chats across agents and named accounts - #669
Open
Adam-Dalloul wants to merge 112 commits into
Open
Adam-Dalloul wants to merge 112 commits into
Adam-Dalloul wants to merge 112 commits into
Conversation
Adam-Dalloul
force-pushed
the
feat/agent-handoff
branch
2 times, most recently
from
September 6, 2026 22:07
622245a to
194e574
Compare
A conversation can now change agents without starting over. Two paths, decided per pair of agents: Native (Claude to Claude, including an isolated custom Claude slot): the session transcript is copied into the target's config dir and the target session/loads it under the same id, so nothing is summarized. The load is verified before the row moves; a target that opens a fresh session instead is disconnected and the copy removed. Summary (any other pair): the target starts a new session seeded with a briefing built from the conversation (a digest of earlier turns, the last turns in full, the user's note), bounded and reported as truncated when earlier turns had to be dropped. Either way the conversation row keeps its id: rebind_for_handoff moves it to the new agent and session, and a conversation_handoff record keeps the earlier segment reachable. The detail read splices each earlier segment in front of the current session behind a divider tagged _meta["codeg.handoff"], placed by user-turn count for a carried session.
One action from three places: the conversation header menu, the sidebar card's context menu, and the composer's agent control of a persisted conversation. The dialog reuses the agent selector, takes an optional note for the next agent, and states which path the backend will take before the user confirms (native load, briefing, or why it cannot run). On success the open tab is swapped onto the new agent so the same conversation reopens under it; a failure leaves the tab where it was. The seam renders like the compaction divider: a chrome-less rule naming both agents, whether the context moved natively or as a briefing, the note, and the briefing folded behind a toggle. The seeded briefing never shows as a user bubble, live or reloaded.
Adam-Dalloul
force-pushed
the
feat/agent-handoff
branch
from
September 7, 2026 15:29
194e574 to
400571d
Compare
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.
…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.
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continue an existing chat with another agent or account while keeping its tab, draft, title, pin, tags and visible history. The account picker, composer and conversation menus share the same explicit handoff dialog. Add/manage account setup is reachable from the chat, with supported native sign-in/API-key methods.
Claude-to-Claude uses verified native resume and the shared account-transfer safeguards: source writers stop, complete session files and session-local tasks move, the requested model is verified after initialization, and a failed load/commit preserves the source. Other local agents start a new session with the complete saved Codeg conversation available as context, including tool records and embedded images. Long histories are paged through a read-only MCP tool scoped to that conversation; agents that do not accept wire MCP use the local transcript. OpenClaw gateway handoff is not supported. A different provider's private native state and context window are not transferred.
The account binding and immutable history segment are committed together. Context survives host/container restarts and backups; a failed first prompt retains it for retry. Historical @mentions are kept out of new routing frames, while fresh explicit mentions retain their selected native account. Old session copies are recognized as already imported, but independent later work remains importable. The original title is retained, and per-session token totals/model fallbacks survive handoff without double-counting.
This refresh preserves the prior PR head and current main, and includes #919 plus the combined #472 account/quota stack. The old clipped briefing generator and unsafe duplicate native-copy path were removed.
Updated against v0.38.0 with its CLI/session behavior preserved. Active CLI runs must finish before account or agent switching, and reused sessions retain their existing ownership. The inherited sidebar keyboard test correction avoids a jsdom hover-timer race without changing the menu implementation.
Validation: server/MCP/CLI Clippy with warnings denied, TypeScript, production UI export and 676 UI regressions across 25 files. The v0.38 upgrade fixture preserved two existing conversations and 354 saved fixture files. Real HTTP/MCP servers with isolated native-storage/ACP fixtures verify model refusal, task round trips, rollback/cleanup, four-page context and embedded images, failed-prompt retry, @ account routing, import deduplication and container restart. Browser checks passed at 1365/390/320px and Arabic RTL at 390px, preserving drafts, titles and selected accounts. These fixtures are not live provider-generation coverage for every agent/OS.
Maintainer edits are enabled. See docs/agent-accounts.md for the user flow and support boundaries.