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
Native chats follow the account picker and keep the conversation - #36649
When you switch accounts in Orca's account picker, an open chat now moves to that account on its next message and keeps the same conversation. A short grey line in the chat says so: "Now on [email protected] · same conversation".
What Changed
Before
A Codex chat stayed on the account it was created with, forever. Switching the picker (for example because that account hit its usage limit) did nothing for chats that already existed.
A Claude chat used the new account, but if its history lived only in the old account's folder, the next message failed with "This chat's history is in another Claude account. Switch back to that account to continue it."
After
On the first message after the picker changes, the chat stops its idle agent, makes the conversation available to the selected account, records the new account on the chat, and resumes the same conversation there. One quiet line in the chat records the move.
A chat that is busy finishes its current turn first, exactly like terminals waiting for "Restart session".
If the conversation cannot be made available to the new account (the file is unreadable, or a different file already sits at that spot), the chat stays where it was: Codex keeps running on its old account as today, and Claude keeps today's "switch back" message, now only for that case.
Mechanism
The chat host's agent start asks the execution host which account a new chat would use right now. If it differs from the chat's saved account, it carries the conversation over, repins the saved account, then starts. Because the start reads the saved record, the ownership check, the conversation key and the Codex launch all agree on the new account.
Carrying reuses the step terminal restarts already use: find the Codex rollout by thread id and hard-link it (or copy it, never overwriting) into the new account's sessions/ folder at the same dated path. Claude transcripts get the same link-or-copy at the same projects/ path; when Claude accounts already share history, nothing is copied.
The existing "replace an outgrown agent before the next send" check (used today for sign-out and permission-mode changes) gains one more reason: the picker now selects another account. A move that failed is remembered, so a chat never restarts its agent on every message.
The line is an ordinary status row with English text plus an optional field; the desktop translates it.
Hosts and versions
Runs on the machine that owns the chat: the desktop, or a remote Orca server using its own account picker. Hosts whose accounts are decided by another machine (WSL guests) keep today's behaviour.
No RPC change. Older clients show the row's English sentence; older hosts simply don't move chats.
Why
Terminals already move a conversation to the selected account on restart. Reusing that step for chats gives one account model for chats and terminals and fixes every existing Codex chat, without a per-chat account setting or a second copy step. A per-chat account setting would be another place that decides accounts and drifts from the status bar; switching accounts automatically on a limit would spend another account's quota without asking.
Linked Issue
N/A (maintainer change)
Visual Proof
Isolated dev build, two test Codex accounts with fake credentials, and a stand-in codex app-server that only resumes a thread whose rollout exists under its CODEX_HOME and replies naming its account.
Before (main): after switching to the personal account, the next reply still comes from the work account.
After, light and dark:
After, with "Share Codex history across accounts" off, so the rollout was carried by the move itself:
Testing
I manually tested these changes locally (macOS, isolated dev profile, flows above)
Automated tests added/updated
Host: a send after the picker changed starts a new agent on the selected account, repins the chat, and writes one row; a failed move keeps the old account and does not loop; a busy chat is not replaced.
Execution host: Codex and Claude carry, no-conversation chats, chats already on the selected account, other agents, and hosts whose accounts another machine decides.
Carry: Codex rollout hard-linked at the same dated path, already-shared history left alone, missing thread reported; Claude transcript from any known account, shared history, missing transcript.
Renderer: the row renders as one faint line, with the account or System default.
pnpm tc, touched suites, every pr.yml static-analysis step and check:code-quality:changed pass locally. The real Claude CLI suites show the same 2 failures on main with Claude Code 2.1.316 (effort and model reporting on the init frame), unrelated to this change.
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Paths go through the existing cross-platform helpers; the link-or-copy step is the one terminal restarts already use on all platforms.
Mobile renders the row's text as a faint aside with no change.
Where a link isn't possible (different disks), each account keeps its own copy. A switch refreshes the target's copy from the newest one, and only when that copy is an older version of it; a copy that went its own way is never overwritten.
Claude chats from older builds already ran on the picked account even though their saved account didn't say so. Their first start after upgrading updates the saved account quietly, without the "Now on" line.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
Structured sessions can follow a selected account before starting. The change adds Claude transcript and Codex thread carry behavior, updates session account records, and records account switches in the journal. The chat interface renders account-switch notices with the account name or “System default.” A shared no-overwrite file installer is also used for legacy Codex rollout materialization.
Merge Risk: Moderate · up to 6150d
A chat can switch accounts and resume a transcript missing recent turns. Resolve this before merging unless that behavior is explicitly accepted.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 42.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly identifies the main change: native chats follow the selected account while preserving the conversation.
Description check
The description covers the required sections, user-visible behavior, implementation, rationale, visual proof, testing, compatibility considerations, and checklist. The linked issue field says this is …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description covers the required sections, user-visible behavior, implementation, rationale, visual proof, testing, compatibility considerations, and checklist. The linked issue field says this is a maintainer change and uses N/A, which is acceptable under the template’s maintainer exception.
Full details: Docstring Coverage
Explanation
Docstring coverage is 42.31% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 26 functions across 33 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
.catch(() => null) drops the error with no trace. The fallback is safe: a null result never retires the child. But nobody can see why a chat stopped following the picker. A sibling path in the same file, followSelectedAccountBeforeStart, logs the equivalent failure with deps.logger.warn.
Add logger to the Pick and log the error. The only caller passes the full StructuredAgentSessionHostDeps, so logger is available.
Proposed fix
export async function launchedOnOtherAccount(
- deps: Pick<StructuredAgentSessionHostDeps, 'accountFollow' | 'store'>,+ deps: Pick<StructuredAgentSessionHostDeps, 'accountFollow' | 'store' | 'logger'>,
sessionId: string,
session: Pick<StructuredAgentSessionHostSession, 'accountFollowTried'> | undefined
): Promise<boolean> {
const record = deps.store.getRecord(sessionId)
if (!deps.accountFollow || !record) {
return false
}
- const selected = await deps.accountFollow.selectedHome(record).catch(() => null)+ const selected = await deps.accountFollow.selectedHome(record).catch((error: unknown) => {+ // Unreadable selection never retires a running child; report it so the cause is visible.+ deps.logger.warn('reading the selected account for a chat failed', {+ scope: 'account-follow',+ sessionId,+ error+ })+ return null+ })
Based on learnings: flag TypeScript code that silently swallows errors or falls back to defaults unless the fallback is explained by a comment or the error is reported.
Source: Learnings
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 7e4012a9-a841-4e96-9100-bc2843c178a2
Commits
Reviewing files that changed from the base of the PR and between 0d94c0b and 2526da0.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Do not treat an existing target transcript as proof that it is current.
When the initial hard link fails, installConversationFileWithoutOverwrite can create a copy. Later turns can update that copy independently. A subsequent move can return at the target-home check and resume an older transcript, which omits turns made after the copy. The Codex path has the same issue because it ranks the target home first and returns early when source and target are equal.
Reconcile an existing target with the source transcript before returning success. Use content comparison, not only inode, size, or mtime. If the files differ, refuse the move or replace the target safely. Add regression tests for a copied target that receives additional turns before the conversation moves back.
Handle a rejected repin as an account-follow failure.
repinAccountHome runs after the carry and can reject before the record changes. The rejection currently escapes followSelectedAccountBeforeStart, so the pending submission fails even though the original account still has the conversation. Catch and log the error, then return from the lock callback. Returning also skips the account-switch journal row, which must not be recorded when the repin failed.
Suggested fix
- await deps.store.repinAccountHome(sessionId, accountHome)+ try {+ await deps.store.repinAccountHome(sessionId, accountHome)+ } catch (error) {+ deps.logger.warn('repinning a chat to the selected account failed', {+ scope: 'account-follow',+ sessionId,+ error+ })+ return+ }
Committable suggestion
IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
…rsation
A Codex chat stayed on the account it was created with, and a Claude chat
whose history was not shared with the selected account failed with "switch
back to that account". Now the first start after the picker changes carries
the conversation to the selected account with the step terminals use on
restart, repins the chat's record, and records "Now on <account> · same
conversation". A busy chat finishes its turn first. When the conversation
cannot be carried the chat stays where it was, and Claude keeps its failure.
The reason will be displayed to describe this comment to others. Learn more.
I read carryClaudeConversationToAccountHome, refreshConversationFileCopy and the execution-host createStructuredAgentAccountFollow integration. This already covers the Claude transcript move that I proposed in #50095, and also handles next-send account following and cross-filesystem copies. I'm closing #50095 so upstream has one implementation to review.
Would you take the useful tests and safety details from it here?
2f99cfbc1f5c5f8519bdad295534538d6b923e64 adds four real-filesystem cases in src/main/claude/transcripts/claude-session-account-move.test.ts: launch into a second account with a saved leaf, the same launch without a leaf, same-inode/later-append continuity with repeated preparation, and rejection of a symlink target. The names/imports need adapting to your carry function; this is an offer of the cases, not a claim that cherry-picking the commit directly fits your branch.
fee7d458d2cc9551c567fa6bb0c49251db2d3ea9 addresses the review's exact file-identity point: use lstat(..., { bigint: true }) for device/inode equality in an EEXIST race. Two different large inode values can compare equal as Numbers. Your refreshConversationFileCopy / assertMatchingExistingTarget currently use Number metadata too, so that concern applies to the shared installer as well.
Keep the actual resume-resolver read-back after materialization, including records with no leaf yet. A successful copy/link operation alone does not prove that Claude's resolver will accept the target directory and file.
Both commits are on the fork branch for #50095. The final head passed all26 pnpm check:changed checks on a Linux build server with Node24.22.3. On v1.4.278, reverting only my launch hook reproduces the two launch failures while the two filesystem-only cases still pass. These are results for #50095, not a validation claim for this PR.
One operational case worth covering in the same history path: subagent .meta.json files can be replaced by atomic rename. A previously hard-linked sidecar then diverges even while the main JSONL still shares its inode. Preserve a divergent copy and reconcile it deliberately; one chat's sidecar conflict should not prevent unrelated chats from being prepared. Our public issue #50093 has the account-switch resume failure; this PR is the broader fix for it.
We are integrating this next-message move with the per-bot account / agent.account.resolve work in #48466. Our acceptance case there is #48466 (comment).
The integration changes the target of this mover, not its lifecycle: resolve the chat's bot/automation account using the same hook as a fresh Claude launch; obtain that account's existing/read or prepared/launch home through the existing Claude profile router; then retain this PR's conversation carry, lease-safe repin and restart. Fall back to the host selection only when the existing hook returns no requested account. No host-wide selection RPC is used by a bot-account change.
The factory dependency is the existing launch resolver, passed from bot wiring:
For child workspaces, the account resolver follows recorded workspace lineage to lookup.byHome, validating the parent instance and bounding cycles/depth. This lookup is account-only: it grants no bot tools, prompts or approval policy to a worker. Existing owned structured workers are excluded from in-place following through their native worker-custody authority; continuations still use orchestration admission.
On the current 1.4.279 native host, the port preserves the newer busy/owed-work, actual acquired-child-home, lease, and Codex deletion/hold guards. A failing regression on the host-picker target keeps account A after the bot requests B. With the resolver target connected, the same provider handle resumes on B on the next message, the host pointer stays byte-for-byte on A, and a busy running turn remains on A until completion. Missing/divergent history stays at its source. These cases, history carry and worker exclusion passed 60 tests in our build-server run; VM installation and real provider read-back are still pending.
Our downstream carry is temporary: remove the integration when upstream ships the paired behavior and an installed retained-conversation rehearsal proves the same provider handle on the requested login without changing the host selection. Happy to shape this dependency wiring and the account-only lineage tests to the preferred upstream owner.
This branch has not been deployed
No deployments
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
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.
ELI5
When you switch accounts in Orca's account picker, an open chat now moves to that account on its next message and keeps the same conversation. A short grey line in the chat says so: "Now on [email protected] · same conversation".
What Changed
Before
After
Mechanism
sessions/folder at the same dated path. Claude transcripts get the same link-or-copy at the sameprojects/path; when Claude accounts already share history, nothing is copied.Hosts and versions
Why
Terminals already move a conversation to the selected account on restart. Reusing that step for chats gives one account model for chats and terminals and fixes every existing Codex chat, without a per-chat account setting or a second copy step. A per-chat account setting would be another place that decides accounts and drifts from the status bar; switching accounts automatically on a limit would spend another account's quota without asking.
Linked Issue
N/A (maintainer change)
Visual Proof
Isolated dev build, two test Codex accounts with fake credentials, and a stand-in
codex app-serverthat only resumes a thread whose rollout exists under itsCODEX_HOMEand replies naming its account.Before (main): after switching to the personal account, the next reply still comes from the work account.
After, light and dark:
After, with "Share Codex history across accounts" off, so the rollout was carried by the move itself:
Testing
pnpm tc, touched suites, every pr.yml static-analysis step andcheck:code-quality:changedpass locally. The real Claude CLI suites show the same 2 failures on main with Claude Code 2.1.316 (effort and model reporting on the init frame), unrelated to this change.Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)