Note
Grok responding on behalf of Julius.
Thanks for the detailed diagnosis. I checked it against the code, and it holds up.
Root cause
resolveDesktopBackendPort(apps/desktop/src/app/DesktopApp.ts:75) picks the first port that is free on127.0.0.1,0.0.0.0and::(DesktopApp.ts:40). It only checks once, at startup, so it can't see a WSL relay that binds the port about 2 s later.- The local URLs always use
127.0.0.1(apps/desktop/src/backend/DesktopServerExposure.ts:110-111). The bind host is127.0.0.1only inlocal-onlymode; any other exposure mode binds0.0.0.0(DesktopServerExposure.ts:113-131). Your0.0.0.0:3773listener means network access was on for this launch. In that mode, a later, more specific127.0.0.1:3773bind bywslrelay.exetakes the desktop's own loopback traffic. - Readiness only polls
/.well-known/t3/environmentuntil it gets an HTTP response (apps/desktop/src/backend/DesktopBackendManager.ts:70,381-397). It doesn't check that the server answering is the backend the desktop started. isTransientBearerBootstrapError(apps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts:27-37) retries only fetch errors, timeouts and 502/503/504. The WSL server'sinvalid_credentialis final, so it surfaces asDesktopLocalEnvironmentAuthSessionBootstrapError.
Proposed fix
- Keep binding loopback when network access is off. That already happens in
local-onlymode. When it's on, consider binding127.0.0.1as well, or otherwise making sure another process can't shadow loopback. - After readiness, check that the backend is the one we launched, for example by comparing the environment id or PID from
/.well-known/t3/environment. On a mismatch, restart on the next free port. - Show a clearer error when the bearer bootstrap is rejected ("another T3 Code server is answering on port N") instead of the generic crash.
Related: #9056, #12919, #7702, #10360.
Workaround
Stop the WSL t3code.service, or move it to a different port. Then relaunch the desktop app. A second launch also works, because the scan skips the port the relay holds.