Repository navigation
Fix account switching causing data loss and forced re-onboarding after re-login #983
Copy link
Copy link
Closed
Copy link
Labels
auth-onboardingLogin, session, onboarding, invites, and first-run UX.Login, session, onboarding, invites, and first-run UX.config-workspaceConfig loading, env overrides, workspace storage, and app state.Config loading, env overrides, workspace storage, and app state.react-uiReact app work in app/src: pages, components, providers, store, and UX.React app work in app/src: pages, components, providers, store, and UX.taskWork item that is not primarily a bug or a feature.Work item that is not primarily a bug or a feature.
Description
Summary
Fix account switching/session persistence bug where logging out, logging into another account, then returning to the first account causes full re-onboarding and loss of prior chat/login/connection data.
Problem
When a user:
- logs out of account 1,
- logs into account 2,
- logs back into account 1,
the app treats account 1 like a fresh user and sends them through the full onboarding/login flow again. Existing account 1 data appears missing, including:
- chat history
- login/session state
- connected integrations / connection data
Expected Behavior
- Returning to account 1 should restore account 1 state.
- Existing chat history should remain available.
- Connected integrations should remain linked.
- User should not be forced through full onboarding again unless account truly has no onboarding state.
Scope
- Reproduce logout/account-switch/account-return flow.
- Audit account-scoped storage and persisted state keys.
- Ensure chat data, login data, onboarding completion, and connection data are scoped per account/user ID.
- Fix any state reset/clear logic that wipes all accounts instead of active account/session only.
- Rehydrate correct account state after login.
- Add safeguards to prevent cross-account data leakage while preserving each account's own data.
- Add logs for account switch, state clear, and state restore operations.
Acceptance Criteria
- Account 1 data is restored after switching to account 2 and back.
- User is not re-onboarded if account 1 already completed onboarding.
- Chat history and integrations remain attached to the correct account.
- Logging out does not delete persistent account data unless explicitly requested.
- No cross-account data leakage occurs.
- Tests cover account switch and re-login persistence behavior.
Metadata
Metadata
Assignees
Labels
auth-onboardingLogin, session, onboarding, invites, and first-run UX.Login, session, onboarding, invites, and first-run UX.config-workspaceConfig loading, env overrides, workspace storage, and app state.Config loading, env overrides, workspace storage, and app state.react-uiReact app work in app/src: pages, components, providers, store, and UX.React app work in app/src: pages, components, providers, store, and UX.taskWork item that is not primarily a bug or a feature.Work item that is not primarily a bug or a feature.
Type
Projects
- StatusShow more project fieldsDone
Activity
Al629176 commentedon Apr 27, 2026
Linked to parent issue #972.
fix: resolve account switching data loss and state leakage
fix: resolve account switching data loss and leakage issues
fix: resolve account switching data loss and leakage issues
[-]Fix account switching: data loss and forced re-onboarding after re-login[/-][+][Bug] Fix account switching causing data loss and forced re-onboarding after re-login[/+][-][Bug] Fix account switching causing data loss and forced re-onboarding after re-login[/-][+]Fix account switching causing data loss and forced re-onboarding after re-login[/+]YellowSnnowmann commentedon May 5, 2026
The issue has already been fixed and no further updation is needed for this issue. Tested it end to end!
When I tested it end to end, the messages and connections persists for account 1.
fix(auth): scope clearAllAppData to active user and drop non-existent…
fix(flows): scope copilot thread-id localStorage keys to the active u…