Sandbox & Runtimedsh-plugin

dsh-single-instance-guard

A zero-dependency DeepSeek Harness plugin that acquires an exclusive lock on the DSH_HOME data directory at startup, aborting loudly if another live dsh server is already using it, to prevent session-log corruption from concurrent writers.

Stars
0
Forks
0
Open issues
0
Last push
Aug 16, 2026
Latest release
—
24h Growth
+0
7d Growth
+0

Installation

dsh plugin --profile <profile> add dsh-single-instance-guard

Overview

A zero-dependency DeepSeek Harness plugin that acquires an exclusive lock on the DSH_HOME data directory at startup, aborting loudly if another live dsh server is already using it, to prevent session-log corruption from concurrent writers.

  • Acquires an exclusive lock on DSH_HOME data directory at startup using atomic O_EXCL lock file creation.
  • Aborts startup loudly with a clear bilingual error if another live dsh server is already using the same data directory.
  • Prevents JSONL session persistence corruption caused by concurrent writers with stale sequence cursors.
  • Probes holder process liveness on conflict; removes stale locks and retries acquisition.
  • Removes the lock file on process exit only if still owned by this process.
  • Resolves DSH_HOME exactly like dsh itself: $DSH_HOME or ~/.dsh, so different data roots never conflict.
  • Zero runtime dependencies, easy to install via dsh plugin CLI or manual cordis.patch.yml insertion.
  • Includes a known-limits note about a tiny race in stale-lock retry, still guaranteeing exactly one winner via atomic O_EXCL.

Related plugins