rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:xalor888/dsh-unlimited-retry
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English · 简体中文
Unbounded model-request retry for the DeepSeek Harness agent loop, with a live Settings panel.
A long unattended run should not die because one request hit a transient network error. This plugin keeps such a request retrying — exponential backoff, with a delay ceiling — until it succeeds or you stop it.
Standard DSH bundle plugin, one-command install. The same package supports both the DSH Web UI and the official desktop client (Electron).

Figures above are sample data. The layout, copy, and controls are the plugin's own.
This repository maintains one product line (main). The same package supports
both surfaces.
| Surface | Install |
|---|---|
| DSH Web UI | Open the Plugins page, click Add plugin, and enter dsh-unlimited-retry — or run dsh plugin --profile web add dsh-unlimited-retry in a terminal |
| Official desktop client (Electron) | Open the Plugins page, click Add plugin, and enter dsh-unlimited-retry |
Both surfaces ship the plugin manager, so the shortest path is the same:
dsh-unlimited-retry (or dsh-unlimited-retry@<version> to pin one).The dialog accepts npm packages, Git repositories, and local directories, so the
same box also takes github:xalor888/dsh-unlimited-retry or a link: path.
dsh plugin --profile desktopThe desktop client reads a profile named desktop, which is reserved for the
Electron application — the CLI refuses to touch it on purpose:
error: profile "desktop" is managed exclusively by the Electron application
A --profile web install therefore lands in the web profile, while the desktop
window reads desktop, so nothing appears. The UI path above is scoped to
whichever profile the running app actually owns, which is why it is the one to
use.
Why the desktop works: the desktop profile is the Web template (
base+web-app), and Electron loads the local Web UI URL. Thedsh.clientpanel is therefore loaded byclient-modulesthere too — no separate client build.The
dsh webcommand line uses its ownwebprofile: restart the host after an update, then hard-reload the browser (Ctrl+F5, orCmd+Shift+Ron macOS) to bypass the cache.
DSH ships @deepseek-ai/dsh-llm-retry, but it only executes retries — the
budget lives on each provider adapter's retryPolicy. Its default
mode: "normal" gives up after maxRetries (5 in this build) and then
delegates, so the step fails, the turn closes with an error, and the run ends.
mode: "always" exists but is all-or-nothing per provider and has no delay
ceiling.
This plugin adds a layer behind all of them. agent/request-error is a
waterfall event and Cordis runs listeners outermost-first, so the
last-registered listener is the deepest: every other recovery gets the first
word, and only a failure that nobody recovered reaches this plugin.
With the stock 5-retry provider policy the effective order is:
| Attempt | Handled by | Behaviour |
|---|---|---|
| 1 – 5 | the provider's retryPolicy |
Its own budget, codes, and delays |
| 6 – ∞ | this plugin | Exponential backoff with jitter, capped at maxDelayMs |
Other layers registering on the same event — context-overflow compaction, image
offload (dsh-compaction-image-offload), any other retry plugin — sit ahead of
this one too. That ordering is the entire reason this plugin registers itself
last, and it is what keeps the provider's own policy authoritative.
It is a Host plugin, not a preset plugin, so it applies to every session the profile starts, under every preset. All of the following was verified against the shipped contracts, not assumed:
| Situation | Applies | Basis |
|---|---|---|
| Any agent preset (standard / ptc / minimal / cordis) | ✅ | Host plugin, preset-independent |
| Sibling agents in one composition | ✅ | Each keeps its own ladder |
| An agent mounted inside a preset scope | ✅ | Real Cordis scope-dispatch test |
| headless / ACP / SDK composition (no Web server) | ✅ retries, no panel | One event listener; no Web service needed |
| DSH Web UI | ✅ | dsh.client panel |
| Official desktop client (Electron) | ✅ | Desktop profile = Web template, same Web UI |
ABORTED (you cancelled) |
❌ never retried, by design | A cancellation is not a fault |
| A request the adapter never admitted | ❌ never reaches the event | No agent/request-error is produced |
| A failure before the loop has a turn | ❌ never reaches the event | Same |
initialDelayMs, doubles, capped at maxDelayMs, with per-delay randomization so synchronized storms cannot formmaxDelayMs wins any conflict. Ask for 10 ms and you get 10 ms — it is never silently raised because initialDelayMs was largerABORTED is terminal at any configuration (see below)providerRetryAfterMs is respected and capped by maxDelayMs, so one provider cannot park the run indefinitelyretryPolicy (toggleable)Each scheduled retry appends two events, in the same order as dsh-llm-retry:
llm/retry — before the wait, so the log shows a wait that really happened;llm/retry-started — after the wait, when the request is actually re-sent.A retry cancelled by an abort or a plugin unload therefore leaves a llm/retry
record with no matching llm/retry-started, which is exactly what happened.
mode is recorded as always, and policyKey is the fixed namespace
unlimited-retry, which cannot collide with a provider budget.

