You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Choose and switch accounts for an individual conversation #7984
Updated October 9, 2026: I now have a local implementation; this replaces the initial pre-implementation proposal.
I use Superset daily with several Claude accounts. Sometimes one chat hits its limit while another account still has capacity. I want to continue that same conversation on the other account without changing my project default or the accounts used by my other chats.
I built a local version with:
A choice of existing accounts for new chats and a visible account label.
A saved account binding when reopening a chat.
An explicit switch for an existing conversation that resumes its saved session in the same working folder.
Recovery for ended conversations, with visible errors when identity or safe continuation cannot be established.
The intended scope covers terminals and Superset's native chat view. Switching resumes saved history; running tools and background jobs do not move between accounts. It does not automatically send a message.
I saw #7915, #7954 and #8005. I'd like to align this with that work and agree on how conversation choices interact with project and default accounts.
I can split the contribution into selection/binding first, then switching/recovery. Imports, usage improvements and optional account displays would be separate proposals. I've used and tested the local fork on macOS; each extracted PR would still need fresh checks and a reproducible recording.
Does this fit the direction you want, and which account/recovery work should I build on?
This is a feature request, but it points at a real gap that could be fixed on its own first: a Claude session started from a second, account-pinned agent config does not keep its account when resumed. I read the code (no tests run), and the problem is broader than the issue says. The config UUID is lost on every launch, not only on resume.
Summary. The proposal is to let a user pick a Claude account (a Claude agent config pinned to its own CLAUDE_CONFIG_DIR) for each session. It also asks for a "Switch account" action that stops the process and resumes the same provider session under a different account, without changing the host-wide default account. The launch side already works per config. The resume side does not track which config a session came from, so a pinned session can come back under the wrong account.
Affected code
Launch env.packages/host-service/src/terminal-agents/agent-config.ts:101-106: agentLaunchEnv puts config.env on top of resolveDefaultAccountEnv. So a config with its own CLAUDE_CONFIG_DIR launches under that account. This part works.
Config lookup.agent-config.ts:73-93: resolveHostAgentConfig matches by config UUID first. If that fails, it falls back to the first row with that presetId, ordered by displayOrder. With two Claude configs, looking up "claude" always returns the first one.
Binding on resume.packages/host-service/src/trpc/router/agents/agents.ts:469-486: bindResumedSession records agentId: presetId (for example "claude") and no config id.
Binding on any launch.packages/agent-setup/templates/notify-hook.template.sh:268: the hook payload sends only agentId and sessionId. notifications.ts:17-23 accepts definitionId, but no hook template sends it.
Resume lookup.terminal-agents.ts:135-138 (resumeTerminalAgentSession), :223-226 (listAccountRestartCandidates), :449-452 (resumeCandidate), and agents.ts:563-566 (continuationTarget) all look up binding.definitionId ?? binding.agentId.
Id format.terminal-agents.ts:369-372: agentDefinitionIdSchema only accepts builtin ids or custom:<name>. definitionId was not built to hold a HostAgentConfig UUID.
Suspected root cause
For a Claude session, the binding's definitionId is always empty, so resume falls back to agentId ("claude"). resolveHostAgentConfig then returns the first Claude config by displayOrder, not the one the session was launched with. Resume runs runAgent({ agent: config.id, resumeSessionId }) (terminal-agents.ts:154-159). So a session started from "Claude (work)" resumes under whatever CLAUDE_CONFIG_DIR the first Claude config resolves to, possibly the default account. The docstring at terminal-agents.ts:114-116 states this outright ("the pane comes back as the same agent on the current default account").
What follows from that, depending on whether the two profiles share session state:
Profiles not shared (for example, not set up through usage.prepareAccount, usage.ts:296): the transcript lives only in the other config dir, and claude --resume <id> finds nothing.
Profiles shared: the conversation resumes, but under the wrong account.
"Never prompted" check:hasSession (bindingHasHarnessSession) resolves the same wrong config, so it may look in the wrong session store.
Bulk restart:listAccountRestartCandidates filters on the resolved config's presetId, so a pinned session also shows up as a candidate when the default account changes.
The binding already stores account (store.ts:228-232, set from the hook's accountProfile). That records which account a session used, but resume never uses it to choose a config.
Reproduction
In Settings → Agents, create two configs with presetId: "claude". Set A's env.CLAUDE_CONFIG_DIR to profile X and B's to profile Y. A must have the lower displayOrder.
Launch B in a workspace and send a prompt so a session id is captured.
Kill the terminal or the host daemon, then let resume run (the pane's resume action or the automatic sweep).
Expected: the process relaunches with CLAUDE_CONFIG_DIR=Y. Likely actual: it relaunches with X, labelled as A.
A bun:test sketch next to terminal-agents.test.ts:
Set up: insert two Claude configs in a test HostDb, and record Attached then Stop for terminal T with agentId: "claude" (what the hook sends today).
Act: mark T as dead and call resumeTerminalAgentSession with a stub runAgent that captures its input.
Assert: runInput.agent equals config A's id, not B's. The same stub can show that bindResumedSession writes no config id.
Fix direction
This could ship before any of the UI work:
Store the config UUID on every binding. Add a column (for example agentConfigId) instead of reusing definitionId, whose schema rejects UUIDs. Two ways to fill it:
Export the UUID into the PTY env at launch (next to launchId / the attribution token), and have notify-hook.template.sh send it back.
Or record it host-side in runTerminalAgent, keyed by launchId.
Also pass it through bindResumedSession.
Use it on resume. Have resumeTerminalAgentSession, resumeCandidate, continuationTarget, harness-session-ref.ts:40 and listAccountRestartCandidates prefer the stored UUID. They should fall back to definitionId ?? agentId only for old rows.
Keep pinned sessions out of default-account restarts. In listAccountRestartCandidates, skip configs whose env sets their own CLAUDE_CONFIG_DIR / CODEX_HOME. Otherwise changing the default restarts pinned sessions for no reason.
Build the switch on top. "Switch account" can then be resumeTerminalAgentSession with an explicit destination config id. It would add the safeguards the issue lists:
check the destination's auth before stopping the source;
keep model, effort and mode;
roll back to the source if the launch fails.
The existing claim/unclaim and the in-flight guard in resumeInflight (terminal-agents.ts:123-201) already cover "only one writer" for a single terminal.
Account registration. Creating a presetId: "claude" config after prepareAccount fits the existing model: duplicate preset ids are allowed, and model and effort validation keys off resolveAgentLaunchPresetId (agents.ts:395-406). The custom-agent form at NewCustomAgentDetail.tsx:69 hardcodes presetId: "custom", so it isn't the right entry point.
changed the title [-]feat(desktop): select Claude accounts per session and switch through exact-session resume[/-][+]Choose and switch accounts for an individual conversation[/+]on Oct 9, 2026
The independent fixes are also ready: quota refresh ordering #8399 and composer acceptance #8400. Saved native Claude adoption and its storage are indexed in #8358.
The final combined checkpoint passed the standard full suite: 29 tasks, 15,920 passing tests, zero failures, four skips and eight todo cases, plus lint and all 41 typecheck tasks. The real Node/PTY gate passed 56 tests with two unavailable fish-shell cases skipped. Qualification and recordings distinguish isolated Electron journeys from component demonstrations.
This reuses the existing launchers, bindings, ACP commands/journal, queues and recovery UI. It respects the upstream ACP rollout flag. Recovery is for ended sessions with shared canonical history; it does not transfer live tools or send prompts. Codex also requires shared writer locks. Account-bound ACP forks/handoffs and terminal-to-ACP conversion remain outside this slice.
Hosted workflows need maintainer approval for this first-contributor set. Authenticated Claude/Codex replay is not claimed. The PRs target main and include prerequisite ancestry until those prerequisites merge.
Activity
github-actions commentedon Sep 30, 2026
This is a feature request, but it points at a real gap that could be fixed on its own first: a Claude session started from a second, account-pinned agent config does not keep its account when resumed. I read the code (no tests run), and the problem is broader than the issue says. The config UUID is lost on every launch, not only on resume.
Summary. The proposal is to let a user pick a Claude account (a Claude agent config pinned to its own
CLAUDE_CONFIG_DIR) for each session. It also asks for a "Switch account" action that stops the process and resumes the same provider session under a different account, without changing the host-wide default account. The launch side already works per config. The resume side does not track which config a session came from, so a pinned session can come back under the wrong account.Affected code
packages/host-service/src/terminal-agents/agent-config.ts:101-106:agentLaunchEnvputsconfig.envon top ofresolveDefaultAccountEnv. So a config with its ownCLAUDE_CONFIG_DIRlaunches under that account. This part works.agent-config.ts:73-93:resolveHostAgentConfigmatches by config UUID first. If that fails, it falls back to the first row with thatpresetId, ordered bydisplayOrder. With two Claude configs, looking up"claude"always returns the first one.packages/host-service/src/trpc/router/agents/agents.ts:469-486:bindResumedSessionrecordsagentId: presetId(for example"claude") and no config id.packages/agent-setup/templates/notify-hook.template.sh:268: the hook payload sends onlyagentIdandsessionId.notifications.ts:17-23acceptsdefinitionId, but no hook template sends it.terminal-agents.ts:135-138(resumeTerminalAgentSession),:223-226(listAccountRestartCandidates),:449-452(resumeCandidate), andagents.ts:563-566(continuationTarget) all look upbinding.definitionId ?? binding.agentId.terminal-agents.ts:369-372:agentDefinitionIdSchemaonly accepts builtin ids orcustom:<name>.definitionIdwas not built to hold a HostAgentConfig UUID.Suspected root cause
For a Claude session, the binding's
definitionIdis always empty, so resume falls back toagentId("claude").resolveHostAgentConfigthen returns the first Claude config bydisplayOrder, not the one the session was launched with. Resume runsrunAgent({ agent: config.id, resumeSessionId })(terminal-agents.ts:154-159). So a session started from "Claude (work)" resumes under whateverCLAUDE_CONFIG_DIRthe first Claude config resolves to, possibly the default account. The docstring atterminal-agents.ts:114-116states this outright ("the pane comes back as the same agent on the current default account").What follows from that, depending on whether the two profiles share session state:
usage.prepareAccount,usage.ts:296): the transcript lives only in the other config dir, andclaude --resume <id>finds nothing.hasSession(bindingHasHarnessSession) resolves the same wrong config, so it may look in the wrong session store.listAccountRestartCandidatesfilters on the resolved config'spresetId, so a pinned session also shows up as a candidate when the default account changes.The binding already stores
account(store.ts:228-232, set from the hook'saccountProfile). That records which account a session used, but resume never uses it to choose a config.Reproduction
presetId: "claude". Set A'senv.CLAUDE_CONFIG_DIRto profile X and B's to profile Y. A must have the lowerdisplayOrder.CLAUDE_CONFIG_DIR=Y. Likely actual: it relaunches with X, labelled as A.A
bun:testsketch next toterminal-agents.test.ts:HostDb, and recordAttachedthenStopfor terminal T withagentId: "claude"(what the hook sends today).resumeTerminalAgentSessionwith a stubrunAgentthat captures its input.runInput.agentequals config A's id, not B's. The same stub can show thatbindResumedSessionwrites no config id.Fix direction
This could ship before any of the UI work:
Store the config UUID on every binding. Add a column (for example
agentConfigId) instead of reusingdefinitionId, whose schema rejects UUIDs. Two ways to fill it:launchId/ the attribution token), and havenotify-hook.template.shsend it back.runTerminalAgent, keyed bylaunchId.Also pass it through
bindResumedSession.Use it on resume. Have
resumeTerminalAgentSession,resumeCandidate,continuationTarget,harness-session-ref.ts:40andlistAccountRestartCandidatesprefer the stored UUID. They should fall back todefinitionId ?? agentIdonly for old rows.Keep pinned sessions out of default-account restarts. In
listAccountRestartCandidates, skip configs whoseenvsets their ownCLAUDE_CONFIG_DIR/CODEX_HOME. Otherwise changing the default restarts pinned sessions for no reason.Build the switch on top. "Switch account" can then be
resumeTerminalAgentSessionwith an explicit destination config id. It would add the safeguards the issue lists:The existing claim/unclaim and the in-flight guard in
resumeInflight(terminal-agents.ts:123-201) already cover "only one writer" for a single terminal.Account registration. Creating a
presetId: "claude"config afterprepareAccountfits the existing model: duplicate preset ids are allowed, and model and effort validation keys offresolveAgentLaunchPresetId(agents.ts:395-406). The custom-agent form atNewCustomAgentDetail.tsx:69hardcodespresetId: "custom", so it isn't the right entry point.[-]feat(desktop): select Claude accounts per session and switch through exact-session resume[/-][+]Choose and switch accounts for an individual conversation[/+]ozeitis commentedon Oct 11, 2026
The implementation is now in focused, non-draft PRs. Each body links its focused review diff excluding prerequisites and test evidence.
The independent fixes are also ready: quota refresh ordering #8399 and composer acceptance #8400. Saved native Claude adoption and its storage are indexed in #8358.
The final combined checkpoint passed the standard full suite: 29 tasks, 15,920 passing tests, zero failures, four skips and eight todo cases, plus lint and all 41 typecheck tasks. The real Node/PTY gate passed 56 tests with two unavailable fish-shell cases skipped. Qualification and recordings distinguish isolated Electron journeys from component demonstrations.
This reuses the existing launchers, bindings, ACP commands/journal, queues and recovery UI. It respects the upstream ACP rollout flag. Recovery is for ended sessions with shared canonical history; it does not transfer live tools or send prompts. Codex also requires shared writer locks. Account-bound ACP forks/handoffs and terminal-to-ACP conversion remain outside this slice.
Hosted workflows need maintainer approval for this first-contributor set. Authenticated Claude/Codex replay is not claimed. The PRs target main and include prerequisite ancestry until those prerequisites merge.