bainianlaoyao/dsh-session-robustness

Plugin插件 Native原生 ⭐ 2 MIT Sessions & Context会话与上下文

DSH plugin: after official llm-retry (n/5), keep retrying transient API failures on the same open step until success, cancel, or pause.

Project Overview项目介绍

dsh-session-robustness is a DeepSeek Harness plugin that extends the host's agent/request-error waterfall to keep retrying transient adapter failures after the official dsh-llm-retry budget of five normal-mode attempts has been spent, so a single turn no longer dies simply because of an SSE timeout, a 5xx, an empty response, a rate-limit, or a STREAM_CLOSED / MALFORMED_RESPONSE / STREAM / HTTP_408/409/425/429/499/5xx / stream_read_error event from pi-ai. It also treats gateway messages such as Upstream request failed and heuristic strings inside PI_AI_ERROR / UNKNOWN (Codex overloaded, try again later, service unavailable) as retryable, while permanent codes — AUTH, MISSING_CREDENTIAL, INVALID_CREDENTIAL, QUOTA, CONTEXT_WINDOW_EXCEEDED, NO_ADAPTER, ABORTED — are never retried and CONTEXT_WINDOW_EXCEEDED is still handed to the official compactor. The plugin hooks the same open turn / same open step and does not wrap ctx.llm.stream(), so failed partial chunks never leak into the model-visible history.

The intended workflow starts with dsh plugin --profile web add dsh-session-robustness (or add github:bainianlaoyao/dsh-session-robustness for the GitHub build, or a local path under --profile web add D:/Data/DEV/dsh/dsh-session-robustness for development), after which the user restarts the web profile and opens Settings → Session Robustness to leave it enabled with maxRetries: 0 (unlimited retries beyond the official five). While the official executor is still active, the chat surface shows the existing "retried model request (n/5)" counter; once it hits 5/5 the composer displays "official 5 attempts used, taking over attempt N", and the user can pause on the spot without uninstalling. A positive integer cap on top of the official five, plus initialDelayMs, maxDelayMs, jitterRatio and an optional extraRetryableCodes array, can also be written into session-robustness inside $DSH_HOME/settings.yaml.

It is built for DSH-only deployments: the package declares dsh.bundle.patch and dsh.client, the manifest topic is dsh-plugin, it does not modify the upstream @deepseek-ai/dsh-llm-retry npm package so upstream upgrades are preserved, and it only manipulates the openai-codex previous_response_id reuse on failed streams from 0.1.6 onward — other providers are untouched. Parent sessions and in-process child agents share the same waterfall and are all taken over, while out-of-process or ACP child agents are not. Permanent errors are still refused even when their message contains "try again", user Stop / cancel halts retries immediately, and npm test provides a static smoke test covering waterfall takeover, never-retry codes and the HTTP→JSON bridge. The repository is MIT-licensed; uninstall via dsh plugin --profile web remove dsh-session-robustness, and remember to delete the leftover session-robustness block from settings.yaml.

dsh-session-robustness 是一款面向 DeepSeek Harness 的官方重试扩展插件,针对瞬时接口失败继续接续重试。它挂在 host 组合的 agent/request-error waterfall 上,位于官方 dsh-llm-retry 之后、compaction 之前,在官方 5 次默认重试耗尽后接管后续回合;其自身不包装 ctx.llm.stream(),失败分片不会进入模型可见历史。覆盖的失败码包含 EMPTY_RESPONSE、RATE_LIMIT、SERVER、TIMEOUT、TRANSPORT,并额外把 STREAM_CLOSED、MALFORMED_RESPONSE、STREAM、HTTP_408/409/425/429/499/5xx、stream_read_error、网关文案 Upstream request failed、以及 PI_AI_ERROR/UNKNOWN 中的瞬时故障文案(如 Codex overloaded)一并视为可重试。

典型工作流是开发者使用 web profile 安装并启用插件,遇到官方 5 次重试用尽时,composer 上方会出现“官方 5 次已用完,正在接管第 N 次”提示,可以当场暂停;父会话与 in-process 子 agent 都会被同一 waterfall 接管,进程外或 ACP 子 agent 不在其列。它面向习惯长跑 turn 的 DSH 用户、跑 OpenAI Codex 长会话的工程师,以及不想换模型也不想发“继续”来续命的重度使用者。停用方式包括在设置页里直接关闭插件,不必卸载,并支持 enabled / paused / maxRetries / initialDelayMs / maxDelayMs / jitterRatio / extraRetryableCodes 配置项;永久错误(AUTH、QUOTA、CONTEXT_WINDOW_EXCEEDED 等)永不重试。

