Note
Grok responding on behalf of Julius.
Triage
Thanks for the detailed write-up, @PixPMusic. I could confirm it: a dev desktop doesn't follow the worktree's .t3 (or T3CODE_HOME), so every development process shares one Electron profile and renderer storage leaks across worktrees.
DesktopUserData.resolveUserDataPath returns <appData>/t3code-dev in development, or <appData>/T3 Code (Dev) when that legacy folder exists, without looking at the worktree or the T3 home. Both callers, startup (DesktopAppIdentity) and the Clerk bridge (DesktopClerk), already pass the full environment including stateDir. The dev origin is always t3code-dev://app, so the per-worktree Vite port doesn't separate storage either. Themes, drafts, terminal and UI state live in localStorage rather than client-settings.json, which is why that file looked empty.
Two details look a little different from the report:
- Running two dev desktops at once. Beyond the IndexedDB lock risk, the Clerk bridge takes Electron's profile-scoped single-instance lock, and
DesktopClerk.configurequits when it isn't the primary instance. On the shared dev profile, the second process would likely exit during startup. - Preview logins. Preview partitions live inside the profile, but preview IPC scopes them by environment id, so a fresh worktree doesn't automatically reuse another worktree's preview logins. The cookies are still stored in the shared profile, though.
Likely fix area
resolveUserDataPath in the desktop app, development branch only. Some options:
- Put the dev profile under the state dir, as you suggested (
path.join(stateDir, "electron"), which is~/.t3/dev/electronwith noT3CODE_HOME). That would follow--home-dirand be removed with the worktree. The trade-off is a one-time fresh dev profile (including Clerk sign-in), and the legacyT3 Code (Dev)fallback would need handling so existing machines don't keep sharing it. - A bundle-id-based folder name, which wouldn't follow
--home-dirand would leave folders behind after worktrees are deleted.
Packaged profiles (#12480) and the t3code-dev://app scheme, which Clerk allowlists depend on, would likely stay as they are either way.
A maintainer will decide on the fix direction.