Repository navigation
[Desktop][P0] Startup fails permanently after ~70 launches: dsh-auth-* cookies exceed Node's 16 KB header limit → HTTP 431, reported as "Web authentication failed" #12860
Closed
MaDuoDuoBaBa
started this conversation in
General
Replies: 1 comment
|
Cross-linking #12953, because the missing piece here is not diagnosis but shipping. Commit 93bef27 (fix(desktop): remove legacy Host auth cookies from the default session, 2026-10-31) already fixes this on main, and it is not in 0.2.2-rc.1 - the newest release. Two checks on an installed 0.2.2-rc.1:
So every report in this thread is the expected behaviour of the shipped build, and manually deleting Network\Cookies is only a stopgap. Measured numbers (71 rows / 16,117 bytes; 16,044 B -> 401, 16,270 B -> 431), the interim cookieMaxAgeDays workaround, and the backport request are in #12953. |
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.
Uh oh!
There was an error while loading. Please reload this page.
Environment
@deepseek-ai/dsh-desktop 0.2.2-rc.1(nightly)desktop(the failure is in the shell↔Host handshake, before any plugin UI; third-party plugins are not required)Summary
The desktop app stops starting after enough launches, with no way to recover from the UI.
Every launch, the Host mints a new browser-auth cookie on
127.0.0.1:dsh-auth-+base64url(sha256("127.0.0.1:<port>"))Max-Age=2592000(30 days),Path=/,HttpOnly,SameSite=Strict--port 0, so the port (and therefore the cookie name) changes on every launchCookies are host-scoped, not port-scoped, and nothing prunes old ones. They accumulate. At ~70 cookies, the
Cookierequest header exceeds Node's defaulthttp.maxHeaderSize(16,384 B). The Host's HTTP parser answers 431 Request Header Fields Too Large before routing.connectDesktopWelcome()checks onlyresponse.okand throws a genericdesktop welcome: Web authentication failed, so boot aborts and the crash report contains no status code.After the limit is crossed, every retry fails the same way (431 happens before a new cookie can be minted), so it never self-heals. Deleting the
dsh-auth-*rows makes the same version start immediately.Impact
Steps to reproduce
desktop welcome: Web authentication failed.dsh-auth-*from~/Library/Application Support/@deepseek-ai/dsh-desktop/Cookies, relaunch → works again.Header-limit proof without the app (script attached): a default
http.createServer+ 69 cookies of this size + normal request headers already returns 431; 71 is guaranteed.Evidence (captured from a failed machine)
dsh-auth-*cookies at failure127.0.0.1,Path=/, HttpOnlysha256("127.0.0.1:<port>"))http.maxHeaderSize(v24.21.0)issued + 30d, spanning 2026-10-20 → 2026-11-11 (22 days, 71 launches)Timeline (UTC+8):
Web authentication failed→ exit.dsh-auth-*rows (VACUUM), relaunch → starts instantly.The captured SQLite
CookiesDB was 53,248 B; the rows are alldsh-auth-*, and each name maps to a different ephemeral port (verified:sha256("127.0.0.1:57713")equals the current cookie name).Root cause (code)
@deepseek-ai/dsh-client-connection/lib/index.js:@deepseek-ai/dsh-host-webserver/lib/index.js:createServer(listener)— nomaxHeaderSizeoverride, so Node's 16 KB default applies.lib/main.js(shell):That asymmetry (Node fetch OK, Chromium fetch 431) explains why the Host log calls the Host healthy while the shell reports an auth failure.
Proposed fix
P0, smallest change — prune stale auth cookies in the shell before the welcome fetch (the launch token re-mints one immediately):
P0, diagnostics — include the status and the cookie weight, and stop labeling it as a
hostfailure:P1 — bound the set by design: stable cookie name per host with authority/id in the signed payload (bounded count for concurrent instances), or
cookieMaxAgeDays: 1plus pruning, instead of per-port names living 30 days.P2 — regression test: seed 120
dsh-auth-*cookies, boot must reach the workspace; assert the cookie count does not grow with launches; assert a 431 surfaces asHTTP 431in the crash report.Workaround (app must be closed)
Attachments
dsh-431-evidence.zipREADME.md— full report with the same evidence and acceptance criteriarepro-header-limit.mjs— header-limit repro on Node 24.21.0cookie-inventory.csv— 71 rows, values redacted (prefix + length + issue/expiry only)crash-excerpt.txt— sanitized crash-log lines中文摘要
桌面版每启动一次就会在
127.0.0.1上新增一条dsh-auth-*Cookie(名字含随机端口,30 天有效),从不清理。Cookie 不区分端口,约 70 次启动后请求头超过 Node 默认的 16,384 字节,Host 返回 431;主进程只看response.ok,把它统一报成Web authentication failed,应用退出。失败后不会签发新 Cookie,重试无法自愈,只能删 Cookie 库或等 30 天过期。实测失败时库里有 71 条(53 KB),Cookie 头 16,186 B;删除后同版本立即恢复。建议桌面主进程在 welcome 前清理旧dsh-auth-*,错误信息带上状态码与 Cookie 体积,并改用稳定 Cookie 名/短有效期,补一条“预置 120 条 Cookie 仍能启动”的回归测试。dsh-431-evidence.zip
All reactions