依赖方面,包声明 dsh.bundle.patch 加 dsh.client,需 dsh-base 已启用并使用 dsh plugin --profile web add 安装或从 GitHub 直接加载;安装后必须重启 web profile 才会在设置页出现“会话鲁棒性”入口。运行时只观察 llm/stream,不修改官方 npm 包,覆盖升级不会被清掉;0.1.6 起仅 openai-codex 会丢弃失败流的 previous_response_id 续写,其它 provider 不动。卸载通过 dsh plugin --profile web remove 完成,但 session-robustness 配置段会留在 $DSH_HOME/settings.yaml 里需手动删除,仓库以 MIT 协议开源并自带 npm test 静态冒烟测试。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-session-robustness

把 bainianlaoyao/dsh-session-robustness 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-robustness

工程级会话鲁棒:当一次 turn 的模型请求因 超时 / 传输 / 限流 / 5xx / 空响应 / SSE 断流 失败时,不要在官方默认的「再试五次」之后把会话掐死,而是 继续重试直到成功、你取消、或你暂停。

这不是客户端发「继续」续跑,也不是换模型。它接在官方 dsh-llm-retry 后面,在同一个打开的 step 上重跑同一条请求。

为什么需要它

DSH 已经有官方重试执行器 @deepseek-ai/dsh-llm-retry:

  • 挂在 host 组合里(dsh-base 已启用)
  • 策略写在每个 provider 的 retryPolicy 上
  • 省略时是 mode: normal,默认 maxRetries = 5
  • 合格 code:EMPTY_RESPONSE / RATE_LIMIT / SERVER / TIMEOUT / TRANSPORT(官方);本插件额外无条件覆盖 STREAM_CLOSED / MALFORMED_RESPONSE / STREAM / HTTP_408 / HTTP_409 / HTTP_425 / HTTP_429 / HTTP_499 / HTTP_5xx

所以一次 TIMEOUT 通常是:界面「已重试模型请求 (n/5)」,5/5 之后 agent/request-error 不再返回 { kind: 'retry' },loop 把失败当成终态,turn 结束。

官方也有 retryPolicy.mode: always(无次数上限、连 AUTH/QUOTA 也会一直重)。本插件 不走那条路:永久错误等也没用,无限重试会把会话挂死并烧钱。本插件只覆盖瞬时 API 失败。

行为

adapter 流失败
  → agent/request-error waterfall
    → compaction(只处理 CONTEXT_WINDOW_EXCEEDED)
    → dsh-llm-retry(normal:合格 code 最多 5 次)
    → 本插件(官方预算耗尽后,瞬时失败继续重试)
  • 每次重试都在 同一个打开的 turn / 同一个 step 上重跑,失败分片不会进入模型可见历史
  • 退避:指数 + 抖动;提供方 Retry-After 在上限内优先
  • 用户点 Stop / 取消 turn:立即停止
  • 设置页可暂停 / 关闭,不必卸插件
  • 父会话和 in-process 子 agent 共用 host 上的 agent/request-error waterfall,都会接管。进程外 / ACP 子 agent 不会。

永不重试:AUTH、MISSING_CREDENTIAL、INVALID_CREDENTIAL、QUOTA、CONTEXT_WINDOW_EXCEEDED、NO_ADAPTER、ABORTED。上下文溢出仍交给官方 compaction。用户 Stop 不会被重试。

0.1.3 起,能进 agent/request-error 的网络失败一律无条件重试,不再依赖文案:SSE 对端关闭(STREAM_CLOSED,例如 ended without [DONE])、半截 JSON(MALFORMED_RESPONSE)、Responses 未识别流失败(STREAM)、HTTP 408/409/425/429/499/5xx。0.1.5 起还包括适配器原样透传的 stream_read_error,以及网关文案 Upstream request failed(pi-ai 常落成 PI_AI_ERROR)。PI_AI_ERROR / UNKNOWN / 未知码仍用文案启发式(Codex overloaded、Upstream request failed 等)。HTTP_400 / INVALID_REQUEST / CONTENT_FILTER 仍不重试。

进不了 waterfall 的失败本插件也接不到:prepareCall 抛错、标题/摘要走的 ctx.llm.stream()、工具调用失败。

0.1.6 起,只对 openai-codex:流失败后丢掉该会话的 WebSocket 续写(previous_response_id)。pi-ai 的 websocket-cached / auto 会把失败流上的 response.id 当成续写锚点,API 已经恢复也会一直钉在那个不完整的响应上。官方那 5 次重试也会清(只观察 llm/stream,不在流内重试)。成功回合的续写保留;服务端 prompt cache 和会话历史不受影响。其它 provider 不动。

Codex overloaded 为什么也要覆盖

openai-codex 走 pi-ai。上游 SSE 事件 error / response.failed 会变成:

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-sidebar-plus 下一个 Next dsh-fresh-start →