fix(desktop): skip unreadable legacy credentials during migration
Problem
A single legacy bearer credential that Electron safe storage can no longer decode or decrypt aborts the entire desktop connection catalog migration. That makes Connections unavailable and blocks unrelated work such as adding an SSH host even though the saved connection metadata is still valid.
Fixes #4991.
Fix
Per-credential decode and protection failures now log a warning and omit only the unreadable credential. The target and profile still migrate, the rest of the catalog is persisted, and global registry read or decode failures remain fatal.
The legacy registry and encrypted secret are left untouched. The affected connection can be authenticated again without blocking SSH, relay, or other saved connections.
Validation
vp test run apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts— 10 passed- targeted type-aware lint and typecheck on both changed files
- targeted format check and
git diff --check - read-only reviews with Claude Opus 5 and Grok 4.5
No UI changed, so screenshots do not apply.
Implemented with Codex (GPT-5) in the Codex desktop app.
[!NOTE]
Skip unreadable legacy credentials during desktop connection catalog migration
- In
migrateSavedEnvironmentRecords, decryption errors (DesktopSavedEnvironmentSecretDecodeError,DesktopSavedEnvironmentSecretProtectionError) are now caught and logged as warnings instead of failing the migration.- When a legacy credential is unreadable, migration continues and still creates the connection target and profile, but omits the credential for that environment.
- Adds a test in DesktopConnectionCatalogStore.test.ts that injects a
failDecryptref to simulate decryption failures and asserts the above behavior.- Behavioral Change: Previously, an unreadable legacy credential would abort migration entirely; now it is silently skipped with a warning log.
Macroscope summarized 8ef459e.
[!NOTE] Low Risk Localized desktop migration behavior with no auth or data-model changes beyond omitting unusable credentials; global migration failures are unchanged.
Overview Legacy connection catalog migration no longer fails when Electron safe storage cannot decrypt a single bearer token. In
migrateSavedEnvironmentRecords,getSecreterrors taggedDesktopSavedEnvironmentSecretDecodeErrororDesktopSavedEnvironmentSecretProtectionErrorare caught, logged as warnings, and treated as missing credentials instead of aborting migration.Bearer targets and profiles still migrate for those environments so users can re-authenticate; only the unreadable credential is omitted. Registry-wide read/decode failures remain fatal.
A test exercises this by toggling a
failDecryptflag on the mock safe storage during catalog read.Reviewed by Cursor Bugbot for commit 8ef459ee71879c82516abb4b9017000652a8caed. Bugbot is set up for automated code reviews on this repo. Configure here.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
96c116b4-3942-453b-b315-7ccec204b71eYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved 8ef459e
Straightforward bug fix that adds defensive error handling during credential migration. When a legacy credential is unreadable, it now logs a warning and continues migration rather than failing, preserving connection metadata so users can re-authenticate. Limited scope with proper test coverage.
You can customize Macroscope's approvability policy. Learn more.