Skip to main content
B

dsh-session-doctor

billy-22/dsh-session-doctor

Finds DeepSeek Harness conversations that no longer load and rewrites their session logs so the harness accepts them again — a reused retry id across policy chains, a turn left open at the tail, a torn Zstandard tail — backing up each artifact first and validating the result with the harness own strict loader.

Install

dsh plugin --profile web add github:billy-22/dsh-session-doctor

README

dsh-session-doctor(会话医生)

English

一个 DeepSeek Harness 插件:找出已经打不开的会话,并把它们修好。

在 DSH 里,会话日志就是唯一的事实来源。日志一旦不再满足加载器的关系约束,对话数据还在磁盘上, 但界面上什么都渲染不出来:侧边栏点进去是空的,或者子智能体的历史一直不出现。 dsh-session-doctor 扫描会话目录,指出具体是什么问题,然后改写日志,让 Harness 重新接受它。

修什么

缺陷症状修法
重试 id 被跨策略链复用加载器抛 llm/retry must keep one retryId per policy chain,整个会话永远渲染不出来给每条链换新 id,同时改写对应的 llm/retry 与 llm/retry-started
尾部轮次未闭合日志在轮次中途结束,转写无法重放追加 Harness 崩溃恢复本来会追加的收尾事件(step/end、turn/end 且原因为 interrupted,以及悬空工具调用的「结果未知」事件)
Zstandard 尾部损坏文件在某帧中间被截断保留所有完整帧,丢掉碎片,重新编码

此外还会只报告、不改写:明文日志、序号不连续、文件头异常。

不做的事

  • 绝不编造工具结果。 尾部轮次若有未完成的工具调用,插件追加的是 Harness 自己的「结果未知」 事件,而不是假装调用成功或失败;如果改写方案过不了校验,就整体放弃这次改写。
  • 绝不和正在使用的会话抢文件。 最近 quietSeconds(默认 180 秒)内被写过的日志会跳过, 除非显式传 force。
  • 绝不无备份改写。 每次改写前先把原文件复制到 <会话目录同级>/session-repair-backups/。
  • 绝不自证。 改写后的字节会重新读取,交给 Harness 自己的严格加载器 (createRestore → decodeRow → assertReleasedV4Relationships)验收;加载器仍不接受,就记为失败, 不会把坏结果留在磁盘上。

安装

从 GitHub 装(市场和 CLI 都支持 github: 前缀,不需要 npm 包):

dsh plugin --profile desktop add github:Billy-22/dsh-session-doctor

从 release 里的 tgz 装(和上面等价,只是不经过 git):

dsh plugin --profile desktop add -w https://github.com/Billy-22/dsh-session-doctor/releases/latest/download/dsh-session-doctor-0.1.1.tgz

本地开发时用 plugin_manager install_bundle 指向包目录也可以。这个包自带 cordis.patch.yml,所以 装完 profile 的 cordis.patch.yml 不会多出一行——dsh.profile.bundles 里出现 dsh-session-doctor 才说明装上了。它往里插入的配置形状是:

- insert:
    - id: session-doctor
      name: dsh-session-doctor
      config:
        scanOnStart: true
        autoRepair: true
        quietSeconds: 180

用法

自动。 插件挂载 startDelayMs 之后跑一次;把 scanIntervalMinutes 设成大于 0 就会定时再跑。 默认:启动时跑一次、允许改写、只跑一次。

在对话里。 用 session_doctor 工具:

session_doctor action=scan
session_doctor action=repair ids=["session-bf156a5f-…"]
session_doctor action=repair force=true          # 只用于你确认已经关闭的会话

用命令。 /session-doctor scan、/session-doctor repair、/session-doctor report (最后一个只重放上一轮的结论,不重新扫描)。

在终端。 包里带一个独立 CLI,有没有桌面应用都能用:

npx dsh-session-doctor scan
npx dsh-session-doctor repair --dry-run
npx dsh-session-doctor repair --id bf156a5f-… --backups ./backups

把 DSH_INSTALL_DIR 指向安装目录下的 dsh/node_modules/@deepseek-ai/dsh,CLI 就会用真正的 Harness 加载器校验,而不是只做结构检查。

配置

键默认含义
sessionRoot$DSH_HOME/sessions会话文件所在目录
backupRoot会话目录的同级目录改写前的备份位置
scanOnStarttrue插件挂载时跑一次
startDelayMs6000首次扫描前等多久,让 Harness 先启动完
autoRepairtrue扫描是否可以写盘;false 就只演练
quietSeconds180最近这么多秒内写过的日志跳过
scanIntervalMinutes0每 N 分钟再跑一次;0 关闭
maxReportItems12单次工具结果里最多列几个会话

修完之后

被修好的会话需要重新打开才会重放新日志——在界面里刷新该会话,或者新开一个会话再进入。修复不会 改动一个已经打开的会话在内存里的状态。

限制

  • 改写正在被写入的日志不安全;force 是你显式的越权开关,插件自己不会这么做。
  • 明文日志(compression: none)在本版本只诊断、不改写。
  • 这个插件修复的 retryId 复用问题来自 dsh-unlimited-retry ≤ 3.1.0;3.2.0 起会在每个 step 边界 清掉 id。修日志是修过去,升级那个插件才是修未来。

许可

MIT

Related plugins