Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): recover connection catalogs after safeStorage key loss #23476

Mergedjuliusmarmingemerged 10 commits intomain fromrefs/pull/23476/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

juliusmarmingecommented

Problem

When Electron loses the safeStorage key, every desktop connection-catalog read rejects and blocks listing or adding environments. An undecryptable catalog reproduces the failure through the real renderer IPC on Linux; the report describes Windows key loss.

Change

Preserve the encrypted snapshot in a deterministic .undecryptable backup before returning an empty catalog and logging a warning. The next save encrypts a fresh catalog normally. Backup failure still rejects the read, and backing up the snapshot preserves the original ciphertext across concurrent saves. The envelope and IPC contracts remain unchanged.

Scope and approval

Fixes https://git.cafe/pingdotgg/t3code/issues/8341 GitCafe: https://git.cafe/pingdotgg/t3code/issues/8341 Triaged bug via the automated issue flow; issue and reproduction. This only changes native desktop catalog recovery, with focused regression tests and a committed native fixture.

Verification

Independent proof audit: SUFFICIENT at 248ab74, including a separate native replay matching every recovery and reload result row. The subsequent diagnostic fix only classifies backup-write errors, removes raw error text from warning annotations, and strengthens the failure test; recovery and backup contents are unchanged. All seven focused tests, targeted lint/format and desktop typecheck passed again after that fix.

  • Focused catalog suite: 7 passed. The lost-key regression fails on the original base with decrypt-catalog; a deterministic concurrent-save regression catches replacement of the original backup. Preservation failure leaves the catalog intact.
  • vp run check:changed: format, lint, desktop typecheck and all seven tests passed. The standalone fixture was then registered in Knip and vp run knip:check passed both files/dependencies and scoped exports checks.
  • Real Electron 44.9.3, Linux x64, Xvfb and isolated gnome_libsecret: empty recovery, exactly one backup across repeated/concurrent reads, identical ciphertext, encrypted save verified with actual safeStorage, and successful fresh-process reload.
EvidenceBeforeAfter
Native IPCOriginal base 3b95e7831b: decrypt-catalog rejectionHead 248ab74fbd: recovery, save and fresh reload
RegressionRED outputSeven passing focused tests on the final branch

Final evidence index, results, provenance and fixture matrix. The visual matrix is empty because no render path changed. Backup JSON is normalized; ciphertext is preserved, rather than arbitrary JSON formatting. Original RED uses the historical base module in isolation, not a full historical checkout.

Unverified: native Windows DPAPI/Local State/profile reset, macOS Keychain reset, and the actual reconnect UI/account-backed connection. Linux exercises the shared recovery branch; backup-write failure is covered by the focused test only.

Implemented with Claude Opus 5.5 and GPT-6.1-Sol through T3 Code using the Claude Agent and Codex harnesses.

Fixes pingdotgg/t3code#8341

Sign in to join this conversation.