Foreword¶
DeepSeek Harness (dsh) releases frequently, and candidate versions are common. The configurations that determine whether it can start up properly are often concentrated in a handful of files: settings.yaml, profile patches and manifests, agent presets, AGENTS.md, etc. A single incorrect line in cordis.patch.yml can prevent dsh from starting. Manually editing configurations or upgrading versions directly via npm lacks paths for “verifiable snapshots” and “failure recovery”, so operational costs can accumulate in a single mistake.
Below we introduce the community plugin dsh-plugin-safe-upgrade (maintainer MovieMaker93, categorized under admin-security). It uses git within $DSH_HOME to record the change history of critical configurations, marks known-good configurations after each successful startup, and turns upgrades into a process of “validate first, switch second, auto-rollback on failure” via /upgrade, /rollback, and an optional systemd boot guard. The plugin is not an official product of DeepSeek or dsh; it only uses dsh’s public plugin interfaces. Issues should be reported in this repository’s issues, not in the dsh main project.
What is this¶
dsh-plugin-safe-upgrade targets Linux environments running as systemd services and installing @deepseek-ai/dsh via npm, providing:
- Security-related configuration history (including a policy to reject secrets before they are written to git);
- Guarded upgrade with idle detection and multi-stage validation;
- Automatic rollback when startup fails or the Web UI behaves abnormally;
- Two entry points: Web UI commands and the
dsh-safe-upgradeCLI.
The current package version is 0.4.0 (MIT). SkillHub directory page: dsh-plugin-safe-upgrade; source code and documentation: GitHub - MovieMaker93/dsh-plugin-safe-upgrade.
Core features¶
Configuration history¶
Every edit to files that affect whether dsh can start (settings.yaml, profile patch/manifest, agent presets, AGENTS.md, etc.) is automatically committed, with a short delay of a few seconds, to the git repository under $DSH_HOME; subsequently created profile and preset directories are also tracked. Sessions, credentials, caches, node_modules, etc. are not tracked; if a file’s content contains literal secrets, the secret guard will reject it before it is written to git.
Known-good startup marking¶
After each dsh startup, the plugin checks for failed plugins, plugins that failed to finish loading, and corrupted presets in the plugin loader. If the startup is healthy, it tags the current configuration with good-<time> and records the dsh version running at that time (each configuration/version combination is tagged only once).
/upgrade: Side-by-side installation and automatic rollback¶
The upgrade process does not touch the running service until the very last moment: the new version is installed into a side-by-side directory, and each profile is validated with dsh --dump-config in a temporary copy of $DSH_HOME. After confirming idleness once more, dsh is stopped, the install directory is swapped, and startup is attempted. If the new version cannot become healthy again, the previous install and configuration are automatically restored. Downtime is mainly the directory swap plus one startup (described in the README as on the order of seconds).
Before upgrading, each stored session is opened with both the running version and the target version in copies; if a “session that opens today” will not open after the upgrade, the upgrade is aborted. If the agent preset that a session depends on no longer exists in the new dsh version (e.g., ~/.dsh/.agent-presets which 0.1.7 no longer reads), the plugin adds a copy of the legacy preset into the profile patch so conversations can continue. On rollback, if there are “sessions that were only continued on the new version”, a warning is given.
After the new version starts, the real Web UI is also loaded in headless Chromium; if browser-side failures such as “Failed to load plugins” occur, the upgrade is rolled back—this catches client-side problems invisible in server-side logs.
The README notes: dsh --dump-config is not read-only (0.1.7 rewrites cordis.yml, etc.), so validation is always performed on configuration copies, and the live $DSH_HOME will not be written by dry runs or rejected upgrades.
Warning policy (failOnWarnings)¶
Upgrades, dry runs, and rollbacks report patches that no longer have matching entries in the new version, as well as logged errors that did not cause plugin failure. Enabling failOnWarnings treats these as failures: dry runs fail, upgrades stop before touching dsh (configuration warnings) or roll back (startup warnings), and manual rollbacks are undone; automatic recovery is not undone because of warnings.
/rollback¶
You can return to any known-good startup or recent configuration snapshot. The target configuration is validated before stopping dsh; if the tag corresponds to a different dsh version and a copy of that version’s install still exists, the corresponding install is swapped back as well.
Optional: Boot guard and Telegram¶
The boot guard validates configurations before each startup via a systemd drop-in; if startup fails three times in a row, it restores the latest locally recoverable known-good configuration and starts dsh again (also covering cases where configurations were manually broken). It runs under the same account and executes at most once every 15 minutes to avoid loops. Upgrades and rollbacks depend on systemd; configuration history and health checks remain available without systemd.
Optional Telegram notifications cover every upgrade, rollback, and recovery.
Environment requirements¶
- dsh 0.1.5 or higher, installed via npm (
@deepseek-ai/dshpresent innode_modules), running as a systemd service (system or user unit). - Linux, requiring
git,npm,cp,systemd-run; Node 22+. - Optional: Chromium or Chrome for Web UI checks; if missing, skipped and reported as a warning.
- Session checks copy
$DSH_HOME/sessions, requiring sufficient space on the adjacent disk. - The plugin itself has no additional npm dependencies.
Installation and enablement¶
The plugin runs under the same account as the dsh process; before installing, please read the source code and the MIT license to confirm it meets your security policy.
The installation steps given in the README are as follows:
git clone https://github.com/MovieMaker93/dsh-plugin-safe-upgrade ~/.dsh/plugins/safe-upgrade
dsh plugin --profile web add link:$HOME/.dsh/plugins/safe-upgrade
sudo systemctl restart dsh # or whatever your unit is called
dsh plugin add registers the package as a profile bundle and inserts a safe-upgrade line. After the first startup, the plugin starts the configuration history and marks this startup as good.
Optional boot guard (run once as the user owning the systemd unit):
node ~/.dsh/plugins/safe-upgrade/bin/dsh-safe-upgrade.mjs install-guard --unit dsh
Typical usage¶
Web UI¶
Enter commands in the Web UI and press Enter:
| Command | Effect |
|---|---|
/upgrade |
Lists updated latest/next releases, dry runs, “check now”, and the most recent task; refuses when a turn is running. |
/rollback |
Lists known-good startups and recent configuration snapshots. |
When a task finishes, a notification is given via browser notification (if authorized) or an in-page toast.
Command line¶
dsh-safe-upgrade status
dsh-safe-upgrade upgrade latest --dry-run
dsh-safe-upgrade upgrade 0.1.7-rc.2
dsh-safe-upgrade rollback good-20260928-190522
dsh-safe-upgrade check-ui # does the web UI actually load right now?
dsh-safe-upgrade sessions # which sessions fail to open, and which can't be continued
dsh-safe-upgrade sessions --fix-presets # add legacy presets for sessions whose preset is gone
dsh-safe-upgrade install-guard --unit dsh [--remove]
sessions runs on a copy of $DSH_HOME/sessions and does not modify live sessions. --fix-presets synthesizes legacy presets with the currently running dsh and then writes them into the profile’s cordis.patch.yml; if the profile is configured with patchReload: live, it can take effect without a restart (see the README for details beyond the truncated section).
The overall upgrade flow can be referenced from the supervisor diagram in the README: host-side idle check → systemd-run launches the supervisor → snapshot, side-by-side installation, dump-config, session comparison → stop and swap install → startup, HTTP and health marking → headless Web UI → on failure, restore install.prev and pre-upgrade configuration.
Applicable scenarios and cautions¶
Suitable for: self-hosted or single-machine operations that manage dsh via systemd long-term, need to frequently follow latest/next, and want configuration and version changes to be auditable and revertible.
Cautions:
- Upgrades and rollbacks require systemd; if you only want configuration git history and health checks, you can use them without the full upgrade path.
- The plugin accesses
$DSH_HOMEwith the same permissions as dsh; before installing, review the behavior and dependency surface of the GitHub repository yourself. - The community plugin directory SkillHub has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem emphasizes “everything is a plugin”, and this plugin is an admin-security addition to it, not an official app store entry.
Conclusion¶
dsh-plugin-safe-upgrade turns “editing configurations” and “upgrading versions” from a one-shot gamble into an operational chain with history, validation, known-good tags, and automatic rollback. If your dsh already runs on systemd as required by the README, you can install it with the commands above, first use upgrade latest --dry-run and the /rollback list to familiarize yourself with its behavior, and then perform a real upgrade in production.
- Directory page: https://www.skillhub.cn/plugins/MovieMaker93/dsh-plugin-safe-upgrade
- GitHub: https://github.com/MovieMaker93/dsh-plugin-safe-upgrade