Repository navigation
Replies: 4 comments
|
Independent confirmation on Windows, plus one correction. Environment: Windows 11 x64, Measured against a live Host (plain
The 431 is produced by Node's HTTP header parser, not by DSH: the response carries only Size math (from the minting code in One correction to the crash-loop paragraph: a failed launch does not mint another cookie. The 431 is returned by the parser, so the request never reaches the Host and no Still present on main: #11366 carries a shell-side patch (remove Local workaround we run with the app closed — prune the rows directly; const { DatabaseSync } = require('node:sqlite')
const db = new DatabaseSync(cookiesPath)
db.exec("delete from cookies where name like 'dsh-auth-%'")
db.close()It is hooked into our restart script, so the jar never holds more than the current launch's cookie. |
|
One number that may help pick between the three fixes: Chromium's own jar cap is 180 cookies per domain (every host-only cookie on 127.0.0.1 lands in that one bucket), evicting least recently used. At the 228 B per cookie measured above, the cap is only reached at about 41 KB of (We use the same limits in the cookie jar for Mars, a browser we are building, which is why I had the number handy.) |
|
Independent confirmation on macOS arm64, with one platform-path detail. Environment: Measurements:
macOS workaround (app fully quit first): UD="$HOME/Library/Application Support/@deepseek-ai/dsh-desktop"
sqlite3 "$UD/Cookies" "DELETE FROM cookies WHERE host_key='127.0.0.1' AND name LIKE 'dsh-auth-%';"Suggested fix: the minimal source change in #11408 (clear stale One extra diagnostic suggestion: include the HTTP status in the error, e.g. |
|
Independent confirmation on macOS arm64, plus a client/server isolation check and a verified workaround. Environment: Measurements at 71 live
The Host itself is fine. I started it standalone and hit the printed launch URL:
Workaround verified — clearing the stale jar restores startup: # quit the app first
cp ~/Library/Application\ Support/@deepseek-ai/dsh-desktop/Cookies{,.bak}
sqlite3 ~/Library/Application\ Support/@deepseek-ai/dsh-desktop/Cookies \
"delete from cookies where host_key='127.0.0.1' and name like 'dsh-auth-%';"After relaunch exactly one |
Uh oh!
There was an error while loading. Please reload this page.
Summary
The desktop app enters a startup crash loop after enough launches: the shell fails during
desktop welcome: Web authenticationand exits. Root cause is unbounded accumulation ofdsh-auth-*session cookies in the Electron session jar, until theCookierequest header exceeds the Host's 16 KB HTTP header limit and every launch fails with HTTP 431.(中文版摘要见文末。)
Environment
@deepseek-ai/dsh-desktop0.2.1-rc.3Root cause analysis
In
@deepseek-ai/dsh-client-connection, the browser-session cookie name is derived from the authority including port:The Desktop Host binds to a new random
127.0.0.1port on every launch, so every launch mints a cookie with a different name (dsh-auth-<sha256("127.0.0.1:<port>")>). Cookies carry a 30-day expiry and are never cleaned up. Since cookies are not port-scoped, Chromium sends every accumulateddsh-auth-*cookie on each request to127.0.0.1.After ~70 launches the jar held 71 live cookies ≈ 16,117 bytes of
Cookieheader (measured). Adding the remaining request headers exceeds Node's default--max-http-header-size(16,384), so the Host responds 431 Request Header Fields Too Large.The desktop shell then maps any non-OK response to a startup failure (
connectDesktopWelcomethrows on!authenticated.ok), and each failed attempt stores one more cookie viaSet-Cookieon the 431 response, creating a death spiral (observed 7 crash-restart cycles in ~3 minutes):Reproduction
@deepseek-ai/dsh-desktopand launch it once per day for ~2–3 weeks (each launch = new random host port = one new cookie).~/Library/Application Support/@deepseek-ai/dsh-desktop/Cookiesaccumulate onedsh-auth-*row per launch, all unexpired (30-day TTL).Cookieheader for127.0.0.1exceeds 16 KB, every launch crashes with the log above (~/Library/Logs/DeepSeek Harness/crash-*-host.log).Current behavior
Startup crash loop; the app never opens. Each retry adds another cookie, worsening the failure.
Expected behavior
Startup succeeds regardless of launch count.
Suggested fixes (any one)
host:port), or give the Host a stable port per profile so the same cookie name is reused and refreshed in place; ordsh-auth-*cookies from the session jar before authenticating (it already owns the jar), e.g. keep only the cookie matching the current authority; or--max-http-header-size.Workaround for affected users
Quit the app completely, then delete the accumulated cookies (macOS example):
Relaunch — it starts cleanly. No account login is lost;
dsh-auth-*is only the local Host session cookie. The problem will slowly recur until one of the fixes above ships.中文版摘要
桌面端每次启动时,Desktop Host 会在
127.0.0.1的随机新端口上监听,而会话 Cookie 名是dsh-auth-<端口哈希>,因此每次启动都会签发一个新名字的 Cookie(30 天有效、从不清理)。Cookie 不区分端口,约 70 次启动后 Chromium 会把全部 ~71 个 Cookie(约 16.1 KB)一起发给127.0.0.1,超过 Node 默认 16 KB 的请求头上限,Host 返回 431,桌面端把它报成desktop welcome: Web authentication failed并崩溃退出;且每次失败还会再新增一个 Cookie,形成恶性循环。建议:Cookie 名不绑定端口(或 Host 使用固定端口),或启动时清理旧的dsh-auth-*Cookie。临时 workaround:退出应用后删除上述数据库中的dsh-auth-%Cookie 即可正常启动。All reactions