Preface¶
After using the DSH Desktop version for a long time, some users may encounter a direct startup failure, where the interface or logs show 431 Request Header Fields Too Large, or Web authentication failed is prompted. Manually clearing cookies in the system often allows logging in again, but the same problem returns after a few weeks. The root cause is that the desktop shell issues a new authentication cookie every time it starts, and old entries are not automatically deleted. The Cookie request header grows longer as the number of entries increases; it exceeds the common 16KB limit when there are about seventy entries, causing the server to reject the request.
Manual cleaning can alleviate the issue, but it cannot be reliably executed repeatedly after every application exit. The dsh-cookie-cleaner introduced below (maintainer satheelshin, community category admin-security) uses a macOS launchd daemon to backup and clear the Electron cookie database after DSH has completely exited. The DSH plugin side is only responsible for installing, diagnosing, and uninstalling the daemon; it does not perform the deletion itself (the plugin exits along with the DSH process, so cleanup must occur after exit).
What is this¶
dsh-cookie-cleaner is a persistent cookie cleanup solution for the DSH Desktop version; repository: https://github.com/satheelshin/dsh-cookie-cleaner. The current package.json specifies version 0.2.1, license MIT, and platform macOS (launchd).
| Component | Location | Role |
|---|---|---|
| DSH Plugin | index.js、lib/manager.mjs |
Install, fix, uninstall, diagnose daemon |
| Daemon | daemon/monitor.py |
Wait for DSH exit, backup and clear cookie database |
The plugin runs inside the DSH process and cannot reliably delete occupied library files while DSH is still alive; therefore, the “dirty work” is delegated to launchd, and the plugin acts as the manager.
Symptoms and Mechanism (Brief)¶
When DSH starts, it issues a cookie named dsh-auth-<sha256(host:port)>. The port may change on every startup, so the name changes accordingly; the validity period is about 30 days, and the desktop shell does not actively clean up old entries. With each additional entry, the Cookie header becomes longer. It easily exceeds 16KB at approximately 72 entries, triggering 431 and invalidating the login state.
This plugin does not fix the upstream behavior of “issuing a new cookie on every startup”. It only clears the database after exit, ensuring that usually only one newly issued cookie remains on the next startup, avoiding the threshold again.
What the Daemon Does After Exit¶
A few seconds after DSH has completely exited, the daemon counts the cookie entries in the database:
- If there are entries: Backup to
~/.dsh/dsh-cookie-cleaner/backups/(default keep 3 copies), then delete the related files in the database; - 0 entries: Delete directly, without creating a backup.
The cleanup target is the entire database, not just entries with the dsh-auth prefix (Electron lacks fine-grained interfaces for external access). Login states for other webpages within the same application are also cleared, and the DSH authentication cookie will be re-issued on the next startup.
Installation and Enablement¶
Prerequisites: macOS, DSH Desktop installed, and system has available python3 (run xcode-select --install if missing).
Method 1: Install via plugin_manager in DSH
According to source text: Install the repository https://github.com/satheelshin/dsh-cookie-cleaner using plugin_manager.
Method 2: Manually add to profile
cd ~/.dsh/profiles/<你的 profile 名>
pnpm add https://codeload.github.com/satheelshin/dsh-cookie-cleaner/tar.gz/refs/heads/main
Add dsh-cookie-cleaner to the dsh.profile.bundles array in package.json under that profile, then restart DSH.
After installation, call cookie_cleaner_install once. Repeated execution is equivalent to fixing and will not result in repeated erroneous loading.
It is recommended to read the repository source code and the MIT license before installing; the plugin and daemon run under local user permissions, do not connect to the internet, and do not read account information. However, if your company has security audit requirements, you should verify the behavior of daemon/monitor.py and the launchd plist yourself.
Plugin Tools and Parameters¶
| Tool | Role | Parameters |
|---|---|---|
cookie_cleaner_status |
Check if daemon is loaded, cookie count, backup count, recent logs | — |
cookie_cleaner_install |
Write daemon script and launchd plist and load | keepBackups / graceSeconds / pollSeconds |
cookie_cleaner_uninstall |
Stop and remove daemon and plist | purge (whether to delete backups together) |
cookie_cleaner_log |
View recent cleanup records | lines |
cookie_cleaner_install parameter range (per source text): keepBackups 1–20 (default 3), graceSeconds 1–600 (default 5), pollSeconds 1–60 (default 3).
The launchd label and plist path used for troubleshooting: ~/Library/LaunchAgents/com.deepseek.dsh-cookie-cleaner.plist.
Typical Usage: Installation and Confirmation¶
-
Execute
cookie_cleaner_installin a DSH conversation or agent (you can pass the above three parameters as needed). -
Execute
cookie_cleaner_status. The health status looks roughly like:
✅ 常驻守护:已加载(state = running)
✅ cookie 条数:1 | 库大小:20.0 KB | 最后写入:2026-11-12T10:06:05.937Z
📦 备份:保留 3 份(最新 cookies-20261108-224515,20.0 KB)
🧾 最近日志:
[2026-11-08 22:45:15] 检测到 DSH 已退出,执行清理
[2026-11-08 22:45:15] 已清理 3 条:备份 ['Cookies'] → ...;删除 ['Cookies']
(The above is an example output from the README; emojis depend on your local actual output.)
A count staying at 1–2 for a long time generally indicates normal operation. If the count rises every time you check, first look at the warnings in cookie_cleaner_status and use cookie_cleaner_log to confirm if there are any cleanup records.
Use Cases and Notes¶
Who is it for: Users who have been using the DSH Desktop version on macOS for a long time and repeatedly encounter 431 / Web authentication failed, or confirm that cookie entries are continuously accumulating; the admin-security category is also suitable for scenarios where “local daemon + diagnostic tools” are integrated into operational habits.
Platform: macOS only; calling cookie_cleaner_status on other systems will report unsupported.
No cleanup while running: If the database is occupied, deletion might be rewritten, so cleanup only happens after complete exit.
Conservative strategy: When ps is unavailable and there is no SingletonLock, the daemon cannot accurately judge the process status, skipping this round of cleanup and logging (up to about one entry every 5 minutes) to avoid accidental deletion.
What it does not do (per source text): Does not connect to the internet; does not touch session, configuration, or model settings in ~/.dsh; does not fix the upstream behavior of issuing a new cookie on every startup. The backup directory ~/.dsh/dsh-cookie-cleaner/backups/ contains a copy of the cookie database; do not commit it to a public repository.
Troubleshooting and Uninstallation¶
| Symptom | Suggested Action |
|---|---|
| Report not loaded | Execute cookie_cleaner_install; check if plist exists |
| python3 not executable | Run xcode-select --install then reinstall plugin |
| Count always rising | Check cookie_cleaner_log for cleanup records |
| Log says cannot judge | Security software blocking ps etc.; daemon skips cleanup this round |
To uninstall, first call cookie_cleaner_uninstall, then remove the plugin; or manually:
launchctl bootout gui/$(id -u)/com.deepseek.dsh-cookie-cleaner
rm -f ~/Library/LaunchAgents/com.deepseek.dsh-cookie-cleaner.plist
rm -rf ~/.dsh/dsh-cookie-cleaner
Conclusion¶
dsh-cookie-cleaner uses launchd to backup and clear the cookie database after DSH exits. Combined with the installation and diagnostic tools in the plugin, it mitigates consequences like “431 caused by oversized headers” rather than modifying the DSH logic for issuing cookies.
- Community directory page: https://www.skillhub.cn/plugins/satheelshin/dsh-cookie-cleaner
- Source code and documentation: https://github.com/satheelshin/dsh-cookie-cleaner
The DSH ecosystem advocates “everything is a plugin”; sites like SkillHub are community sites and have no official affiliation with DeepSeek / Hypothesis. Before installing any plugin, rely on the repository README and license for your own assessment.