GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — fix(desktop): Niri/Hyprland - Linux secret storage backend by mwolson · Pull Request #2916 · pingdotgg/t3code Conversation
|
| Problem and Why it Happened | Fix |
|---|---|
Electron 41 can fall back to basic_text on Linux sessions such as Niri or Hyprland, because the desktop name is not one of Electron's recognized backend selectors. |
Resolve a Linux password-store switch before app.ready, forcing gnome-libsecret for any session Electron would otherwise leave on basic_text. Sessions Electron does recognize, KDE included, keep the backend it selects for them. |
| The desktop app did not have a pre-ready settings path for a user-selected Linux password-store override. | Read the persisted linuxPasswordStore setting synchronously during early Electron startup, with unsupported values normalized to auto without dropping unrelated settings. |
| AppImage sessions can start without the session bus and desktop environment variables needed by Linux secret stores. | Hydrate Linux session environment values from the login shell before re-resolving the runtime password-store switch. |
| Problem and Why it Happened | Fix |
|---|---|
Upstream no longer registers privileged custom protocol schemes before ready; Electron requires that registration synchronously at bootstrap. |
Add ElectronProtocol.layerSchemePrivileges for both t3code and t3code-dev, then acquire the complete pre-ready layer before Clerk or the broader desktop runtime can build. |
| Safe-storage failures were hard to diagnose on Linux. | Log the configured password-store decision before ready and the selected backend after ready, without probing keyring availability during startup. |
Before this change, main.ts built the desktop runtime directly from the Clerk layer. Linux password-store selection and privileged scheme registration did not happen before app.ready, and DesktopApp.startup only applied a WM class switch after shell hydration:
DesktopApp.program
│
▼
desktopClerkLayer
│
▼
desktopApplicationLayer + electronLayer + Node/HTTP services
│
▼
DesktopApp.startup
├─ shellEnvironment.installIntoProcess
├─ append Linux WM class switch (no password-store selection)
├─ clerk.configure → whenReady
└─ bootstrap
After this change, main.ts acquires all pre-ready Electron setup before Clerk can build. Clerk then resolves the user-data path and creates its bridge, after which the broader desktop runtime and DesktopApp.startup can proceed:
DesktopApp.program
│
▼
desktopElectronPreReadyLayer
├─ ElectronProtocol.layerSchemePrivileges
│ └─ register t3code + t3code-dev before ready
└─ configureElectronBeforeReady
├─ read existing --password-store
├─ read early Linux settings from desktop-settings.json
├─ append pre-ready switches (class, password-store)
└─ provide DesktopPreReadyElectronOptions
│
│ strict pre-ready barrier
▼
desktopClerkLayer
├─ resolve userData path
└─ create Clerk bridge and acquire the single-instance lock
│
▼
desktopApplicationRuntimeLayer
│
▼
DesktopApp.startup
├─ shellEnvironment.installIntoProcess
├─ re-resolve password-store if shell changed XDG_* / DBUS
├─ clerk.configure → whenReady
└─ log selected safeStorage backend
auto does, and what it deliberately does notauto answers one question: will Electron select a real keyring on its own? Only an exact XDG_CURRENT_DESKTOP literal proves that, because Chromium matches those case-sensitively and returns on the first value it recognizes. KDE and the libsecret desktops are left alone; LXQt is recognized by Chromium but still mapped to basic text, so it is forced like an unknown session.
auto never selects a KWallet generation. Earlier revisions tried, and guessing one from KDE_SESSION_VERSION or a plasma* session name repeatedly picked a wallet service the session does not run. A KDE user who needs a specific generation sets linuxPasswordStore explicitly.
auto never guesses a KWallet generation itself. For canonical KDE sessions that Electron recognizes, T3 Code leaves password-store unset and relies on Electron's built-in detection to select the matching KWallet generation. Ambiguous legacy hints such as KDE_SESSION_VERSION or a plasma* session name are not trusted on their own because stale values repeatedly selected a wallet service the active session did not run. Those sessions use gnome-libsecret unless the user explicitly selects a KWallet generation with linuxPasswordStore.plasma* session name get gnome-libsecret rather than KWallet. On current Plasma, KWallet exposes the Secret Service API, so libsecret generally resolves; where it does not, it fails loudly rather than silently storing near-plaintext.process.env before login-shell hydration, and post-shell re-resolution in DesktopApp.startup covers the common AppImage case but not every desktop session ordering.| Topic | Why deferred |
|---|---|
Shell hydration clearing a forced pre-ready --password-store when re-resolution returns null |
Requires a contradictory login-shell profile (e.g. shell exports GNOME XDG_CURRENT_DESKTOP on a Niri session). Uncommon for target users; Bugbot thread replied, not blocking this fix. |
Unconditional DBus / XDG_RUNTIME_DIR override when launcher sets stale values |
AppImage edge cases; separate hardening from the core password-store selection path. |
Precedence among XDG_SESSION_DESKTOP, DESKTOP_SESSION, and GDMSESSION when they conflict |
None of them influence backend selection any more, so this only affects the wording of the failure notice. |
vp checkvp run typecheckvp run build:desktopvp run --filter @t3tools/desktop test on the current tip: 56 files, 437 testsauto was narrowed. The narrowing changes which switch that session receives only for KDE-identified sessions, and Niri resolves to gnome-libsecret on both revisions.Note
High Risk
Changes Electron startup ordering and Linux credential encryption backend selection before app.ready; mis-selection or stale env could leave secrets unencrypted or break persistence on Linux.
Overview
Fixes Linux sessions (e.g. Niri/Hyprland) where Electron would otherwise use weak basic_text for safeStorage, which breaks encrypted SSH credentials, the connection catalog, and Clerk-backed token storage.
Pre-ready bootstrap adds DesktopPreReadyPlatform so privileged t3code / t3code-dev scheme registration and Linux class + password-store switches run before Clerk or other async layers can reach app.ready. Persisted linuxPasswordStore is read synchronously from desktop-settings.json (JSONC), with auto forcing gnome-libsecret only when XDG_CURRENT_DESKTOP does not prove Electron will pick a real keyring (canonical KDE/GNOME/etc. stay on Electron defaults).
After login-shell hydration, startup re-reads early Linux options and can remove/re-append password-store when session env changes (typical AppImage case), respects an explicit CLI --password-store, and logs the chosen store plus safeStorage.getSelectedStorageBackend() on Linux.
Supporting changes: shared DesktopStatePaths (trimmed T3CODE_HOME treated as unset), ElectronApp.removeCommandLineSwitch, linuxSecretStorage heuristics and failure messaging, and broader Linux shell env hydration (DBUS_SESSION_BUS_ADDRESS, XDG_*, display/Wayland) with a runtime DBus bus path fallback.
Reviewed by Cursor Bugbot for commit 454eb3d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
password-store command-line switch on Linux, reading a persisted linuxPasswordStore setting from desktop-settings.json before Electron emits readyDesktopPreReadyElectronOptions to synchronously append class and password-store switches before any async layer can yield control, ensuring Electron sees the correct values at startupDBUS_SESSION_BUS_ADDRESS, DISPLAY, XDG_CURRENT_DESKTOP, XDG_RUNTIME_DIR, and Wayland/session vars; falls back to a derived DBUS bus path when the address is missingselectedStorageBackend to ElectronSafeStorage and removeCommandLineSwitch to ElectronApp to support querying and modifying Electron state at runtimeT3CODE_HOME values are now treated as unset, which changes whether the dev or userdata subdirectory is used for state storageMacroscope summarized 454eb3d.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review This PR introduces significant new capability for Linux secret storage backend selection, including new modules for desktop environment detection and pre-ready Electron configuration. The runtime behavior changes and scope of new logic warrant human review. There is also an unresolved review comment about dependency handling conventions. You can customize Macroscope's approvability policy. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
1ec83f0 to
57dcaa9
Compare
57dcaa9 to
9bf124e
Compare
There was an error while loading. Please reload this page.
c4ee8d6 to
5f02a0e
Compare
5f02a0e to
a8ab180
Compare
a8ab180 to
f38b824
Compare
f9c8c69 to
219f76d
Compare
219f76d to
7704609
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
aaf38e3 to
8b9ac1c
Compare
8b9ac1c to
b41cdaa
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
4768e63 to
437ede3
Compare
There was an error while loading. Please reload this page.
181617d to
890115d
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
One convention finding on the new DesktopPreReadyElectronOptions service module. Earlier findings (ElectronSafeStorage.make export, inline Context.Service interface) look resolved at this head.
Posted via Macroscope — Effect Service Conventions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
890115d to
76705b0
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 76705b0ea46e67942fb5799c2e371fe25b7eafbb. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Force gnome-libsecret before Electron is ready for Linux sessions Chromium does not recognize, so desktop SSH environment credentials and the encrypted connection catalog keep a real keyring instead of basic text. Sessions Electron does recognize, KDE included, keep the backend it selects for them.
76705b0 to
4f0e953
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
One finding: a service instance is threaded through a config record instead of being acquired from the Effect environment.
Posted via Macroscope — Effect Service Conventions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
## What's Changed * fix(desktop): Niri/Hyprland - Linux secret storage backend by @mwolson in pingdotgg/t3code#2916 **Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260803.986...v0.0.32-nightly.20260803.992 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260803.992
…#2916) (#78) Ported from upstream pingdotgg#2916 (6f04a5c). Chromium only selects a real keyring backend when XDG_CURRENT_DESKTOP matches a known desktop, so on Hyprland/Niri/Sway sessions Electron lands on basic_text and safeStorage reports encryption unavailable — pairing an environment fails with "Desktop secure storage is unavailable in this system context" even when GNOME Keyring is running. Force --password-store=gnome-libsecret pre-ready for sessions Electron would leave unprotected, honor an explicit linuxPasswordStore desktop setting and any user-provided --password-store switch, import session/dbus env from the login shell, and log the selected backend after ready. Fork adaptations: - rebranded identifiers (@t3tools -> @shuv2code, T3CODE_HOME -> SHUV2CODE_HOME, ~/.t3 -> ~/.shuv2code, t3code wm classes/messages) - kept this fork's scheme privileges and moved its existing synchronous registerDesktopSchemesAsPrivileged() call from main.ts into the new pre-ready layer instead of adding upstream's duplicate registration - dropped upstream's linuxApplicationsDir hunk (belongs to pingdotgg#2915, not merged here) Co-authored-by: Mike Olson <[email protected]>
Brings in 17 upstream commits (base e60821f). Headline changes: - Upgrade Effect to beta.103 (pingdotgg#5331), which removes the `Schema.UnknownFromJsonString` export and drops the positional actual argument from `SchemaIssue.InvalidValue`. - Replace the hand-rolled gzip path with `HttpMiddleware.compression()`, deleting apps/server/src/httpCompression/ entirely (pingdotgg#5331). - Extract desktop base/state dir resolution into DesktopStatePaths.ts, and add Linux secret storage, URL-scheme claiming, and early-startup modules (pingdotgg#2916, pingdotgg#5054). - Mobile provider icons for Grok, Cursor, and OpenCode (pingdotgg#4586). - Web polish: chat code blocks, tooltip z-index, spacing, loading screen, terminal cursor blink, terminal close-shortcut guard. Manual resolution and why: - apps/desktop/src/app/DesktopEnvironment.ts — semantic. Upstream deleted the `configuredBaseDir` local that the fork's branding override sat on top of, moving that logic into resolveDesktopBaseDir/resolveDesktopStateDir. Took upstream's extraction wholesale and re-applied the fork's displayNameOverride intent on it. The fork additionally gains upstream's trimming of a blank T3_HOME, which the old inline version did not do. - apps/mobile/src/components/ProviderIcon.tsx — the fork had replaced raw `props.provider === ...` checks with a resolveProviderIconKind seam; upstream's three new icons used the raw form. Routed them through the seam instead of mixing both styles, extended ProviderIconKind, and added test coverage so the new kinds cannot silently fall back to the OpenAI icon. - apps/server/src/textGeneration/CodexTextGeneration.ts — mechanical. Took upstream's one-line Schema change, kept the fork's rewrite of the rest. Merge-caused fixes beyond the conflicts: - Swept 15 fork-only call sites from `Schema.UnknownFromJsonString` to `Schema.fromJsonString(Schema.Unknown)`. These produced no conflict markers; the export simply no longer exists in beta.103. Upstream's own OrchestrationEventStore.ts survives only because it defines a local alias of the same name. Verified: pnpm install, pnpm typecheck (15/15 projects clean), pnpm test. Five failures remain in packages/shared (relayClient, logging); those four files are byte-identical to both upstream/main and the pre-merge backup, and assert POSIX-only behavior (linux-x64 fixture paths, forward-slash path comparisons, ENAMETOOLONG). They cannot pass on Windows and are unrelated to this merge. Backup of the pre-merge tip: backup/dev-before-merge-20260804
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug]:Linux/Hyprland: SSH environment setup fails because Electron safeStorage reports encryption unavailable
There was an error while loading. Please reload this page.