Repository navigation
Replies: 1 comment
|
Duplicate of #9924 (same root cause, independently reproduced on 0.2.2-rc.1/Windows: 71 stale cookies, 431 captured). Closing — additional evidence and a 5th fix option posted on the canonical thread. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug: desktop crashes at startup once stale
dsh-auth-*cookies exceed Node's 16 KB header limitEnvironment:
@deepseek-ai/dsh-desktop0.2.2-rc.1, win32 x64, Electron 44.7.0 / Node 24.21.0Symptom
The desktop shell dies during startup with:
The host process is healthy — it emits the ready URL and serves RPCs — but the shell's
net.fetch(ready.url, { credentials: "include" })receives a non-2xx response and the app exits.Root cause
The host replies HTTP 431 Request Header Fields Too Large. I captured the real response by patching a probe into
connectDesktopWelcomelocally:{ "targetUrl": "http://127.0.0.1:53376/?token=…", "status": 431, "statusText": "Request Header Fields Too Large", "finalUrl": "", "redirected": false, "headers": [["connection","close"]], "body": "" }The request never reaches routing — Node's HTTP server rejects it at parse time because the Cookie header alone is ~16.1 KB and Chromium's default headers push the total over the 16 KB
maxHeaderSizelimit.The cookie jar contained 71 stale
dsh-auth-*cookies on127.0.0.1. The accumulation is structural, perpackages/client/connection/src/browser-auth.ts:requestAudience()returnsurl.hostfor HTTP — including the ephemeral port (L79)cookieName(authority)=dsh-auth-+base64url(sha256(authority))(L116) — so every launch on a new port mints a new cookie name; nothing is ever overwrittensessionCookie()writes a persistent cookie:Max-Age,Expires(default 30 days viacookieMaxAgeDays,src/index.ts),Path=/,HttpOnly,SameSite=Strict(L138)dsh-auth-*cookies to every instance on127.0.0.1, andverifyBrowserCookieonly reads the one matching the current authoritySo: +1 permanent ~226 B cookie per launch → header grows monotonically → after ~70 launches the shell's fetch crosses 16 KB → 431 → fatal. The desktop is effectively bricked until the cookie store is manually cleared.
dsh web/ CLI hosts are unaffected because a real browser profile doesn't accumulate the same jar (and/or the CLI reuses ports).Reproduction
dsh webpointed at a persistent browser profile) ~70 times, or simply pre-seed ≥70dsh-auth-*cookies for127.0.0.1.net.fetchfails with 431 →desktop welcome: Web authentication failed→ exit.Verified by deleting all
dsh-auth-*rows from%APPDATA%/@deepseek-ai/dsh-desktop/Network/Cookies: the app then boots normally andhost rpc okcalls flow.Notes
The port binding is intentional (
.agents/notes/…/2026-08-24-browser-token-authentication.md: independent Web ports must not collide). But the side effect — unbounded, never-cleaned accumulation in a host-scoped jar — isn't covered by the design.Possible fixes without breaking multi-port coexistence:
authorizeIndex, scan the incomingCookieheader fordsh-auth-*names that don't match the current authority and emitSet-Cookie: <name>=; Max-Age=0alongside the fresh cookie. Server-side only, no client change needed, and stale entries die on the next launch instead of at day 30.dsh-auth-*cookies whose authority doesn't match the current host:port before callingconnectDesktopWelcome.Happy to provide the captured response JSON and the cookie DB dump if useful.
All reactions