Skip to content

fix: persist auth session across app updates#3138

Merged
yujonglee merged 2 commits intomainfrom
devin/1768579099-persist-session-on-update
Jan 17, 2026
Merged

fix: persist auth session across app updates#3138
yujonglee merged 2 commits intomainfrom
devin/1768579099-persist-session-on-update

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 16, 2026

Summary

Fixes the issue where users are forced to log out when the desktop app is updated. The root cause is that the app process can be killed during update installation before the store is saved, causing auth session data to be lost.

Changes:

  1. Save store before update install (plugins/updater2/src/ext.rs): Added store.save() call immediately before update.install() to ensure all store data (including auth tokens) is persisted before the update process terminates the app.

  2. Persist onboarding state immediately (apps/desktop/src-tauri/src/ext.rs): Added save() calls to set_onboarding_needed and set_onboarding_local functions to match the pattern used by other setter functions.

The primary fix is #1 - when update.install() is called, it immediately kills the app process on some platforms (especially macOS), so any pending saves would be lost. By explicitly saving the store before installation, we ensure auth tokens survive the update.

Review & Testing Checklist for Human

  • Test update flow end-to-end: Install a version without this fix, sign in, then update to a version with this fix and verify the session persists (user stays logged in)
  • Verify on macOS: macOS is more aggressive about killing processes during updates - test specifically on this platform
  • Check interaction with PR fix: prevent auth lock timeout race conditions #3111: If merging both PRs, verify they don't conflict (PR fix: prevent auth lock timeout race conditions #3111 addresses auth lock timeout race conditions, which is a separate issue)
  • Verify store.save() is synchronous: Confirm the save completes before update.install() terminates the process

Recommended test plan:

  1. Build and install a version of the app without this fix
  2. Sign in with a Supabase account
  3. Trigger an update to a version with this fix
  4. After update completes, verify the user is still logged in (not shown onboarding/login screen)

Notes

  • The updater2 fix saves the entire store, which includes all scoped data (auth tokens, settings, etc.)
  • Related: PR fix: prevent auth lock timeout race conditions #3111 addresses auth lock timeout race conditions - that's a separate issue from session persistence on updates
  • I was unable to test the actual update flow to confirm this resolves the reported issue

Link to Devin run: https://app.devin.ai/sessions/4d33812e4f4a46db8e63e6d396e779b3
Requested by: @ComputelessComputer

…updates

Add save() calls to set_onboarding_needed and set_onboarding_local functions
to ensure the onboarding state is persisted to disk immediately after being set.

Previously, these functions did not call save() after setting the value, which
meant the state might not be persisted if the app was killed (e.g., during an
update) before the store was saved elsewhere. This could cause users to see
the onboarding screen after an update, making them think they were logged out.

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 16, 2026

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit 15525a6
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/696aeeaf23bafe00087f513a
😎 Deploy Preview https://deploy-preview-3138--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 16, 2026

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 15525a6
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/696aeeaf2f52dc0008f7efb5
😎 Deploy Preview https://deploy-preview-3138--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 16, 2026

Deploy Preview for howto-fix-macos-audio-selection ready!

Name Link
🔨 Latest commit 15525a6
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/696aeeaf12ecf60008b9c09d
😎 Deploy Preview https://deploy-preview-3138--howto-fix-macos-audio-selection.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
@devin-ai-integration devin-ai-integration bot changed the title fix: persist onboarding state immediately to prevent session loss on updates fix: persist auth session across app updates Jan 17, 2026
@yujonglee yujonglee merged commit 93ec2f2 into main Jan 17, 2026
22 of 23 checks passed
@yujonglee yujonglee deleted the devin/1768579099-persist-session-on-update branch January 17, 2026 02:48
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.

2 participants

Comments