Move AI chat sessions to ~/.studio/sessions#4128
Merged
Merged
Conversation
…ng the repair pass
bcotrim
marked this pull request as ready for review
July 9, 2026 18:53
Collaborator
📊 Performance Test ResultsComparing 7d64694 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
Contributor
|
That makes sense but I didn't test. Feel free to ship after testing. |
katinthehatsite
approved these changes
Jul 13, 2026
katinthehatsite
left a comment
Contributor
There was a problem hiding this comment.
I think these chanegs are good to go, I reviewed the code and did not find anything concerning 👍 Claude reviewed as well and it looked good 👍
bcotrim
enabled auto-merge (squash)
July 13, 2026 16:02
9 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related issues
How AI was used in this PR
Implemented with Claude Code from a detailed plan (target location, migration hook point, race handling). Code, migration tests, and verification steps reviewed by me.
Proposed Changes
AI chat sessions were the last piece of Studio state still living in the Electron
userDatadir (~/Library/Application Support/Studio/sessions,%APPDATA%\Studio\sessions) — a historical accident: sessions shipped (#2767) just before the~/.studioconfig split (#2793), and only the config JSONs moved. This PR consolidates sessions under~/.studio/sessions, resolved via a newgetSessionsDirectory()helper inwell-known-paths.tsnext to the other config paths.Existing sessions are migrated by a shared
Migrationregistered in both existing migration pipelines — the CLI's (runs as yargs middleware on every invocation) and the desktop's (runs at boot, before the main window exists) — so it covers CLI-only and desktop-only users alike. A lockfile serializes concurrent desktop + CLI first runs.After moving the files, the migration leaves a symlink at the legacy location (a junction on Windows — no privileges needed) pointing at
~/.studio/sessions. That makes the move transparent to everything that still resolves the old path: older Studio/CLI versions running next to a newer one keep reading and writing the same store, and absolute paths persisted inside session entries (e.g. screenshot artifacts fromtake_screenshot) keep resolving — no session data rewriting needed. If linking fails (e.g. network-redirected%APPDATA%), the migration degrades to a self-healing merge that sweeps straggler files into the new root on every run — destination wins on collisions, cross-volume moves fall back to copy+remove. Failures are logged with home-dir-sanitized paths; success is silent like the other CLI migrations.User impact: none visible — sessions and their screenshots keep working in both the desktop app and the CLI, from the new location, across version skew between surfaces. The E2E path overrides (
E2E_APP_DATA_PATH) keep their previous semantics, and the migration is skipped under E2E/dev sandboxes so test runs can't touch real sessions. The experimental hosted backend's session path was updated to match so it keeps reading the same sessions desktop/CLI write.Testing Instructions
~/Library/Application Support/Studio/sessions), runnpm run cli:build && node apps/cli/dist/cli/main.mjs code sessions list— all sessions listed, files now under~/.studio/sessions, old path is now a symlink to it (ls -l).~/.studio/sessions, and old screenshot artifacts render in the desktop conversation view (their persisted absolute paths resolve through the link).~/.studio/sessions/YYYY/MM/DD/.~/.studio/sessions.To revert the migration between scenarios (removes the link, then moves the sessions back so the migration runs again — bare
rmrefuses to delete a real directory, so it only ever removes the link):Pre-merge Checklist