Skip to content

[FIX] mirror workspace dirs into account + migrate stale statusline install#21

Merged
gradyzhuo merged 3 commits into
mainfrom
fix/workspace-mirror-and-statusline-migrate
Jul 7, 2026
Merged

[FIX] mirror workspace dirs into account + migrate stale statusline install#21
gradyzhuo merged 3 commits into
mainfrom
fix/workspace-mirror-and-statusline-migrate

Conversation

@gradyzhuo

Copy link
Copy Markdown
Member

Two related account/workspace-linking fixes.

1. Mirror all non-private workspace dirs into the account at launch

linkAccountDirsToWorkspace only moved account dirs into the workspace. If another account created a dir in the shared workspace (or one was added directly), this account never got a symlink back to it — so it was invisible here.

Added a second pass (workspace→account): for every non-private directory in the pinned workspace the account lacks, create account/<name> -> workspace/<name>. Gap-fill only (leaves existing dirs/files/symlinks untouched), skips the private set (backups/cache/cc-statusline), dotfiles, and workspace files (dirs only). Runs on every launch via _prepare-claude-launch, so shared dirs converge across all accounts on a workspace. Idempotent.

2. Workspace-marker install removes the stale account copy

Installing a package whose file targets <WORKSPACE_CLAUDE_DIR>/… (the shared statusline program) left an older pre-workspace copy at the account path when no lock recorded it. settings.json got re-pointed to the workspace path (patchSettings overwrites the command), but the dead <account>/statusline.js lingered.

CopyFileExecutor.apply now removes any stale account-relative file/symlink of the same basename on a workspace-marker copy. Never removes a real directory. Migrates pre-v3.1.4 per-account statusline installs cleanly.

Test Plan

  • mirrors a workspace-only dir into the account as a symlink; idempotent
  • does NOT mirror private dirs, or workspace files (dirs only)
  • workspace-marker copyFile removes a stale account file; keeps a same-named real dir
  • full suite green (375/375)

🤖 Generated with Claude Code

gradyzhuo added 3 commits July 7, 2026 14:31
linkAccountDirsToWorkspace only moved account dirs INTO the workspace. A dir
another account created in the shared workspace (or one added directly) never
got a symlink back in this account, so it was invisible here. Add a second pass:
for every non-private directory in the pinned workspace that the account lacks,
create a symlink account/<name> -> workspace/<name>.

Gap-fill only: names the account already has (a dir merged+symlinked by pass 1,
a plain file, or an existing symlink) are left untouched. Skips the private set
(backups/cache/cc-statusline), dotfiles, and workspace files (only dirs). Runs
on every claude launch via _prepare-claude-launch, so shared dirs converge
across all accounts pinned to the same workspace. Idempotent.
…file

Installing a package whose file targets <WORKSPACE_CLAUDE_DIR>/… (e.g. the
statusline program) left an older pre-workspace copy behind at the account path
when it had no lock recording it. The account's settings.json gets re-pointed to
the workspace path (patchSettings overwrites the command), but the dead account
copy of statusline.js lingered and confused the setup.

CopyFileExecutor.apply now, on a workspace-marker copy, removes any stale
account-relative file (or symlink) of the same basename. Never removes a real
directory. This migrates pre-v3.1.4 per-account statusline installs cleanly.
…t pin

Refines the earlier two-way mirror per design decision: the account→workspace
move/merge is a one-time SEED that belongs at pin, not something to re-run on
every launch. Split the direction:

- Extract mirrorWorkspaceDirsToAccount (workspace→account): symlink every
  non-private workspace dir the account is missing; never moves or merges account
  data. linkAccountDirsToWorkspace (pin, via prepareDirectory) still does the
  account→workspace migration and then delegates to the mirror.
- _prepare-claude-launch now calls mirrorWorkspaceDirsToAccount only, so launch
  never migrates. A real dir claude created in the account stays put until the
  next `orrery pin` seeds it into the workspace.

Reworks the launch tests to the new contract (mirror in, no migration) and adds
a direct mirror-only test proving an account real dir is left untouched.
@gradyzhuo
gradyzhuo merged commit 530114c into main Jul 7, 2026
1 check passed
@gradyzhuo
gradyzhuo deleted the fix/workspace-mirror-and-statusline-migrate branch July 7, 2026 09:05
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