[Bug]: Desktop initializes Clerk on startup even when Managed Policy sets limits.connect: false
Before submitting
- [x] I searched existing issues and did not find a duplicate (distinct from host-side policy enforcement in #27197 and #26967).
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
- Deploy a Managed Policy with
"limits": { "connect": false }(and optionally"telemetry": false) and confirm witht3 policy show. - Launch a release build of the T3 Code Desktop app on a fresh, signed-out profile (never signed in to T3 Connect).
- Observe Desktop main-process initialization and renderer startup.
Expected behavior
When Managed Policy disables T3 Connect (limits.connect: false), the Desktop app should not initialize Clerk or contact Clerk's Frontend API on startup. (More broadly, for local-only desktop users who have not signed in to T3 Connect, Clerk should only initialize lazily when Connect sign-in is initiated.)
Actual behavior
While the server enforces limits.connect: false for host linking, proofs, and credentials (apps/server/src/cloud/CloudLink.ts:1690-1720), Desktop still initializes Clerk unconditionally at startup:
- Electron main process calls
clerk.configureduring startup without consultingDesktopManagedPolicy(apps/desktop/src/app/DesktopApp.ts:418,apps/desktop/src/app/DesktopClerk.ts:88-107). - In the renderer,
apps/web/src/cloud/publicConfig.ts:97-110returnshasCloudPublicConfig() === truewheneverwindow.desktopBridge !== undefinedand build-time Clerk/relay env vars are present, soapps/web/src/main.tsx:25-48immediately mountsElectronManagedAuthShell(<ClerkProvider>) before the renderer receivesserverConfigs/managedPolicy. - (Similarly on mobile,
apps/mobile/src/features/cloud/CloudAuthProvider.tsx:8-30initializes the Clerk singleton at module load whenever a publishable key and relay URL are present.)
DesktopManagedPolicy is already read in apps/desktop/src/backend/DesktopServerExposure.ts:489 and apps/desktop/src/ipc/methods/window.ts:107, so gating clerk.configure and exposing a getConnectEnabled() flag on desktopBridge (mirroring getRelayTelemetryEnabled()) would cleanly prevent Clerk initialization when connect: false is set.
Impact
Minor bug or occasional failure
Version or commit
main @ 6696eefe2
Environment
Source review against main @ 6696eefe2 (macOS / Electron desktop build with cloud public config).
Workaround
Build from source without VITE_CLERK_PUBLISHABLE_KEY / VITE_T3CODE_RELAY_URL, or block clerk.t3.codes at the host firewall.