Area#
apps/desktop
Steps to reproduce#
- On macOS 27 (Build 26A428), build and launch the T3 Code desktop app (
pnpm build:desktop && pnpm start:desktop).
- The app attempts to bootstrap the primary local environment on launch.
- The main-process
/oauth/token exchange over loopback hits a transient failure (connection reset / brief 503 while the backend settles — newly common after the macOS 27 upgrade).
- The renderer crashes to the root error view during
beforeLoad.
Expected behavior#
The app boots to the chat view (or the pairing UI if unauthenticated), riding out the transient loopback failure.
Actual behavior#
The app crashes to RootRouteErrorView with PrimaryEnvironmentRequestError caused by DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session. No recovery path; relaunch may work if the transient condition has cleared.
Impact#
Blocks work completely
Version or commit#
main (pre-fix)
Environment#
macOS 27.0 (Build 26A428), desktop app, Node v23.10.0
Logs or stack traces#
PrimaryEnvironmentRequestError
← DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session
← RemoteEnvironmentAuthUndeclaredStatusError (503) | RemoteEnvironmentAuthFetchError | TypeError
Workaround#
Relaunch after the transient condition clears. No in-app recovery.
Triage#
Confirmed on current
main. This is a real launch-blocking desktop bug. Not a duplicate of #3513 (related brick path, different trigger). A fix PR is already open.What happens#
Desktop launch bootstraps the primary local environment by exchanging the desktop bootstrap token for a bearer session, then probing
/api/auth/sessionfrom the renderer during rootbeforeLoad.On desktop that session call first asks the main process for a bearer token. The main process POSTs loopback
/oauth/tokenonce. A brief 503, connection reset, orTypeError(reported as more common after the macOS 27 upgrade) becomesDesktopLocalEnvironmentAuthSessionBootstrapErrorwith no retry.That failure is returned over IPC. The renderer wraps it as
PrimaryEnvironmentRequestError(fetch-session-state). The inner 503 is not visible after IPC, so the wrapper is labeled HTTP 500 andretryTransientBootstrapdoes not retry it.bootstrapServerAuth()awaits that firstfetchSessionState()outside its try/catch, so the throw escapesbeforeLoadandRootRouteErrorViewis shown.Relaunch can succeed once the backend has settled. After #11291, Try again re-runs
beforeLoadand may recover if the transient has cleared; it does not prevent the first-launch crash.Source#
Crash chain:
apps/web/src/routes/__root.tsxbeforeLoad→resolveInitialServerAuthGateState()apps/web/src/environments/primary/auth.tsbootstrapServerAuth()→ unguardedfetchSessionState()apps/web/src/environments/primary/httpLayer.ts/desktopAuth.ts→getLocalEnvironmentBearerToken()apps/desktop/src/ipc/methods/window.ts→DesktopLocalEnvironmentAuth.getBearerTokenapps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts→ singlebootstrapRemoteBearerSession(no retry)packages/client-runtime/src/authorization/remote.ts+packages/client-runtime/src/rpc/http.ts→/oauth/token503/reset/TypeErrorThe cookie-exchange path in the renderer already retries 502/503/504 and degrades exchange failures to
requires-auth. The desktop bearer path does not.This is a desktop reliability gap, not a macOS-only code path. macOS 27 is the reported trigger (loopback timing while the backend settles).
Related#
Fixes #12918) — main-process transient retry on bearer bootstrap; renderer degrades a failed initial session fetch torequires-authinstead of crashing./oauth/tokenslice.main: #11291 (Try again→router.invalidate()).Suggested next step#
Review/merge #12919. No second PR needed. After merge, this issue should close via the existing
Fixes #12918line. Leave #3513 open for the remaining degrade/diagnosability work.