aokamoaki/dsh-stall-sentinel0

dsh-stall-sentinel

Lightweight stall watchdog for DeepSeek Harness profile-bundles. Auto-wires ctx.subprocess.spawn so collect-mode subprocesses (bash tool, background pwsh, npm/build) are watched with zero extra wiring using pid + non-consuming output; background jobs are liveness-tracked. Decides stall only from two conservative signals (progress freeze AND cpu idle-or-pegged across two windows) and reacts exclusively by reminding + a forensics report - never by killing the task.

包名
dsh-stall-sentinel
版本
1.0.0
许可证
MIT
最近更新
2026年9月3日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:aokamoaki/dsh-stall-sentinel

配置(全部可选,默认值见 cordis.patch.yml / lib/core.js

默认含义
enabledtruefalse 直接禁用
intervalMs60000单一 timer 的检查点间隔(每个目标每 tick 一次聚合取证)
probeSleepMs1000单条探针内部两次采样的窗口(决定 CPU/日志增量的时间口径)
stalledWindowsRequired2连续候选窗口数门槛;内部强制 ≥2,配置写 1 也会被夹回 2
cpuIdleDeltaMax0.05CPU 增量 ≤ 此值(秒/窗口)判「≈0 空闲」
cpuSaturatedDeltaMin0.8CPU 增量 ≥ 此值(秒/窗口)判「打满」
tailLines20取证报告里的日志尾行数
logDir / jsonlPath / statusPath$DSH_HOME/stall-sentinel/…事件 JSONL 与状态快照落盘位置
minJobDurationMs1000短于此的 background job 不做存活跟踪
minProbeAgeMs10000自动接线的 spawn 目标存活满此毫秒才开始采样(短命令 0 探针开销)
jsonlMaxBytes1048576events.jsonl 超过此大小轮转到 events.jsonl.old(SGF-03)

使用方式:注册要看的子进程

插件通过 ctx.provide('stall-sentinel', api) 暴露 loopback 服务,任何宿主内插件/诊断代码都能:

const guard = ctx.get('stall-sentinel');
const { taskId } = guard.watch({
  taskId: 'my-build',            // 可选;缺省自动分配 watch-N
  label: 'pnpm install',
  pid: child.pid,                // 必须有正整数 pid
  logPath: 'C:\\agent\\install.log', // 进度信号源(大小/mtime 增量)
  marker: 'added',               // 可选阶段哨兵,命中即视为有进展
});
guard.getStatus();               // 返回整个监控快照
guard.list();                    // 当前 watch 集(按 taskId 隔离)
guard.unwatch(taskId);

⚠️ 没有 logPath 的目标会永久 unknown(继续等,绝不告警)——没有进度信号就无法区分 慢与卡死。这也正是 skill 的「先声明进度信号」协议。