Skip to content

fix(claude): keep saved chats resumable across account switches - #50095

Closed
BTForIT wants to merge 2 commits into
stablyai:mainfrom
BTForIT:fix/claude-chat-account-resume
Closed

BTForIT wants to merge 2 commits into
stablyai:mainfrom
BTForIT:fix/claude-chat-account-resume

Conversation

@BTForIT

@BTForIT BTForIT commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

ELI5

An existing Claude chat should keep its history when you switch accounts. Make its saved transcript reachable in the selected account before resuming it.

What Changed

When Claude's launch finds the transcript in another known account home, it prepares a hard link in the selected home's project bucket and checks that the resume resolver can find it there. The source stays in place, so later appends remain visible through both names. Existing target files are never overwritten.

A saved transcript also resumes when the record has no stored leaf yet, matching the existing behavior when that transcript is already in the selected home. A failed link or read-back keeps the existing pre-spawn refusal.

Why

Claude currently detects readable history in another home and refuses to start. Codex already prepares its rollout for the selected account during launch through moveCodexThreadIntoAccountHome. This gives Claude the corresponding transcript preparation.

Linked Issue

Fixes #50093

Visual Proof

N/A: this changes filesystem preparation before provider launch, without UI files or controls. The regression uses real transcript directories to show the resume check refusing before the change and succeeding after it.

Testing

  • Real-filesystem tests cover launch under a second account with and without a saved leaf, append continuity, repeated preparation, and refusal to replace a symlink.

  • With the materializer present but the launch change reverted on v1.4.278, both launch cases fail: one throws historyInOtherAccount, and the leafless case returns false. Both filesystem-only cases still pass, isolating the missing launch step.

  • All four cases pass with the change. The change was then applied to current main without the release branch's unrelated commits.

  • Linux build-server validation on Node 24.22.3: all 26 pnpm check:changed checks pass, including format, lint, all selected typechecks, affected tests and the selected ratchets.

  • Manually tested the full app on each platform

  • Automated tests exercise the persistence behavior with real files

  • Reverting the source change breaks the added behavior

Performance

A launch whose selected home lacks the transcript probes known Claude homes. A match adds one hard link and a resolver read-back. The code reads no transcript contents, copies no account folders, and adds no polling.

Risk

Level: Medium. A selected account gains a link to saved chat history. The move uses real project folders and regular transcript files; a conflicting target or failed read-back refuses the launch. Hard links across volumes or on unsupported filesystems also refuse, preserving the source. There is no copy fallback for a potentially live transcript.

A revert stops preparing new links but leaves links already created in place. It removes no credentials or source history.

AI Disclosure

Prepared with Codex (GPT-6).

Review

The move runs on the execution host with that host's router and known homes. It uses Node path/filesystem APIs and changes only Claude's native launch path; other providers and account selection are unchanged. SSH/paired hosts keep their own homes. Linux is tested; macOS and Windows filesystem restrictions can still produce the existing refusal. No dependency, credential migration, UI setting, or background task is added.

Agent skill upstream boundary

  • This change copies no upstream skill-installer material.

Checklist

  • Small change for one resume failure
  • User behavior, mechanism, risk and performance described
  • Self-reviewed for source preservation, target conflicts and execution-host scope
  • Required changed-file checks run on the build server
  • Full CI suite and packaging build

Prepare a hard link into the selected account before resuming history found
in another known Claude home, and verify the resolver can read it back.
Preserve the source and refuse conflicting or unsupported targets.

Real filesystem coverage includes saved and leafless launches, append
continuity, repeated preparation and symlink refusal. Reverting the launch
change reproduces two failures on v1.4.278; all four cases pass with it.
All 26 check:changed checks pass on Linux with Node 24.22.3.

Fixes stablyai#50093
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

When Claude launch finds a transcript in another account home, it attempts to move the transcript into the selected home and checks whether it resolves there. The move creates a hard link and rejects conflicting targets that do not identify the same regular file. Tests cover resume outcomes, inode preservation, later appends, repeated moves, and a conflicting symlink.

Severity of issue fixed: Medium

Merge Risk: Low · up to 2f99c

