dsh-stall-guard: Auto-abort on download stall and delegate source-switching prompts to the agent

Foreword

When having agents pull dependencies and clone repositories in DSH, access to sources like GitHub from within China is often intermittent. Commands hang there for minutes without output, and the agent tends to wait until timeout or give up, wasting turns in the process and easily misjudging it as “the command was written wrong” and going to tweak unrelated parameters.

dsh-stall-guard (stall guard) targets the tool execution layer: it recognizes download-type commands, aborts them if there is no progress within an independent timeout budget, and writes a structured, agent-facing “switch source and retry” instruction into the tool result. The hint comes from built-in text or placeholder templates you configure in the panel; no model is called.

What Is This

  • Repository: 1250589385/dsh-stall-guard
  • Maintainer: 1250589385
  • Category: Workflow (DeepSeek Harness community plugin directory)
  • License: MIT

In one sentence: download stalls → kill it → write the source-switching hint to the agent (in-process handling), which differs from plugins like dsh-turn-doctor that explains failure reasons afterwards, or dsh-llm-fallbacks that switches providers at the LLM layer.

Core Capabilities

Download Detection and Abortion

The plugin monitors download-type commands in the shell. When they exceed downloadSeconds (default 30 seconds) with no sign of completion, it aborts the command and writes an explanation into the tool result, rather than just returning a dry timeout.

The hint usually includes:

  1. What target it got stuck on (e.g., git repository github.com/...), the threshold, and the actual elapsed time.
  2. An explanation that it is more likely a network issue to the source, not a command syntax error.
  3. Source-switching candidates by channel (mirrors are listed as candidates; the documentation explicitly states their availability has not been individually verified).
  4. An aborted git clone may leave a half-finished directory; delete it or use an empty directory before retrying.
  5. The original command is attached so the agent does not need to scroll back through context.

Covered Channels (Excerpt)

Channel Recognizable command examples Source-switching hint direction
git git clone, git fetch, git pull, git submodule update, etc. Proxy prefix, insteadOf, tarball
npm family pnpm install, npm i, yarn add, bun, etc. --registry https://registry.npmmirror.com
pip pip install, pip download, uv sync PyPI mirrors like Tsinghua
cargo / go cargo install, go get, etc. Common crates / Go proxies
http curl, wget, aria2c, etc. Change host, gh-proxy, resume download

Local queries like curl --version, git status, git log will not be treated as downloads, avoiding false positives.

Timeout Policies for Other Tool Types

Besides downloads, the plugin also sets default timeouts for web_fetch, web_search, read/write, exec, and other scenarios. Downloads use an independent budget that does not consume the regular exec 30 seconds. Write operations that time out only notify, not abort, to avoid corrupting user files; regular non-download bash commands are also not forcefully aborted.

Default thresholds (adjustable in configuration):

Type Default seconds After stalling
Download 30 Abort + source-switching hint to agent
web_fetch 15 Abort + suggest switching to search
web_search 15 Abort + retry once
Read 20 Only notify
Write 30 Only notify, do not abort
Exec 30 Only notify (if judged as download, handle as download)
Long task 120 Only notify

Token and Model

The guard logic, timing, local polling of state.json, and status bar text all do not call any model. What enters the agent’s context is mainly the source-switching hint when stalling (documentation estimates about 195–325 tokens per occurrence, only generated when truly stalled). The plugin does not offer a “use model to generate hints” option.

Supervisor UI (Secondary)

The session header can display a supervisor avatar (dot, icon, or round whale avatar), providing visual feedback when stalling; display can be turned off but the guard still works. Text comes from built-in Chinese and English tables; when switching interface language, hints already on screen will update accordingly. Appearance preferences are stored in the browser’s localStorage and are not synced to the Host configuration.

Installation and Activation

In an environment with DSH CLI installed, add the plugin to a specified profile:

dsh plugin --profile <your-profile> add dsh-stall-guard

Common profiles for the desktop version can be viewed via environment variables:

$env:DSH_PROFILE   # Desktop version is usually desktop

After installation, just refresh the page; it takes effect by default with no additional configuration needed.

Configuration

Open settings via the supervisor avatar in the panel, or edit $DSH_HOME/stall-guard/config.json. Example structure:

{
  "version": 1,
  "enabled": true,
  "watchDownloads": true,
  "downloadSeconds": 30,
  "timers": { "fetch": 15, "search": 15, "read": 20, "write": 30, "exec": 30, "long": 120, "other": 30 },
  "overrides": { "web_fetch": 45 },
  "autoSwitch": true,
  "scenes": {
    "download": { "enabled": true, "seconds": 30 },
    "fetch": { "enabled": true, "seconds": 15 },
    "search": { "enabled": true, "seconds": 15 }
  },
  "supervisor": { "show": true, "display": "avatar" }
}

Common items:

  • downloadSeconds: Download timeout budget; increase if the source is slow, decrease if you want to switch sources faster.
  • watchDownloads: false: Turn off dedicated download detection; download commands are treated as regular exec (notify only, no abort).
  • overrides: Set seconds individually for single tools.

The panel also supports customizing the raw text sent to the agent for the three scenarios “download / fetch / search”, using placeholders like {{label}}, {{command}}, {{hints}}; if left empty, built-in text is used. Custom presets still append a reminder to clean up half-finished directories.

Typical Usage and Expected Behavior

The agent executes, for example:

git clone https://github.com/nodejs/node.git

If it does not complete within 30 seconds, the tool result will receive an explanation similar to below (excerpt, actual behavior depends on the running environment):

下载卡住了:git repository github.com/nodejs/node.git 在 30 秒内没完成(已经跑了 30 秒,已中止)。

这条命令被终止了。原因多半是到这个源的网络不通,而不是命令本身写错。
换一个源重试,不要用同一个源继续硬等:
1. 在 GitHub 地址前加代理前缀,例如 https://gh-proxy.com/https://github.com/<owner>/<repo>.git
...

The agent should retry by switching sources or using tarballs, and handle any potentially remaining directories before retrying.

The user-side status bar may show a brief Chinese hint, e.g.: “Download did not complete in 30s, aborted, source-switching hint has been given to the agent.”

Use Cases and Notes

Suitable for: Environments where agents frequently execute git clone, pnpm install, pip install, curl to pull resources, and where network access to overseas sources is unstable.

Compatibility (per README): Requires tools/execute waterfall and webServer; without webServer the guard still works, just without the panel. Does not register tools or occupy tool names; uses slot conversation.session.header.utilities.

Before installing: The plugin runs with the current DSH process’s permissions; before installing, you should review the GitHub source code and the MIT license yourself. The community directory SkillHub plugin page is an independent site, with no official affiliation with DeepSeek / High-Flyer.

Privacy (per README): Configuration is written locally to ~/.dsh; stall records are kept only in memory, at most 10 entries, cleared on restart.

Conclusion

dsh-stall-guard turns “download hangs” from long empty waits into actionable source-switching instructions, without consuming any model tokens throughout. If your workflow has agents frequently pulling from GitHub or package manager sources, you can install it into the corresponding profile using the commands above and give it a try.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye