Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): treat an undecryptable connection catalog as empty instead of crashing environment discovery #4454

Closedbwmp(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/4454/headopened View on GitHub

This doesnt need to be merged but implementing your own fix to this would be appreciated since this issue caused my entire t3 code to be unusable no matter what

What Changed

DesktopConnectionCatalogStore.get() now treats an undecryptable or corrupt connection-catalog.json as an empty catalog (logs a warning, returns Option.none()) instead of propagating the failure. The file is left on disk untouched, so if the underlying issue resolves, a later read can still recover the original data.

Why

EnvironmentRegistry.make reads this store synchronously during its own construction. A decrypt failure — e.g. a stale OS-level encryption key after a Windows credential/profile change — previously threw all the way up through that construction, silently breaking the entire connection/environment registry with no console-visible error. This took down the local primary environment too, even though it doesn't depend on this file at all, and looked to the user like "the app just doesn't load projects" with nothing indicating why.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk Changes startup behavior for encrypted catalog I/O—failures are swallowed instead of surfacing errors—which is intentional for resilience but could briefly hide corrupt catalogs until logs are checked.

Overview DesktopConnectionCatalogStore.get no longer fails when connection-catalog.json cannot be decoded or decrypted. Those cases now log a warning, return Option.none() (empty catalog), and leave the file on disk so data can be recovered once decryption works again.

This avoids a hard failure during environment registry construction that could make the desktop app look like it cannot load projects—including the local primary environment—even when that catalog file is not required.

Tests were updated to expect graceful degradation (including recovery after decrypt succeeds again). A separate fork-only scheduled workflow merges upstream into main for bwmp/t3code.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8a3eb0df42c452109f5bd1101ee2acf54ee1d28c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Treat undecryptable connection catalog as empty instead of crashing environment discovery

Previously, DesktopConnectionCatalogStore.get propagated failures when the encrypted catalog was malformed or could no longer be decrypted, crashing environment discovery. It now catches those errors, logs a warning with the catalog path and cause, and returns Option.none while leaving the file on disk intact. This means a recoverable catalog (e.g. after re-authentication) can still be read later.

Macroscope summarized 8a3eb0d.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: bf6946bc-599b-4342-9405-e40212ce1b49

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. @@ -491,5 +506,7 @@
      491506 ),
      492507 ),
      493508 ),
      509+ Effect.map(Option.some<string>),
      510+ Effect.catch(treatAsUnreadableCatalog),
      494511 );
      495- return Option.some(decrypted);
      512+ return decrypted;

      Recoverable catalog can be overwritten

      High Severity

      The get method now returns Option.none() for both missing and undecryptable catalogs, making them indistinguishable. This ambiguity causes subsequent set operations, such as automatic credential persistence, to overwrite the existing encrypted catalog, destroying data intended for recovery.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e48246490c79a1fb8d1d6ea7d397714b87a79dd6. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      A high-severity unresolved review comment identifies potential data loss: returning Option.none() for undecryptable catalogs (same as missing) could cause subsequent writes to overwrite recoverable encrypted data. This behavioral change and the flagged bug warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8a3eb0df42c452109f5bd1101ee2acf54ee1d28c. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +4,21 @@
      4+ schedule:
      5+ # Every day at 06:00 UTC
      6+ - cron: "0 6 * * *"
      7+ workflow_dispatch:
      8+
      9+permissions:
      10+ contents: write
      11+
      12+jobs:
      13+ sync:
      14+ # Only run on the fork, not on upstream or other forks
      15+ if: github.repository == 'bwmp/t3code'
      16+ runs-on: ubuntu-latest
      17+ steps:
      18+ - name: Merge upstream into main
      19+ env:
      20+ GH_TOKEN: ${{ github.token }}
      21+ run: |
      22+ set -euo pipefail
      23+ response=$(gh api "repos/${{ github.repository }}/merge-upstream" \
      24+ -f branch=main 2>&1) || {

      Sync fails on workflow changes

      Medium Severity

      merge-upstream is authenticated with github.token, which cannot create or update files under .github/workflows/. Whenever upstream changes any workflow, the sync fails with a missing workflow scope error. That permission cannot be granted via the permissions key; a PAT (or GitHub App token) with workflow access is required.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8a3eb0df42c452109f5bd1101ee2acf54ee1d28c. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.