fix(desktop): keep startup responsive with a locked Linux keyring #23823
main fromrefs/pull/23823/head·opened View on GitHubProblem#
Starting the Linux desktop with its native credential store locked can block Electron's main process in synchronous safe-storage calls. The app stalls at its splash or an empty window while waiting for the store to unlock.
Change#
Use Electron's asynchronous safe-storage provider for availability, encryption, and decryption, retaining the existing synchronous fallback when async storage is unavailable. Reject Linux async ciphertext with Chromium’s fixed-key v10 prefix before persistence, including when a cancelled keyring prompt leaves the selected backend named gnome_libsecret. On Linux, preserve refusal to store credentials with the plaintext basic_text backend, whose async availability differs from the synchronous API. Reuse the implementation from #17311, with a Linux regression test that keeps the async keyring pending and verifies that synchronous calls are not made.
Scope and approval#
Fixes https://github.com/pingdotgg/t3code/issues/9239
Triaged bug via the automated issue flow.
Verification#
- Regression test on main: one failed, two passed; the failure is
availability must wait for the keyring. - After the fix and merge from main: three focused suites, 13 tests passed (
ElectronSafeStorage,DesktopConnectionCatalogStore,DesktopSavedEnvironments). - The native
basic_textregression test failed before the backend guard (expected true to be false) and passes after it. - Desktop typecheck and touched-file lint passed.
Evidence#
Real Electron 44.9.3 on Linux/Xvfb/Openbox, real GNOME libsecret and native unlock prompt, private D-Bus/XDG/T3 state, disposable authenticated loopback target. Before: 044f07257c. After: fdee11371a.
The locked baseline main-process query timed out after 10 seconds. The corrected build answered in 26 ms, resized in 64 ms, and opened its native menu in 212 ms, with ciphertext unchanged. Explicit unlock and reload restored the saved connection. A label save and its credential survived restart. Legacy bearer credentials migrated and connected; SSH and no-token fixtures checked migration shape only. Existing-catalog and pristine basic_text saves both returned false; existing ciphertext was unchanged and no new file was created.
Locked/unlock/save/restart recording. Complete evidence matrix, timed recordings, runtime transcript and visible differences. Safe artifact index.

Whole-framebuffer captures are 1440×1000, DPR/font scale 1. Wide native bounds are 1439×999; a 390×780 request is constrained to the native minimum 840×780. Four settled empty-onboarding pairs have zero differing RGB pixels. Diff0 below is amplified ×8; DiffT uses maximum channel difference >8/255.
| Fixture | Before | After | Diff0 ×8 | DiffT |
|---|---|---|---|---|
| light, 1440 | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
| light, 390-attempt | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
| dark, 1440 | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
| dark, 390-attempt | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
What else changed: none in those four settled image pairs. With the keyring locked, the runtime changes from a blocked splash to the existing responsive connection-recovery view. Cancellation preserves ciphertext and responsiveness, but the first restart still showed “Still connecting.” A separate completed native unlock, cold restart and explicit reload restored the connection; automatic recovery is not established.
Unverified: native macOS, Windows, KWallet, Niri/Wayland, and native async-unavailable fallback branches. The fallback branches have focused mocked coverage. The native window cannot reach 390 px width.
Independent proof audit: bounded Linux proof sufficient. Reproduction from the committed seeder confirmed responsiveness, connection, save and restart; after matching the local port, the independent capture had zero differing pixels.
Empty-state supplement: both builds started without a catalog or legacy registry, added the disposable target through the visible pairing-link form, persisted a protected catalog, and reconnected after cold restart without credential entry. Before recording, after recording, timestamps, observations and differences. Only the pairing-secret input is redacted during entry. Both matched added/restarted pairs have zero differing pixels.
| Empty-state fixture, light, 1440×1000 framebuffer | Before | After | Diff0 ×8 | DiffT >8/255 |
|---|---|---|---|---|
| Added target | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
| Cold restart | ![]() 044f07257c | ![]() fdee11371a | ![]() | ![]() |
Supplemental N2 proof audit: sufficient for the Linux empty-state pairing/save/restart flow.
Follow-up validation at 386a88ddd8: the cancelled-keyring fallback regression failed before the output guard and passes after it. Three focused suites pass (13 tests); desktop typecheck, changed-file format/lint, and desktop-scoped Knip pass. The manual reproduction script is registered as a Knip entry point.
The broader captures above are explicitly from the earlier async-storage head. The final guard was separately rebuilt and checked against the real catalog IPC: cancelling the GNOME prompt rejects new encryption with the typed protection error before persistence, leaving existing catalog ciphertext unchanged.
Final-head native index and exact bundle provenance. Before recording: cancel and save. After recording: cancel and refuse.
The before recording ran a0dc6d6410; its desktop binary is identical to 97d8e3e6cc, which differs only in the regression test. The after binary is built from committed 386a88ddd8. The actual registered catalog IPC handler was invoked through the main inspector with a synthetic sender, not a Settings click. Captions report measured IPC/file results, not product UI. Unlocked GNOME still produced protected v11 storage, round-tripped, and decrypted after a full app/backend restart.
| Cancel/save boundary, light, 1280×900 X framebuffer plus 120 px diagnostic caption; app 1100×780 | Before | After | Diff0 ×8 | DiffT >8/255 |
|---|---|---|---|---|
| Real GNOME prompt and catalog IPC | ![]() a0dc6d6410 | ![]() 386a88ddd8 | ![]() | ![]() |
These separately timed stills include visible differences beyond the encryption outcome: the native prompt moves from centre to top-left, the sampled blank renderer becomes the existing Still connecting/Reload view, pointer and active-window chrome differ, and diagnostic captions differ. No UI rendering code changed in this follow-up. Across the complete 1280×1020 images, 175,865 pixels differ; 91,761 exceed 8/255. No pixel-identity claim applies to this supplemental pair.
Current-head guard proof audit: sufficient. An independent byte-identical rebuild repeated native cancellation, typed refusal and catalog preservation. Its pending-prompt image differed only in 253 pointer pixels; no zero-delta claim is made for that recapture.
Test-only follow-up cb12fd5c1c: assert typed encrypt/decrypt failures on basic_text; focused safe-storage suite 5/5, touched-file format and lint passed. Production code is unchanged from the native-audited 386a88ddd8.
Fixture-script follow-up c57ec9cc4c: select a usable Node inspector target and reject blank, relative, padded, and real-default XDG paths while preserving disposable sibling layouts. Syntax, format, lint, and mocked-inspector checks passed. Product code remains identical to the native-audited head.
Fixture path-identity follow-up df5340d3e5: canonicalize existing ancestors to reject symlink aliases of live T3/XDG defaults. Fourteen disposable mocked-inspector cases, syntax, format, and lint passed. The path walk is O(n²) in path length in the worst case; a synthetic 3,000-component missing path completed in 46 ms. Product code and native proof are unchanged.
Models and harness: GPT-6.1 Sol and Claude Opus 5.5 through T3 Code with Codex and Claude Code.
- 1
- 2
Pushed1152ad6
juliusmarminge closed this
Sign in to join this conversation.




























Thanks for this. #35065 makes the same change and is the one being kept.
#35065 addresses the same locked-keyring startup freeze while removing synchronous calls from the Linux path entirely. That avoids retaining a fallback to the calls responsible for the freeze and keeps the behavior change confined to Linux.
Your cancellation finding and fixed-key ciphertext guard remain important parts of the solution. The replacement also checks actual keyring-backed ciphertext when reporting encryption availability, so it does not advertise insecure fallback storage as usable.
Closing as a duplicate.