Passer au contenu principal
X

dsh-interstep

x1aostan/dsh-interstep

Plugin de réparation automatique d’une seule Session pour DeepSeek Harness (DSH) : en cas d’échec des tests, complète automatiquement le code source manquant et relance la vérification après les modifications. Réduit la consommation de tokens et le temps des réparations fréquentes.

Installer

dsh plugin --profile web add github:x1aostan/dsh-interstep

README

dsh-interstep

DeepSeek Harness(DSH)的会话内嵌验证闭环插件(原 dsh-fix-loop)。

测试或检查失败时,把补齐未读源码、改后自动复跑与伴随门禁串联收进同一会话的工具轮间,省掉反复 read 和多次手动复测的空轮唤醒。不注册额外工具、不改 system prompt、零运行时依赖,未触发时首请求字节一致、零开销。

无插件 bare(hono PR 回归,n=6 中位:11 步 / 53.2s / ¥0.03649)
  pnpm test 失败 -> read 缺失文件 -> edit×6 -> 手动跑 pnpm test -> 手动跑 typecheck -> 回复

启用 dsh-interstep(同冻结快照,n=6 中位:3.5 步 / 29.2s / ¥0.01832)
  pnpm test 失败 -> [轮间补齐未读源码] -> 并行 edit×6 -> [轮间串跑 pnpm test + typecheck PASS] -> 回复

安装

环境要求:Node >= 20.12.0,DSH >= 0.2.2-rc.5,零运行时依赖。

pnpm install
pnpm run build
dsh plugin --profile <your-profile> add /绝对路径/dsh-interstep

安装后正常让 Agent 跑测试、修报错即可,无需额外命令或提示词。

实测效果

环境:DSH 0.2.2-rc.5、deepseek-v4.1-flash(low)、Windows;每组对称运行 n=6(正反顺序各 3 对),全部通过独立验收且 0 次改动测试文件,首请求 p0 经代理 SHA-256 核对字节一致。

场景仓库 / 门禁链触发费用中位(bare → 插件)用时中位(bare → 插件)步数中位
pr-mid-regression(PR 中段,2/5 已读)¹hono@v4.9.9 (test → typecheck)6/6¥0.03649 → ¥0.01832(-49.8%)53.2s → 29.2s(-45.1%)11 → 3.5
py-packaging(冷启动,5 模块回归)³packaging@24.2 (unittest)6/6¥0.05780 → ¥0.04151(-28.2%)67.7s → 36.0s(-46.8%)19 → 9.5
b2-t3-fork(31K 重上下文回归)¹dayjs (plugins.test → 全量 test)6/6¥0.01175 → ¥0.00854(-27.3%)13.7s → 11.8s(-14.2%)4 → 3
ctrl-already-read(46.5K,100% 已读)³packaging@24.2 (unittest)6/6¥0.03779 → ¥0.02967(-21.5%)44.0s → 33.8s(-23.2%)9.5 → 6
packaging-ruff-bugs(5 模块 8 处 Ruff F,B)²packaging (ruff check)6/6¥0.01598 → ¥0.01576(-1.4%)16.6s → 16.6s(+0.3%)6 → 5
ts-refactor(跨 8 文件签名迁移)²hono@v4.9.9 (typecheck → test)6/6¥0.03250 → ¥0.03350(+3.1%)60.5s → 68.3s(+13.1%)13 → 11
ctrl-clean-feature(零缺陷新功能)¹hono@v4.9.9 (typecheck+test)0/6¥0.03681 → ¥0.03495(未触发)42.8s → 39.1s(未触发)7 → 7
ctrl-workflow-idle(干净 Ruff + 说明)¹packaging (ruff check)0/6¥0.00715 → ¥0.00845(未触发)11.3s → 11.8s(未触发)4 → 5

¹ 提交 3405ba2 / 5309ec8 实测。² 提交 8e23b2e 实测(packaging-ruff-bugs 成对费用中位 -10.3%)。³ 提交 b5f32ea 同源 verify-loop 套件实测。

多文件测试排错里费用降 21%–50%、用时降 14%–47%(配合多门禁串联后 pr-mid-regression 与 b2-t3-fork 收益近乎翻倍);行号已经明确的静态检查(Ruff / 机械式 tsc 迁移)仅保留改后自动复跑与紧凑诊断、不盲灌整文件,费用基本打平(-1.4% 至 +3.1%);两组阴性对照均为 0/6 触发。

机制与项目规则

运行时从 DSH 的 tools/execute 和 tools/result 记录 Shell 实际耗时,在 agent/pre-step 处理已落盘的工具批次。每批最多触发一个工作流,项目规则的默认优先级为 200,内置 verify-loop 为 100。turn/end 清空本轮工作流和通过记录,会话继续保留最近 32 条检查记录。

  • 按失败类型分层补上下文:测试/运行时失败静态定位并补齐未读源码(磁盘指纹去重,同步 fs/observed),无进展时展开 2-hop 依赖;纯行号明确的 lint/type 诊断不灌整文件,避免 uncached 膨胀。
  • 跨轮复用门禁:本轮出现实际验证命令后,插件可用同一运行中会话里已执行的检查补充伴随门禁。复用要求工作区、工作目录、Shell、执行选项和沙箱一致,并重新确认脚本仍存在。当前提示里明确点名的命令优先。只跑指定检查等限制会关闭从历史推断伴随门禁。每项门禁都要在本轮编辑后重新取得通过回执。
  • 改后自动复跑与耗时预算:同批自动检查共用 autoVerifyBudgetMs,默认 20 秒。已测出超出预算的检查交给 Agent 在编辑完成后手动执行,内置串联继续跑预算内的检查。快速失败仍会保留先前测得的慢耗时,完整通过后可更新估计。首次自动执行的检查也受剩余预算约束。回执列出已通过的检查和待执行的慢检查。项目规则的复跑及 then 也受预算约束,并遵循声明顺序。
  • 项目规则:在工作区根目录放置 .dsh-interstep.json(或写入用户级 workflows),为低频仓库定制检查(如 schema/codegen、跨包校验)声明预加载文档与串行复跑链:
{
  "workflows": [{
    "id": "schema-check",
    "trigger": { "prefix": "pnpm run schema:check", "exit": "non-zero" },
    "preload": { "files": ["docs/schema.md"], "autoLocate": "errors" },
    "afterEdit": "replay-trigger",
    "then": ["pnpm run typecheck", "pnpm test"],
    "maxCycles": 2
  }]
}

配置项

字段默认值说明
enabledtrue是否启用工作流运行时
checkTimeoutMs60000单次自动复跑超时时间,单位 ms(下限 5000),实际执行也受本批剩余预算约束
autoVerifyBudgetMs20000每批自动验证共享的 Shell 执行预算,单位 ms(范围 1–2147483647)
maxAutoVerifyCycles5单轮用户请求内改后自动复跑总上限(范围 1–10)
allowWorkspaceReplayfalse是否允许工作区 .dsh-interstep.json 规则执行改后复跑
workflows[]用户级自定义工作流规则(同 ID 覆盖工作区规则)

开发与评测

pnpm run typecheck && pnpm test && pnpm run build && pnpm run verify:package

复现受控 A/B:先拉取基准仓库 node bench/ab/fetch-repos.mjs,再按 bench/ab/run-ab.mjs 启动代理与 --order balanced --reps 3 评测,并用 node bench/ab/summarize.mjs --results <file> --strict 验收。

Plugins associés