Fixes pingdotgg/t3code#9239.
What Changed#
ElectronSafeStorage now uses Electron's promise-based encryptStringAsync / decryptStringAsync instead of the blocking isEncryptionAvailable / encryptString / decryptString, and gives up on a call the credential store leaves unanswered for 30 seconds.
- Availability is answered by encrypting a throwaway probe string, because the dedicated availability call is synchronous in Electron 42 and promise-based in 43; encrypting resolves the same way on both.
- Runtimes without the async calls (Electron below 42) keep the blocking ones, so nothing changes there.
- On Linux the
basic_text backend still counts as unavailable, matching what the blocking API reported: credentials go into a real keyring or nowhere, never under Chromium's hardcoded password.
- The connection-catalog legacy migration now reads the legacy registry before it asks whether encryption is available, so a fresh install never waits on the keyring at all.
- New
ElectronSafeStorage tests cover the async path, the deadline, the basic_text refusal and the blocking fallback; a new catalog-store test pins the "nothing to migrate, don't touch the keyring" path.
Why#
safeStorage.isEncryptionAvailable() and friends run the OS credential-store lookup on the main thread. With GNOME Keyring, KWallet or KeePassXC locked, that lookup never returns, so the main process stops pumping its message loop. The desktop app hits this on the boot path — the renderer asks for the connection catalog as soon as it starts — which is exactly the reported symptom: a black window that cannot be resized, with no unlock prompt and no error.
The async calls resolve off the main thread, so a locked store now leaves the window responsive and the app usable; credential-backed features degrade instead of freezing everything, and the warning naming the selected backend lands in the desktop log. Nothing is cached, so a store the user unlocks later starts working on the next call rather than needing a restart. The 30 second deadline is deliberately generous: it is long enough for someone to answer an unlock prompt, since giving up early would hide the environments they just unlocked for.
Verified with vp test run apps/desktop/src (58 files, 449 tests), plus targeted typecheck, lint and format for the touched files.
UI Changes#
None.
Checklist#
🤖 Generated with Claude Code
https://claude.ai/code/session_01CSYNeCmmbXoG5YETHpo1Md
Generated by Claude Code
Note
Medium Risk
Changes credential-store and connection-catalog startup behavior on Linux, but adds timeouts and graceful degradation rather than indefinite blocking; encrypt/decrypt semantics are preserved with explicit fallbacks.
Overview
Fixes a blank, frozen desktop window when Linux keyring integration blocks on startup by moving credential-store work off the main thread and not probing encryption when there is nothing to migrate.
ElectronSafeStorage prefers Electron’s encryptStringAsync / decryptStringAsync (when present) with a 30s deadline, so a locked OS credential store no longer hangs the main process indefinitely. Encryption availability on that path is determined by a probe encrypt (works across Electron 42/43 API differences) instead of blocking isEncryptionAvailable. Linux basic_text is still treated as unavailable; older Electron without async APIs keeps the blocking fallback.
DesktopConnectionCatalogStore legacy migration now reads the saved-environment registry first and only then checks encryption, so fresh installs skip keyring access on boot.
New tests cover async safe storage (deadlines, basic_text, fallback) and the catalog path that must not touch the credential store when the registry is empty.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 36c1de7ebbaf941f643f4f8c758014cc34e9cfbf. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
Note
Fix blank window on Linux by adding 30s timeout and async support to ElectronSafeStorage#
- When Electron's promise-based
encryptString/decryptString APIs are available, ElectronSafeStorage.make uses them instead of the blocking synchronous calls, applying a 30-second deadline that converts unanswered requests into typed ElectronSafeStorageEncryptError failures or false availability.
- Treats the Linux
basic_text backend as unavailable and skips the encryption probe for it, so a locked credential store no longer blocks startup.
- Reorders the
DesktopConnectionCatalogStore.make migration to read the legacy registry before evaluating secure-storage availability, so empty registries never trigger an encryption check.
- Runtimes without both async methods retain the existing synchronous encrypt/decrypt/availability path.
- Risk: the new 30-second deadline in ElectronSafeStorage.ts means any async call that takes longer than 30s fails instead of hanging; callers in
DesktopConnectionCatalogStore must handle the resulting error or false availability.
Macroscope summarized 36c1de7.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed