dsh-cookie-doctor: Clean up accumulated dsh-auth-cookies on DSH Desktop Edition to prevent recurring Web authentication failures
This plugin addresses a crash in DSH Desktop that occurs after several restarts, reporting "desktop welcome: Web authentication failed". The root cause is that session cookie names contain a port hash, whereas Chromium stores cookies per domain, leading to the continuous accumulation of `dsh-auth-*` cookies. Eventually, the Cookie header exceeds Node.js's default `maxHeaderSize` of 16384 bytes, causing the parser to return 431. The plugin runs within the host process to take over the `dsh-host-webserver`'s `http.Server`, raising `maxHeaderSize` to 256KB. It also expires historical `dsh-auth-*` cookies unused in the current round per request, keeping only one entry in the store. Installation is performed using the repository's built-in script `node scripts/install.mjs`. For machines that have already crashed, fully exit DSH first, then run `diagnose.mjs` or `repair.mjs` to clear the database (this deletes only `dsh-auth-*` and includes an automatic backup). Configuration is centralized in `cordis.patch.yml`, containing keys such as `maxHeaderBytes`, `purgeStale`, `maxPurgePerResponse`, `warnAuthCookies`, `reportPath`, and `quiet`. The plugin does not interfere with authentication logic or ports but only cleans up garbage. The README includes test results for three scenarios using `simulate.mjs`: a 431 error on the 73rd start without the plugin; a constant Cookie header of 223 bytes with a single cookie after installing the plugin; and the affected machine self-healing to a single cookie. The README states that it was created with 100% "vibe coding" and is sourced from the DeepSeek V4.1 Flash Harness side. As of version 0.2.1-rc.3, the official fix has not been applied; it is recommended to verify the source code and the MIT license before use.
Read More