Resuming Claude chats across account switches now links the transcript into the selected account home. In a rare filesystem race on platforms with very large inode numbers, a different file could be treated as the same transcript, so later messages might not carry over. A small fix using exact inode comparison closes this, and the risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Claude saved chats stay resumable when the user switches accounts. It matches the summarized launch-time transcript move into the selected account home and the linked …
Description check Passed The description follows the template. It includes ELI5, What Changed, Why, a linked issue (Fixes #50093), Visual Proof marked N/A with a reason, Testing with checkboxes, Performance with a 'None, beca…
Linked Issues check Passed Issue #50093 has one direct coding requirement set. (1) Resume an existing Claude chat under the selected account after making its transcript reachable there. The change in src/main/claude/structured/…
Out of Scope Changes check Passed All changed files relate to the linked requirement. The changes are in the Claude launch-home path (claude-structured-launch-home.ts), a new transcript move module (claude-session-account-move.ts), an…
Full details: Title check

Explanation

The title names the main change: Claude saved chats stay resumable when the user switches accounts. It matches the summarized launch-time transcript move into the selected account home and the linked issue #50093. The 'fix(claude)' prefix is a conventional commit style and is clear to a reviewer scanning history.

Full details: Description check

Explanation

The description follows the template. It includes ELI5, What Changed, Why, a linked issue (Fixes #50093), Visual Proof marked N/A with a reason, Testing with checkboxes, Performance with a 'None, because' style answer, Risk with a level, AI Disclosure, Review, the agent skill boundary, and a checklist. It describes the before and after behavior, the mechanism, the risk, and the revert path. Some template items are left unchecked, including manual testing on each platform and full CI, but the author states these as open. The Performance line is written as an explanation rather than a one-line 'None, because' answer, which is acceptable. The Notes section of the template was dropped, but the Review section covers the cross-platform and SSH scope.

Full details: Linked Issues check

Explanation

Issue #50093 has one direct coding requirement set. (1) Resume an existing Claude chat under the selected account after making its transcript reachable there. The change in src/main/claude/structured/launch/claude-structured-launch-home.ts calls the new moveClaudeSessionIntoAccountHome before the resume check. After a successful move, claudeLaunchResumesTranscript returns true. (2) Keep the source history. moveClaudeSessionIntoAccountHome uses a hard link under the existing filename, so the source stays in place and later appends remain visible through both names. (3) Refuse the launch if preparation cannot be verified. Link failures and a missing transcript after the move throw historyInOtherAccount through AgentSessionPreSpawnError. (4) Never overwrite an existing target. An existing destination is accepted only when it is a regular file with the same device and inode as the source. Otherwise the function throws, and the symlink case is covered by a test. (5) Leafless records resume, matching the existing same-home behavior. Automated tests in src/main/claude/transcripts/claude-session-account-move.test.ts use real directories and cover saved and leafless launches, inode and append continuity, and conflicting symlink refusal. The author reports that reverting the launch change makes the launch cases fail. Assessment is based on the whole-PR summary and the stated behavior; I did not inspect the full source diff.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the linked requirement. The changes are in the Claude launch-home path (claude-structured-launch-home.ts), a new transcript move module (claude-session-account-move.ts), and its tests (claude-session-account-move.test.ts). The PR description states that other providers, account selection, UI, dependencies, and credential handling are unchanged. The PR description also states that no upstream skill-installer material is copied. The Codex reference is analogy only and does not add Codex changes. No unrelated change was identified in the summary.

  • 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.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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: fc9dd776-75d0-4a65-a497-0da29ed606f8
Commits

Reviewing files that changed from the base of the PR and between aa7e2b6 and 2f99cfb.

Files selected for processing: 3

  • src/main/claude/structured/launch/claude-structured-launch-home.ts
  • src/main/claude/transcripts/claude-session-account-move.test.ts
  • src/main/claude/transcripts/claude-session-account-move.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Use BigInt filesystem metadata when a target appears during link preparation, preserving exact device and inode identity above the safe integer range. All 26 changed-file checks pass on Node24 build-server run Claude-Resume-Review-20261126T200241Z-77bc23.

Co-Authored-By: Codex <[email protected]>
@BTForIT

BTForIT commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #36649, whose Claude carry and native next-send account following cover this failure. I offered our four real-filesystem cases, resolver read-back and exact-inode safety change there so upstream can keep one history-move implementation.

CodeRabbit's BigInt dev/ino point is fixed in fee7d458d2cc9551c567fa6bb0c49251db2d3ea9 and answered in its thread. The final head passed all26 pnpm check:changed checks on the Linux build server with Node24.22.3. The branch remains available for the author to take the commits or adapt the tests; closing this PR does not withdraw that offer.

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.

Existing Claude chats cannot resume after switching host accounts

1 participant