Skip to content

fix(claude): share account history on Windows with junctions and a same-drive hardlink - #26067

Merged
Jinwoo-H merged 2 commits into
mainfrom
claude-profile-windows-history
Oct 7, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
claude-profile-windows-history

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​189
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​93 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59

ELI5

When Orca keeps a separate Claude folder per account, it links that folder's chat history to your normal Claude folder so every account sees the same past sessions and prompts. On Windows we skipped that linking, so each account would have kept its own separate history. This PR turns the linking on for Windows too, using Windows link types that do not need admin rights.

What Changed

  • Before: on Windows, setting up an account folder left its session folders (projects, todos, ...) and its prompt history (history.jsonl) private to that account.
  • After: on Windows the session folders become directory junctions into your Claude folder, and history.jsonl becomes a hardlink to the shared file, exactly like the symlinks macOS and Linux already get. Anything the account already had is merged in first, the same way as on macOS/Linux.
  • If the account folder is on a different drive than your Claude folder, or Windows refuses the link, that account's prompt history stays private and the setup report carries a warning ("History stays private across filesystems" / link failed). Nothing is copied, so the two can never silently drift apart.
  • A hardlink cannot tell "you rewrote or cleared your shared history" from "this account added prompts", so Orca keeps a tiny record of which shared file it linked. If the shared file was replaced (for example after removing prompts), the old copy is kept to one side with a warning instead of being merged back, so removed prompts do not come back.
  • File and folder moves use the existing Windows retry helper so a brief antivirus or editor lock does not fail the run.

Users see no change yet: account-folder setup is not called from any live path on main until routing is switched on.

Why

The Windows skip was copied from another project whose reason ("symlinks need elevation on Windows") does not apply here: junctions and same-drive hardlinks need no elevation. This brings back the original design from the account-folder work, on top of today's merge rules (append only lines not already present, delete fully drained set-aside copies). Copying history instead of linking was rejected because copies diverge.

Linked Issue

STA-3698

Visual Proof

N/A: no UI change; account-folder setup is not yet reachable from the app.

Testing

  • New src/main/claude-accounts/claude-profile-history-windows.test.ts runs the Windows path (junction + hardlink, CLI rewrite, replaced shared file, unreadable record, different drive, link failure, record-write failure, interrupted share). Junctions and hardlinks need no privilege, so it runs on real Windows as well as macOS/Linux.

  • pnpm tc:node, pnpm tc:cli, vitest on src/main/claude-accounts/ and src/main/claude/, oxlint, and the changed-code quality gate pass on macOS.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

SSH and WSL: sharing runs on the machine that owns the account folder, unchanged. macOS/Linux behavior is unchanged.

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)

…me-volume hardlink (STA-3698)

Windows skipped history sharing for Orca-managed Claude account folders on
the mistaken premise that it needs symlink privilege. Session folders now
use directory junctions and history.jsonl a same-volume hardlink, neither
of which needs elevation. A different volume or a failed link keeps that
account's prompt history private and reports it. A small link record tells
a replaced shared file apart from the account's own copy so prompts the
user removed are never merged back. Renames retry on Windows file locks.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4021193-67ad-4e51-b202-8c1d524a5288
📥 Commits

Reviewing files that changed from the base of the PR and between dd1400a and e86b212.

📒 Files selected for processing (2)
  • src/main/claude-accounts/claude-profile-history-windows.test.ts
  • src/main/claude-accounts/claude-profile-prompt-history.ts

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


📝 Walkthrough

Walkthrough

Windows profile sharing now processes history directories and history.jsonl. It creates junctions for directories and hardlinks for prompt history. Prompt history uses file identity records to detect existing links and replacements. The change also handles conflicts, unreadable records, cross-volume files, link failures, and Windows-retry renames. New tests cover these behaviors and recovery of saved merge data.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to e86b2

The affected Windows sharing helper currently has no identified production caller, limiting immediate exposure. If activated with a missing link record and a replaced shared file, previously removed prompts can reappear; address this before wiring up the feature.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling Claude account history sharing on Windows with junctions and a same-drive hardlink.
Description check ✅ Passed The description explains the user-facing change, rationale, implementation, testing, and why visual proof is not applicable. It identifies issue STA-3698, but the template asks for an actual issue lin…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@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: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: de367808-e6ba-4acf-af4b-557bb1e45f5b
📥 Commits

Reviewing files that changed from the base of the PR and between 9d8e363 and dd1400a.

📒 Files selected for processing (4)
  • src/main/claude-accounts/claude-profile-history-windows.test.ts
  • src/main/claude-accounts/claude-profile-history.test.ts
  • src/main/claude-accounts/claude-profile-history.ts
  • src/main/claude-accounts/claude-profile-prompt-history.ts
💤 Files with no reviewable changes (1)
  • src/main/claude-accounts/claude-profile-history.test.ts

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

…ning set-aside prompt history

A pending set-aside copy was appended to the shared history.jsonl before the
same-volume check refused the share, leaking the account's prompts into it.

Co-Authored-By: Claude <[email protected]>
Jinwoo-H added a commit that referenced this pull request Oct 7, 2026
Windows now shares account history with System default (#26067), so the
Windows-only 'chat history is deleted' wording no longer holds.
@Jinwoo-H
Jinwoo-H merged commit 358e4f9 into main Oct 7, 2026
51 of 53 checks passed
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.

1 participant