Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Saved connections no longer decrypt on Linux and macOS after the Alpha → Beta rename #20906

Closedjeprecated(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. On Linux with a keyring backend (here gnome-libsecret), use a stable desktop build from before #20032 with at least one saved connection, so ~/.t3/userdata/connection-catalog.json exists.
  2. Update to a build that includes #20032 (0.1.0, or main at 2fae0f9841) and launch it.

Expected behavior

The existing connection catalog decrypts. Environments, projects and threads appear as before the update.

Actual behavior

The sidebar shows no environments or projects and offers "Add a project to start". Every catalog read fails with DesktopConnectionCatalogStoreProtectionError during decrypt-catalog. The server database is intact.

Cause: on Linux and macOS, Electron's safeStorage key is stored under the app name Chromium reads during startup, in ElectronBrowserMainParts::PostCreateMainMessageLoop (Linux keyring application attribute; macOS Keychain item <name> Safe Storage). At that point the name is still the packaged productName, which Electron's lib/browser/init.ts sets. The desktop's own app.setName in DesktopAppIdentity.configure runs only after startup has yielded, so it does not affect the key. #20032 changed productName from T3 Code (Alpha) to T3 Code (Beta), so 0.1.0 looks up a different key and creates a new one. The catalog encrypted under T3 Code (Alpha) no longer decrypts.

Confirmed on Linux with headless Electron 44.5.1 and an isolated profile against a copy of the affected catalog:

  • Starting under T3 Code (Beta) (as 0.1.0 does): decryption fails.
  • Starting under T3 Code (Alpha): decryption succeeds.
  • T3 Code Alpha (the post-ready runtime name since #17264) also fails, so the parenthesized pre-ready name is the key identity.

Scope by platform and channel, from the Electron 44.5.1 source and the build script:

  • macOS stable: very likely affected, because the Keychain service name derives from the same name. I have not reproduced this on a Mac.
  • Nightly: not affected, because it has always been packaged as T3 Code (Nightly).
  • Windows: not affected by this rename, because its key is in the t3code-v2 profile's Local State. The Windows catalog failures in #15001 and #8341 are a different cause.

The same key also protects the legacy saved-environment secrets and Chromium's cookie store, so those are affected as well.

Related but distinct: #20103 (macOS relaunch failure from the same productName change).

Installs that started fresh on 0.1.0, or that saved a new catalog after the failure, now hold data under the T3 Code (Beta) key. A fix that pins the old name needs to migrate those catalogs too.

Impact

Blocks work completely

Version or commit

0.1.0; main @ 2fae0f9841

Environment

NixOS (Linux 7.1), Niri (Wayland), gnome-libsecret, Electron 44.5.1

Logs or stack traces

DesktopConnectionCatalogStoreProtectionError: Desktop connection catalog protection failed during decrypt-catalog at ~/.t3/userdata/connection-catalog.json.

Workaround

Run a build whose packaged productName is still T3 Code (Alpha), for example 0.0.45. Do not clear the catalog: it still decrypts under the old name.


Investigated and written with Claude Opus 5.5 in Claude Code.

  1. I have a fix ready on my fork and will open a PR once this issue is triaged: https://github.com/pingdotgg/t3code/compare/main...jeprecated:t3code:t3/stabilize-catalog-encryption-identity

    The commit is based on main at 2fae0f9841. It does two things:

    • Fixed key name. On Linux and macOS, the app sets its safeStorage name before startup first yields. The name is what each channel shipped with: T3 Code (Alpha), or T3 Code (Nightly) for nightly. It no longer depends on productName. The branded runtime name is still applied after that, as it is today. Windows is unchanged.
    • Migration. If a catalog fails to decrypt, the app tries the T3 Code (Beta) key using the existing browser-import key readers (the libsecret helper on Linux, the Keychain reader on macOS). It accepts the result only if it decodes as a catalog, then re-encrypts it under the fixed name. If nothing decrypts, the error is the same as before and the file is left untouched.

    Verification so far:

    • Focused tests for the store, the pre-ready startup step, and the new identity module.
    • On Linux with headless Electron 44.5.1, my real keyring, and isolated profiles:
      • A catalog written under T3 Code (Beta) was recovered and re-encrypted. The next launch decrypted it natively.
      • A copy of an affected T3 Code (Alpha) catalog decrypted natively and was not rewritten.

    macOS is not tested on real hardware yet.

  2. Note

    Grok responding on behalf of Julius.

    This is a regression in 0.1.0, and the code matches your diagnosis.

    • #20032 changed productName in apps/desktop/package.json from T3 Code (Alpha) to T3 Code (Beta). Stable builds get their packaged name from that field (resolveDesktopProductName in scripts/build-desktop-artifact.ts). v0.1.0 is the #20032 merge commit, 81493efb.
    • DesktopAppIdentity.configure sets the runtime name to ${baseName} ${stageLabel}, with no parentheses (apps/desktop/src/app/DesktopAppIdentity.ts). DesktopApp.ts first calls it after several earlier startup steps, before whenReady.
    • Nothing on main pins the old safe-storage name or re-encrypts connection-catalog.json. The only T3 Code (Alpha) reference in desktop code is the legacy userData folder move in DesktopUserData.ts. No open PR covers this: #17311 and #20152 are about async safe storage and Windows profile keys.

    I haven't verified the Electron internals (when Chromium reads the name for the keyring and Keychain), so that part rests on your headless repro.

    Per your testing: don't delete or reset ~/.t3/userdata/connection-catalog.json. It still decrypts under the old name, and a 0.0.45 build can read it.

  3. juliusmarminge added labelsaccepted

  4. juliusmarminge added labelsbug

  5. juliusmarminge added labelsvia-triage

  6. juliusmarminge closed this

Sign in to join this conversation.