c-ling/dsh-plugin-request-retry ↗★ 0
dsh-plugin-request-retry
Request retry for the DeepSeek Harness web GUI: when a model request fails and its error message matches configured keywords, schedule additional automatic retries after the built-in retry policy gives up, plus a Settings → Request Retry panel to manage keywords and backoff parameters.
AI Analysis
核心用途是针对特定网络或 API 错误自动追加重试。适合经常遇到临时性 API 报错、需要提高长任务自动化成功率的用户。
Install
This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗
README
Read the full README ↗dsh-plugin-request-retry
DeepSeek Harness 请求重试插件(DSH 双面插件):模型请求失败且错误信息命中关键词时,在内置重试策略耗尽后继续自动追加重试;设置面板新增「请求重试」页管理关键词与退避参数。
简介
DeepSeek Harness 对每次模型请求执行提供商自带的重试策略(@deepseek-ai/dsh-llm-retry,默认最多 5 次、指数退避)。策略耗尽后失败会直接向上传播、回合以错误结束。本插件在同一个请求恢复扩展点(agent/request-error waterfall)上注册自己的恢复器:
- 先让内置策略先行:始终先
next()把请求交给链上的后续恢复器(含内置 llm-retry);只要内置策略仍安排了重试,本插件原样放行。 - 默认重试结束后接管:当整条恢复链都没有给出重试决策,且失败信息(
failure.message)包含配置的任一关键词(不区分大小写的子串匹配)时,追加一次本插件自己的重试:- 向会话日志写入与内置重试同构的持久化事件
llm/retry+llm/retry-started(使用独立的稳定 policyKey 链,通过 dsh-llm-retry 的不变量校验),轨迹面板可见; - 按指数退避 + 抖动等待(服务端返回
Retry-After且不超过最大间隔时优先遵循); - 返回
{ kind: "retry" },agent loop 原地重跑失败的 step。
- 向会话日志写入与内置重试同构的持久化事件
- 按 (turn, step, provider) 计数:追加重试次数用会话事件统计,每个失败 step 独立计数,不会跨步骤累积。
设置 → 请求重试
| 配置 | 默认 | 说明 |
|---|---|---|
| 启用请求重试 | 开 | 总开关 |
| 匹配关键词 | 20 个常见错误词 | 每行一个;错误信息命中任意一个即触发 |
| 区分大小写 | 关 | 关键词匹配方式 |
| 追加重试次数 | 3 | 内置重试结束后最多再自动尝试的次数(0 关闭) |
| 初始间隔(秒) | 2 | 退避起始延迟 |
| 最大间隔(秒) | 30 | 退避上限 |
| 抖动比例(%) | 10 | 退避随机抖动 |
保存后立即生效,无需重启。配置存储于 $DSH_HOME/storages/dsh-plugin-request-retry/config.json。界面文案随 Settings → General → Language 中英实时切换。
兼容性
- 针对 DeepSeek Harness 0.1.1 验证:
agent/request-errorwaterfall 契约、llm/retry事件与不变量、settings.section插槽与 locale 服务 API 均实测通过(含中英实时切换的真实浏览器验证)。 - 无论本插件与 dsh-llm-retry 在监听链中的先后顺序如何,行为一致(先
next()后决策)。
安装
从 GitHub 安装到 web profile(需要 pnpm 在 PATH 上;没有则用下面的 corepack 方式):
npx @deepseek-ai/dsh plugin --profile web add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
或使用已有的 dsh 命令:
dsh plugin --profile web add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
pnpm 不在 PATH 上时:
cd ~/.dsh/profiles/web
corepack pnpm add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
dsh plugin把参数原样转发给 pnpm,直接从本仓库拉取包(pnpm 9+,本机需装有git)。 安装时若看到declares no dsh.bundle — installed as a plain dependency的提示属正常现象: 本插件不是 profile bundle 层,而是通过下面的 loader 行激活。
然后在 ~/.dsh/profiles/web/cordis.patch.yml 增加一行插入:
- insert:
- id: dsh-plugin-request-retry
name: 'dsh-plugin-request-retry'
重启 dsh web(client-modules 按进程缓存包裁决,新包必须重启宿主),然后硬刷新页面,
设置面板即出现「请求重试」页。
验证
curl -s http://127.0.0.1:3080/plugins/dsh-plugin-request-retry/client.js | head -c 60
curl -s http://127.0.0.1:3080/dsh-plugin-request-retry/config
第一条应输出 window.__ModuleLoader__.load({ 开头的 factory bundle;第二条应返回当前配置 JSON;
打开 设置 → 请求重试 可管理关键词与参数。
更新
dsh plugin --profile web add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
# 或:npx @deepseek-ai/dsh plugin --profile web add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
# 或:cd ~/.dsh/profiles/web && corepack pnpm add "github:c-ling/dsh-plugin-request-retry#v1.0.0"
用新的 #v 重新执行安装命令即可升级依赖;cordis.patch.yml 中的 loader 行保持不变。
重启 dsh web,然后硬刷新页面。
卸载
cd ~/.dsh/profiles/web
corepack pnpm remove dsh-plugin-request-retry # 或 dsh plugin --profile web remove dsh-plugin-request-retry
同时删除 cordis.patch.yml 中对应的 insert 行,然后重启 dsh web。
配置数据保留在 $DSH_HOME/storages/dsh-plugin-request-retry/ 下,需要可手动清理。
开发
node --check lib/index.js lib/client.js
node --test
宿主侧为普通 Cordis 插件:监听 agent/request-error,通过 webServer 服务暴露 GET/POST
/dsh-plugin-request-retry/config。客户端为手写 factory-CJS bundle(无构建步骤),通过
settings.section 插槽注册设置页,inject: ["slots", "locale"] 保证 fiber 在服务就绪后 apply,
文案经 locale 服务注册中英字典并实时切换。
已知限制
- 关键词匹配基于子串,极端情况下可能对非瞬时失败多试几次(可在设置里调整关键词或关闭追加)。
- 追加重试沿用失败 step 的原始上下文原地重发;若失败源于确定性错误(如鉴权失效),重试仍会失败并在次数用尽后照常报错。