Skip to content

Fix Linux sparse archives and preserve Desktop data during identity switching - #83

Open
ShulingTang wants to merge 3 commits into
liseami:mainfrom
ShulingTang:fix/linux-desktop-identity
Open

ShulingTang wants to merge 3 commits into
liseami:mainfrom
ShulingTang:fix/linux-desktop-identity

Conversation

@ShulingTang

Copy link
Copy Markdown

Linux identity switching could write a valid sparse GPU cache file as a GNU sparse tar entry and then reject its own archive. The packaged Linux Claude Desktop process and its OAuth login stores were also outside identity handling.

This change writes regular tar entries and adds narrow Desktop identity handling through the existing verified archive, clear/restore, and rollback transaction:

  • Match the supported /usr/lib/claude-desktop executable paths for the current user, including running executables replaced by a package upgrade.
  • Move only whitelisted OAuth/account fields from Desktop config.json, preserving other settings.
  • Snapshot committed SQLite Cookie/WAL data and clear/restore only Claude/Anthropic login-cookie rows. Preserve other cookies, reject unsafe or orphaned sidecars and incompatible table/index/version metadata, and vacuum filtered snapshots to remove previously deleted unrelated cookie bytes. Unique constraint conflicts abort and roll back instead of replacing unrelated cookies.
  • Preserve Desktop Local Storage, IndexedDB, session history, preferences, MCP configuration and workspace files. General residue cleanup does not gain a whole-profile deletion target.
  • Detect remaining local login data without returning credentials to the UI; show unreadable login state as unavailable. Document the supported layout and OS-bound credential limitations.

Refs #82.

Validation:

  • The five initial new Linux regressions failed against upstream before the fixes, including the reported sparse-archive error.
  • Linux Rust suite: 143 passed, 2 ignored; includes 11 Linux identity regressions covering sparse-cache round trip, Desktop OAuth/Cookie preservation, committed WAL snapshots, direct deletion, failed-switch rollback, unreadable state, sidecar rejection, schema/version compatibility, equal-schema conflict rollback and removal of deleted cookie bytes. Process regressions also cover exact executable matching.
  • Frontend: 23 tests passed; typecheck and production build passed.
  • All new tests use synthetic temporary profiles. The development build has not been installed over a user's application or tested with a real account.

The Desktop layout covered here is the packaged Linux build using XDG_CONFIG_HOME/Claude and /usr/lib/claude-desktop/claude-desktop; unrelated third-party layouts are not guessed.

Write sparse cache files as regular tar entries and manage packaged Linux Desktop OAuth fields and login cookies through the verified identity transaction. Preserve non-login cookies, preferences, history and workspaces, include WAL snapshots, and match only supported Desktop executable paths.

Refs liseami#82

AI-Co-Authored-By: Codex
Reject incompatible Cookie schemas and orphaned sidecars, vacuum filtered snapshots, and keep unreadable Desktop login state unknown. Match replaced packaged executables without broadening the process allowlist.

Refs liseami#82.

AI-Co-Authored-By: Codex
Abort on unique constraint collisions instead of replacing unrelated cookies. Cover identical schemas with default and explicit REPLACE policies, preserving both original login and non-login rows on failure.

Refs liseami#82.

AI-Co-Authored-By: Codex
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