No limit instead of a fabricated capconfigEditor, surviving a restart and hot-reloading the host half--dsw-alias-* tokens, so light/dark and future rethemes follow automaticallyrole="switch" controls with aria-checked; no DOM outside the component treeABORTED: the one unconditional terminal codeA cancellation is not a fault — the turn was stopped, or the process is shutting
down. dsh-llm produces an aborted finish when
signal.aborted || code === "ABORTED", which means an ABORTED failure can
arrive while the loop's own signal is still live.
Retrying it would re-run work you just cancelled, so the guard runs before
excludeCodes and clearing that list does not re-enable it. Code matching is
case-insensitive and whitespace-trimmed on both sides, so Aborted, ABORTED
and aborted are the same code.
The panel states this rule explicitly, so it never looks like a setting was silently ignored.
autoRetry: true
maxAttempts: null # no per-step attempt limit
initialDelayMs: 1000
maxDelayMs: 60000
jitterRatio: 0.2
retryWithoutProviderPolicy: true
retryCodes: # the set the Harness itself retries
- EMPTY_RESPONSE
- RATE_LIMIT
- SERVER
- TIMEOUT
- TRANSPORT
retryAllCodes: false # true = retry everything that is not excluded
maxRetriesPerTurn: 40 # hard stop across all steps of one turn
excludeCodes: []
recordSessionEvents: true
log: true
markerFile: null
Only the codes the Harness itself declares retryable are retried. That list is
copied from dsh-llm's own DEFAULT_RETRYABLE_CODES rather than invented here:
it is the judgement of the layer that knows what each failure means. Everything
else — auth, quota, billing, context overflow, and any code no adapter
classified — is handed straight back to the loop.
Version 2.x defaulted to the opposite, and it was wrong in a specific and
expensive way: an adapter that cannot classify a stream error reports an opaque
code (dsh-llm-pi-ai calls it PI_AI_ERROR) that also covers its explicitly
non-retryable states, so 2.x retried a permanent fault with no ceiling while the
turn never ended. A code nobody recognised is not evidence that a retry helps.
Two more bounds:
maxRetriesPerTurn (default 40) is a hard stop across all steps of a turn.
The step ladder restarts every step, so without it a fault that survives each
step would begin again at attempt 1 forever.maxAttempts caps per step, exactly as before.Ways to adjust the scope:
Set maxAttempts to a positive integer — this plugin then stops after
that many tries per step and delegates, exactly as if it were not installed.
Widen the scope with retryAllCodes: true, or add a specific code to
retryCodes. Then narrow it with excludeCodes, which always wins.
List codes in excludeCodes. The panel has a one-click Use recommended
set action for the codes where a retry re-sends a request that fails
identically:
AUTH, UNAUTHORIZED, FORBIDDEN, BILLING, QUOTA, ACCOUNT_QUOTA,
MISSING_CREDENTIAL, INVALID_CREDENTIAL, MODEL_NOT_FOUND, NO_ADAPTER,
CONTEXT_WINDOW_EXCEEDED, CONTEXT_OVERFLOW, CONTEXT_LENGTH,
INVALID_REQUEST
IMAGE_OFFLOAD_REQUIREDis deliberately absent:dsh-compaction-image-offloadrecovers it by shrinking the request and registers ahead of this plugin. If it declines, retrying is the correct next move.
A cleared numeric field falls back to its default rather than being read as
zero — Number(null) is 0, which for a delay is a busy loop and for jitter is
no jitter at all.
# Web UI
dsh plugin --profile web add dsh-unlimited-retry
For the official desktop client, use the in-app Plugins → Add plugin dialog
instead — see Where to install it. The CLI refuses
--profile desktop by design.
dsh plugin --profile web add github:xalor888/dsh-unlimited-retry
⚠️ The npm name and the
github:spec are the same package name — don't mix them; installing both leaves conflicting entries. If you installed viagithub:, rundsh plugin --profile web remove dsh-unlimited-retryfirst.
dsh plugin --profile web add link:/absolute/path/to/dsh-unlimited-retry
Then open Settings → Retry.
If the panel does not appear, check the host half and the client half separately:
~/.dsh/adapters/unlimited-retry/mounted.json exists and its
version is the version you meant to install;/plugins/??dsh-unlimited-retry/client.js&rev=… returns 200
in the browser (or the desktop's devtools).Host half present but client half missing is a cache problem — hard-reload
(Ctrl+F5, or Cmd+Shift+R on macOS). If the host half is absent, the plugin
never mounted: go back to the install step and confirm which profile you
installed into.
dsh-unlimited-retry/
├── package.json # bundle metadata (dsh.bundle.patch / dsh.client / icon / exports)
├── cordis.patch.yml # mount declaration, with every default
├── icon.svg # plugin-list icon (the host reads it as a data URL)
├── index.js # host half: listener, backoff, session events, counters, routes, Config schema
├── client.js # browser half: the Settings panel (browser bundle format)
├── locale/
│ ├── en.json # display title/description (English)
│ └── zh.json # display title/description (Chinese)
├── test/
│ ├── host.test.mjs # retry decision path + every endpoint
│ ├── client.test.mjs # panel registration, i18n parity, rendering, states
│ ├── bundle.test.mjs # package shape, patch completeness, icon, license
│ └── projection.test.mjs # integration against the real projection service + dispatcher
├── README.md / README.zh.md
└── LICENSE
Edit the config block on the unlimited-retry row, or use the panel. An
override anywhere above the bundle patch replaces the whole config, so a
layer that overrides this row must restate every field it wants to keep.
The plugin also exports a Config schema, so its fields appear in
Config.listConfigs and are validated by the Loader.
| Field | Type | Default | Purpose |
|---|---|---|---|
autoRetry |
boolean | true |
Turn off to leave every failure to the loop |
maxAttempts |
number | null | null |
Cap per step; null/empty means no limit |
initialDelayMs |
number | 1000 |
First backoff delay; clamped by the ceiling |
maxDelayMs |
number | 60000 |
Single-delay ceiling; wins any conflict |
jitterRatio |
number | 0.2 |
Randomization per delay (0–1) |
retryWithoutProviderPolicy |
boolean | true |
Also retry when the adapter published no policy |
retryCodes |
string[] | the five retryable Harness codes | Codes this plugin retries; anything else is left to the loop |
retryAllCodes |
boolean | false |
Retry every code that is not a cancellation or an exclusion |
maxRetriesPerTurn |
number | null | 40 |
Hard stop across all steps of one turn; null = no turn ceiling |
excludeCodes |
string[] | [] |
Always-terminal codes (case/whitespace-insensitive); wins over retryCodes |
recordSessionEvents |
boolean | true |
Append llm/retry / llm/retry-started |
log |
boolean | true |
Write retry decisions to the DSH log |
markerFile |
string | null | null |
Optional mount-probe path (diagnostics) |
The host half adds three routes. They register through the DSH Web server and
therefore apply the same browser admission check the rest of the composition
uses: an unauthenticated browser request gets 401, an untrusted origin gets
403. Unlike a plain route handler, these do not silently bypass the cookie
gate.
| Route | Method | Purpose |
|---|---|---|
/unlimited-retry/stats |
GET, HEAD |
The read model the panel renders |
/unlimited-retry/config |
POST |
Validate and persist a policy change |
/unlimited-retry/reset |
POST |
Clear the counters ({"confirm": true} required) |
Writes return 403 when the composition exposes no admission service, and 409
when the row is not addressable or there is no configEditor. Bodies are capped
at 8 KiB and must be application/json.
These routes are a convenience for the panel. The retry behaviour never depends on them, so a headless / ACP / SDK composition mounts the policy with no routes at all.
npm test # or node --test test/
Covers the retry decision path (delegation, exclusion, attempt limits, provider
delays, abort, dispose, per-step reset, legacy 1.x config keys), every endpoint
(status codes, HEAD, admission, body validation, unknown keys, the preset,
reset confirmation, a failing editor), the client bundle (registration, i18n
parity and placeholder parity, rendering, error/empty/read-only states,
token-only styling), the package shape (manifest, patch completeness, icon,
license), and integration tests against the real projection service and the
real Cordis dispatcher.
To verify a live mount (an unauthenticated 401 there is correct — open the
authenticated GUI URL and read the panel):
curl -s http://127.0.0.1:3080/unlimited-retry/stats | head -c 400
| Requirement | Value |
|---|---|
| Node.js | >= 20 |
| DSH | >= 0.2.0-0 < 0.3.0-0 (engines.dsh, enforced by the host's compatibility preflight). Verified against 0.2.1-rc.3, 0.2.1-rc.5, 0.2.2-alpha.2, 0.2.2-rc.1 and 0.2.2-rc.3 |
Ships dsh-agent-loop and dsh-llm-retry |
Yes — the retry listener hangs off that event |
The session-projection reader adapts to both registration shapes the Host has
shipped: the disposer returned before 0.2.2, and the callable thenable returned
from 0.2.2 on, whose typeof is "function" while it still carries then.
The handle is preferred where it exists, so no deprecated read is performed on a
runtime that deprecated it.
The -0 lower bound in engines.dsh is deliberate: the host matches with
includePrerelease: true, and only a boundary carrying a prerelease tag admits a
prerelease runtime such as 0.2.1-rc.3. A plain >=0.2.0 would silently exclude
every -rc build.
AbortSignal.any is used when present; a controller-based fallback covers runtimes without it.config still mounts: retryAllCodes is ignored and terminalCodes is read as excludeCodes, each with a one-line warning naming the replacement.configEditor and the settings.section slot. Without them the policy still applies; the page is simply absent or read-only.Codes are not the only evidence. When a failure's code is not one this plugin
recognises, it reads the message, because a provider that namespaces its own
errors — InferHub.ModelArts.81001.400 is one observed shape — can never match a
Harness literal, and a policy built only from literals therefore degrades to
"retry nothing" for exactly the providers most likely to be flaky.
| Evidence in the message | Verdict |
|---|---|
rate limit, concurrency limit, too many requests, timeout, connection reset, socket hang up, 502/503/504 |
retry |
invalid argument, invalid request, unsupported, context length, payload too large, unauthorized, quota, billing |
terminal |
| HTTP 400 except 408/409/425/429, and any other 4xx | terminal |
| HTTP 429, 408, 409, 425, and any 5xx | retry |
| nothing recognisable | terminal, and listed in the panel |
Transient evidence is checked before permanent evidence on purpose: a gateway can
wrap a recoverable condition in a 4xx (the local tier_limit_exceeded ... concurrency limit exceeded failure arrived as a generic upstream error), and wrongly declining
a transient failure strands a working turn, while wrongly retrying a permanent one is
bounded by the turn ceiling.
Turn this off with classifyTransientFailures: false to restore literal-only
matching.
Nothing here is silent. Every refusal lands in a Left to the loop table in the
panel with its code, its reason, and its original message, plus a one-click
Retry this code too button that adds it to retryCodes.
A retry here re-issues the model request only. It never re-runs a tool.
That is structural, not a promise: agent/request-error is emitted by
dsh-agent-loop at exactly one place — when the assistant stream finished
with kind === "error" or "aborted" — and the loop's tool execution happens
after a message has been produced. A tool that throws never becomes a
request-error; it becomes a tool/result error and is thrown by the loop.
Verified against real transcripts rather than by reading code: across 41 recorded
retries in the local session store, 41 were preceded by assistant/attempt —
the failed stream settlement — and none by tool/result.
So if a turn appears to loop while calling the same tool, the loop belongs to the model or to the tool, not to this plugin:
dsh-repeat-tool-reminder
exists for;3.0.0 fixed over-retry by allowing only five codes — and over-corrected. A provider
that namespaces its errors (InferHub.ModelArts.81001.400) never matches a literal,
so that provider stopped being retried for anything at all, transient or not.
CodeArts: Invalid Argument 400 stays terminal — the bytes are wrong,
so the same bytes get the same 400. That part of the 3.0.0 decision was right.classifyTransientFailures turns the message reading off if you would rather judge
by code alone.Breaking: the retry scope was inverted. 2.x retried every code except a
cancellation. In practice that meant an adapter that could not classify a stream
error (PI_AI_ERROR) — which also covers its explicitly non-retryable states —
was retried with no ceiling, and a turn whose fault survived each step never
ended. Real transcripts show the ladder advancing step after step against the same
tier_limit_exceeded condition.
EMPTY_RESPONSE, RATE_LIMIT,
SERVER, TIMEOUT, TRANSPORT). Anything else — including an unclassified
code — is left to the loop.retryCodes and retryAllCodes make the scope explicit and reversible.
excludeCodes still wins over both.maxRetriesPerTurn (default 40) stops a fault that survives every step, which
the per-step ladder alone could never catch.tool/result predecessor among them.If you relied on 2.x's behaviour, set retryAllCodes: true. The panel's
"What gets retried" card makes that a switch rather than a config edit.
Publishing is tag-driven; nothing publishes from a branch, and no npm credential is stored anywhere. The workflow authenticates with trusted publishing: npm verifies a short-lived OIDC token that GitHub issues to this job, matched against the repository and workflow file registered on the package.
# 1. bump the version in package.json (and PLUGIN_VERSION in index.js)
npm version patch --no-git-tag-version # or minor / major
# 2. land it, then tag the merged commit
git tag v2.1.3 && git push origin v2.1.3
The Release workflow then refuses a tag that disagrees with package.json, tests
the tree, packs, publishes with npm provenance, creates the GitHub release with the
tarball attached, and finally re-installs the published version from the registry
to prove that copy mounts. It needs no secret: only id-token: write, which the
workflow already declares.
CI runs the suite on Node 20, 22 and 24, then packs the tarball, asserts the
published file set has not drifted, installs it into a clean project, and mounts
the installed host half — including the rule that a cancellation never retries.
The integration suite (
test/projection.test.mjs) mounts a real Harness, which CI has none of, so it skips there. Run it locally withDSH_INSTALL_DIR=~/.local/lib/node_modules/@deepseek-ai/dsh/node_modules npm test.
MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。