Repository navigation
[Desktop 0.2.1-rc.5] Startup crash "desktop welcome: Web authentication failed" — dsh-auth-* cookies accumulate past the host's 16KB header limit → 431 (source evidence + repro) #12166
Replies: 1 comment
|
Additional synthetic regression evidence for the same macOS arm64 0.2.1-rc.5 startup failure: Using an isolated Electron userData directory and synthetic cookies only, the shipped A small candidate fix reuses the exact current Host cookie already returned by the existing The candidate passed 12 separate-port synthetic Host generations: welcome handshake and authenticated RPC worked, each cookie callback contained only its own Host cookie, later generations did not invalidate earlier ones, and the synthetic persistent/account cookie jar stayed unchanged. This is isolated candidate validation; it has not been deployed to the production desktop and does not establish end-to-end account sign-in compatibility. A local packaged-app patch changes the vendor signature, so an official signed fix would be preferable. For the real incident, the original failed request's HTTP status was not captured. Cookie metadata, a same-size synthetic 431 reproduction against the Host, and recovery after isolating the local-auth cookie store support the diagnosis. Please distinguish HTTP 431 in startup diagnostics without logging cookie/token values. |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
The desktop host listens on a random port each launch and mints one persistent cookie named
dsh-auth-<base64url(sha256("127.0.0.1:<port>"))>per port, valid 30 days. The Electron side never deletes old cookies. Each pair is ~226 bytes, so after ~70 launches theCookieheader pushes total request headers past Node's default 16KB limit; the host answers the index request with 431, and the app'sconnectDesktopWelcome()treats any non-2xx as auth failure:From then on every launch dies on its first request (the cookie count never drops), so the app is bricked until the user manually wipes the cookie DB. Reinstalling does not help.
Environment
@deepseek-ai/dsh-desktop 0.2.1-rc.5, Electron 44.7.0, Node 24.21.0 (crash log header)Source evidence (extracted from app.asar, matches 0.2.1-rc.5)
lib/types/browser-auth.js:authorityis the normalizedscheme://host:portof the listener. Host ports are ephemeral ⇒ every launch produces a brand-new cookie name. Verified locally:base64url(sha256("127.0.0.1:53643"))exactly matches the cookie stored for the running session.30-day lifetime, no eviction — the package's own doc string: "Cookies carry an absolute issue/expiry interval, defaulting to 30 days through
cookieMaxAgeDays". Live DB confirmsexpires_utc − creation_utc = 30 days.No cleanup path exists — full 182MB asar scan: zero
cookies.remove(; the onlycookies.clear(belongs to the ACP in-memory cookie store (MemoryAcpCookieStore), not the Electron persistent store.App collapses all non-2xx into "auth failed" —
connectDesktopWelcome():--max-http-header-sizeappears only inside bundled undici doc comments; the hosthttp.createServercall passes nomaxHeaderSize, so the 16384-byte default applies.Local cookie DB evidence
~/Library/Application Support/@deepseek-ai/dsh-desktop/Cookieshost_key=127.0.0.1, different names (two different launch ports), each 226 bytes (name52 +value173 + 1 separator), value shapev1.<126 chars>.<43 chars>matchingencodeCookie(), expiry exactly +30d.Reproduction
A. Natural: use the desktop app normally; ~70 launches (~10 days at my cadence) ⇒ bricked.
B. Artificial (no accumulation needed) — replay 70 real-sized cookies against any local server (host's own node, Node 24.21.0):
Measured on my machine: with typical Chromium request headers, n=69 → 200, n=70 → 431 (total ≈16.6KB); with the Cookie line alone, n=71 → 431.
Impact
DELETE FROM cookies WHERE name LIKE 'dsh-auth-%';in the DB (or keep only the current port's row), relaunch. I've deployed a weekly cleanup that hashes all local TCP listen ports and keeps only the live cookie.Suggested fixes (any one suffices)
dsh-auth-*cookies from the Electron session / cookie store.http.createServer(..., { maxHeaderSize: 65536 })on the host.connectDesktopWelcome(), branch on 431 with an explicit error message instead of the generic "Web authentication failed" — it would have saved hours of misdiagnosis ("cookie 坏了"/login issues).Notes
All reactions