Repository navigation
fix(desktop): a WSL backend counts as ready only when it answers as this launch - #41985
Conversation
…his launch A WSL backend has no control channel, so the desktop app polls it over HTTP. Each WSL launch now gets its own readiness secret on stdin, and the app treats the backend as ready only when the listener at its address answers a fresh challenge with a proof derived from that secret. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
- Windows work-account sign-in (desktop browser tabs): upstream pingdotgg#42461 grew its header listener to add navigation client hints. Electron keeps one listener per session, so Cody moved upstream's listener body into previewRequestHeaders and runs it inside the sign-in listener; upstream's listener registers only when sign-in is off. BrowserSession.test.ts now checks persistent sessions keep the client hints. - DesktopBackendConfiguration: WSL start config keeps Cody's sign-in helper beside upstream's launch readiness proof (pingdotgg#41985). - index.html: Cody splash labels plus upstream's migration progress line (pingdotgg#37209). - agentContextBudget.json: Cody's Claude and Codex sizes (+371 for final_answer), upstream's MCP tool list size. - SideThreadPane: Cody's side chat imports beside upstream's thread find (pingdotgg#28919). - New macOS camera/microphone prompts (pingdotgg#38146) and the server startup page (pingdotgg#37209) say Cody. - BrowserSession.test.ts: drop a duplicate HostProcess import; layerDarwin provides DesktopClientSettings for Cody's sign-in setting.
What changes
A backend started inside WSL has no control channel to the desktop app (
wsl.exepasses only stdin, stdout and stderr), so the app decides it is ready by polling it over HTTP. That poll used to accept any successful response from the backend's address.Now each WSL launch gets its own readiness secret, delivered on stdin with the rest of the bootstrap. The app polls
/.well-known/t3/desktop-readinesswith a fresh challenge and treats the backend as ready only when the answer is a proof derived from that launch's secret. A backend launched without a readiness secret does not serve the route (404). Backends with a control channel are unchanged: they still report readiness there.Nothing changes for users when startup is healthy. If something other than the launched backend is listening on the WSL backend's address, the app now reports that the server did not become ready instead of connecting to it.
How it is built
packages/shared/src/desktopReadinessProof.ts: derive and check the proof (HMAC-SHA256 over the challenge), shared by server and desktop.packages/contracts: optionaldesktopReadinessSecretin the desktop bootstrap.apps/server/src/http.ts, registered inserver.ts.packages/shared/src/httpReadiness.ts: optionalaccept(body)so a caller can decide from the response body whether the listener counts as ready.DesktopBackendConfigurationcreates the secret and probe per WSL start config;DesktopBackendManageruses the probe when a backend has no control channel.Testing
DesktopBackendManager.test.ts: a polled backend stays not ready while its address answers 200 without the proof, and becomes ready once the proof is served. This test fails on main.DesktopBackendConfiguration.test.ts: every WSL config resolve yields a different secret, each probe uses a new challenge, and a probe accepts only a proof from its own launch's secret.http.test.ts: the route answers with a valid proof, and returns 404 without a challenge, with an oversized one, or without a configured secret.desktopReadinessProof.test.ts: proof validity per secret and challenge.wsl.exe. The WSL launch path itself is covered only by the unit tests above.vp run check:changedpasses.🤖 Generated with Claude Code