rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
HsiangNianian/dsh-auto-continue
DSH Web UI plugin: auto-sends 「continue」 after non-human interruptions, with error classification, adaptive backoff, pause, idempotency/loop guards, resume templates, and stats—all configurable in settings UI | DSH 前端 UI 插件:非人为中断后自动发送「继续」,支持错误分类、自适应退避、暂停、幂等/循环保护、续跑模板与统计,均可在设置界面配置
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:HsiangNianian/dsh-auto-continue
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A DeepSeek Harness plugin that resumes interrupted sessions for you, with an optional autonomous loop.
English · 中文 · Русский · Changelog
When a turn fails with a recoverable error, hits the output limit, ends without visible output, or is cut off by a host restart, the plugin waits a few seconds and sends a continue message for you. It runs inside the DSH host, so it keeps working after you close the browser tab, and all tabs share one engine.
DSH plugins install into a profile; dsh web uses the web profile. In the desktop app, install from its Plugins page instead of the CLI.
dsh plugin --profile web add dsh-client-auto-continue@latest
dsh web
Restart DSH and reload the browser after installing. Then open Plugins → dsh-client-auto-continue from the main sidebar to check that it is Running.
To update, let running work finish, stop DSH, run the same command again, then restart DSH and reload the browser. Your settings stay in the profile. The desktop app has its own profile: update it from the app's Plugins page.
| DSH runtime | Plugin version | Settings location |
|---|---|---|
| 0.2.2-rc.1, 0.2.1-rc.2, 0.2.1-alpha.1 | 0.20.1 verified | Plugins → dsh-client-auto-continue |
| 0.2.0-rc.1 | 0.12.1 or newer | Plugins → dsh-client-auto-continue |
| 0.1.7-rc.2 | 0.11.9 or newer | Plugins → dsh-client-auto-continue |
| Older hosts with the legacy settings API | legacy UI | Settings → Plugins → Plugin configuration |
DSH 0.1.0-rc.6 and earlier are not supported. Plugin 0.11.9 and 0.12.0 are rejected by DSH 0.2.0-rc.1's version check (#50). The desktop app's version is not the DSH runtime version; check the runtime (dsh --version for the CLI).
main)Built files are committed, so no clone or build is needed:
dsh plugin --profile web add github:HsiangNianian/dsh-auto-continue
dsh web
This follows the main branch rather than releases. To switch install sources, run dsh plugin --profile web add <other-spec>; the profile dependency is replaced in place.
Use Node.js 22.
git clone https://github.com/HsiangNianian/dsh-auto-continue.git
cd dsh-auto-continue
npm ci
npm run build
dsh plugin --profile web add "link:$(pwd)"
dsh web
The package ships its own cordis.patch.yml (dsh.bundle.patch), so the plugin registers itself. After editing the code, run npm run build, restart DSH and reload the browser.
Older setups used a symlink plus a hand-written insert row in the loader config. That can start the engine without showing the plugin on the Plugins page.
Let running work finish and stop dsh web. Back up package.json, cordis.patch.yml and pnpm-lock.yaml in ~/.dsh/profiles/web/, and ~/.dsh/settings.yaml if it exists (use $DSH_HOME instead of ~/.dsh if you set it).
In cordis.patch.yml, remove only the hand-written auto-continue row inside an insert list (and the list if it becomes empty). Keep a top-level - id: auto-continue entry with config:; that is your settings.
Install with the npm or GitHub command above. The profile's package.json should now list dsh-client-auto-continue under dsh.profile.bundles.
If you had settings in the old settings.yaml auto-continue section, merge them into the profile's cordis.patch.yml entry:
- id: auto-continue
config:
cooldownMs: 45000 # your own saved value
Start dsh web, reload the browser, open Plugins → dsh-client-auto-continue and check your values.
On hosts that offer both profile config and the legacy settings API (#64), the plugin imports the auto-continue section of $DSH_HOME/settings-legacy.yaml once per profile. Values already in the profile win, and the old file is left untouched. Recovery waits until the import is done; if the import fails, the host logs an error and recovery stays held until you fix the file or permissions and restart.
The include:auto-continue label under Built-in plugins is the normal loader prefix, not a sign of a duplicate install.
# the composed config should contain exactly one auto-continue entry
dsh --profile web --dump-config | grep -A 4 'id: auto-continue'
# uninstall
dsh plugin --profile web remove dsh-client-auto-continue
Also remove the - id: auto-continue entry from the profile's cordis.patch.yml, if there is one, then restart DSH.
Recovery is on by default. Nothing else needs to be set up.
The Auto-continue switch next to the message box applies to the current conversation only. The menu beside it picks a mode:
| Mode | What happens |
|---|---|
| Follow default | Uses Default session mode from the settings (Recovery only unless you change it) |
| Off | No automatic messages and no loop-guard interruptions in this conversation |
| Recovery only | Recovers errors, output limits, silent turns and restart interruptions; leaves normal completions alone |
| Autonomous loop | Also continues after every normal completion, using the loop text |
Turning the switch off selects Off; turning it on again selects Follow default. Choices are saved on the host right away (sessionModes), sync across tabs and survive restarts. Switching a conversation to Off cancels anything waiting to be sent but lets a running turn finish.
In a narrow window the label and menu collapse to an icon. DS-Bot and dsh-pocket get the same compact layout up to 640 CSS pixels. To hide the controls, turn off Show auto-continue switch in the composer in General and save; this does not change any session's mode.
The Status and logs category shows today's counts (continue messages, recoveries, failures, skipped errors, give-ups, loop breaks, by error code, with a reset button), the last 20 recovery attempts grouped by session, and the sessions that are currently paused. These live in host memory and reset when the plugin restarts. With Verbose logs on, every decision is logged with an [auto-continue] prefix in the DSH log (the terminal running dsh web for the CLI).
Open Plugins → dsh-client-auto-continue from the main sidebar and pick a category. (Settings → Built-in plugins only lists component status; it is not the editor.) Edits are staged and take effect when you click Save; switching categories keeps your drafts, invalid values block the save, and Reset to default removes an override.

Settings are stored in the auto-continue entry of the active profile patch, ~/.dsh/profiles/web/cordis.patch.yml for the default web profile (older hosts: ~/.dsh/settings.yaml, under auto-continue:). You can edit the file directly; omitted keys use their defaults:
- id: auto-continue
config:
cooldownMs: 45000
resumeCompletedTurns: true
loopMaxIterations: 20
Times are in milliseconds. Text fields left empty use the built-in text in the current language.
| Setting | Key | Default | Notes |
|---|---|---|---|
| Enable auto-continue globally | paused |
false |
Stored inverted: paused: true stops all automatic messages and cancels queued ones |
| Show auto-continue switch in the composer | showComposerToggle |
true |
Only hides or shows the controls |
| Send continue messages with plugin source | usePluginSource |
false |
Off sends as the user source; on marks messages as plugin:dsh-client-auto-continue |
| Resume silent turns | resumeSilentTurns |
true |
Resume turns that had model activity but no visible output; they still count toward Max consecutive |
| Resume subagent sessions | resumeSubagentSessions |
false |
Resume a failed, cut-off or silent subagent, using its main conversation's mode. When DSH already disposed the child, the engine cold-resumes it from its persisted session through the host subagent service; if the host cannot resume it, the failure is handed to the main conversation instead |
| Default session mode | resumeCompletedTurns |
false |
false = Recovery only, true = Autonomous loop, for sessions on Follow default |
| Autonomous loop round limit | loopMaxIterations |
0 |
Loop rounds per session, 0 = no limit. Resets when you send a message or turn the loop back on |
| Browser notifications | notify |
false |
Notifications for sends, skips, give-ups and saved settings. The browser asks for permission the first time |
| Setting | Key | Default | Notes |
|---|---|---|---|
| Grace period (ms) | graceMs |
3000 |
Wait before sending; a new turn or your own message cancels it |
| Cooldown (ms) | cooldownMs |
20000 |
Minimum gap between recovery attempts in one session. A failure during cooldown waits for the rest of it |
| Max consecutive | maxConsecutive |
3 |
Attempts before giving up. Resets when you send a message or a turn ends with visible output. Loop continuations after normal completions do not count |
| Classify errors | classify |
true |
Retry transient errors only; skip permanent ones. Off = retry every error |
| Custom retryable errors | retryableErrorPatterns |
'' |
One literal per line, case-insensitive, matched against code, HTTP status and message. Overrides the built-in classifier |
| Backoff factor | backoffFactor |
2 |
Cooldown multiplier per consecutive failure (20 s → 40 s → 80 s) |
| Max backoff (ms) | backoffMaxMs |
300000 |
Upper bound for the cooldown |
| Pause while offline | pauseWhenOffline |
true |
Hold network-error retries while the host is offline, without using up attempts |
| Offline re-check interval (ms) | offlineCheckMs |
15000 |
How often a held retry checks the network. Minimum 1000 |
| Re-arm goals disarmed by a restart | resumeGoals |
false |
After a continue message, re-arm an active goal the restart disarmed. This acts on your behalf, hence off |
| Resume paused goals | resumePausedGoals |
false |
Also resume goals you paused by hand. Needs resumeGoals |
| Setting | Key | Default | Notes |
|---|---|---|---|
| Scan on host startup | scanOnBoot |
true |
Look for interrupted sessions, open or stored, after the host starts |
| Wake child sessions after restart | resumeInterruptedChildren |
false |
Send each root session one message listing its interrupted subagent or team-member sessions |
| Scan limit | scanLimit |
8 |
Recoveries per scan pass, most recently active first |
| Scan window (ms) | freshMs |
900000 |
Only interruptions newer than this are recovered; scanning also stops after this long |
| Setting | Key | Used when |
|---|---|---|
| Continue text | continueText |
A turn failed with an error |
| Continue text (max tokens) | continueTextMaxTokens |
The output token limit was reached |
| Continue text (silent turn) | continueTextSilent |
A turn ended with reasoning only |
| Continue text (after harness restart) | continueTextInterrupted |
The startup scan resumes a turn a restart cut off |
| Continue text (autonomous loop) | continueTextLoop |
Each autonomous-loop round |
| Guard text (unconfirmed result) | guardPendingText |
Appended when the last tool call may not have finished |
| Guard text (tool succeeded) | guardDoneText |
Appended when the last tool call succeeded |
| Loop text | loopText |
The loop guard restarted a turn |
All default to '', which means the built-in text. Continue texts accept {code}, {message}, {status}, {tool}, {turn}, {errorCount} and {elapsed}; for example Continue ({tool}: {code}) becomes Continue (git push: UPSTREAM). Guard texts and the loop text accept {tool}, and guardDoneText also {result} (a short excerpt of the tool output).
Built-in texts exist in English, Chinese and Russian. They follow the DSH language: zh and zh-* use Chinese, ru and ru-* use Russian, every other locale uses English. Your own non-empty text is never replaced when the language changes.
| Key | Text |
|---|---|
continueText, continueTextMaxTokens, continueTextLoop |
Continue |
continueTextSilent |
Continue. Your previous turn ended with internal reasoning only, with no message and no tool call, so nothing reached the user. Always finish a turn with a tool call or a visible answer. |
continueTextInterrupted |
Continue. The harness was restarted while your previous turn was still running; tool calls pending at the restart are recorded with unknown outcomes. Resume where you left off, verifying external state before retrying anything that may have side effects. |
guardPendingText |
(The previous tool "{tool}" may not have completed. Check its state before continuing and do not run it again.) |
guardDoneText |
(The previous tool "{tool}" completed successfully. Result: {result}; do not run it again. Continue from there.) |
loopText |
(You may be stuck in a loop. Stop repeating the last action and continue with a different approach.) |
| Setting | Key | Default | Notes |
|---|---|---|---|
| Idempotency guard | guardTools |
true |
Before resuming, tell the model whether the last tool call finished so it does not run it twice |
| Loop guard | loopGuard |
true |
Cancel a running turn that repeats itself and restart it with the loop text |
| Short-sentence max (chars) | loopShortChars |
40 |
Messages shorter than this count as short sentences |
| Short-sentence window (ms) | loopWindowMs |
30000 |
Window for counting short sentences. Minimum 1000 |
| Short-sentence threshold | loopShortCount |
12 |
Short sentences in the window, with no tool call, that trip the guard |
| Identical message count | loopRepeatText |
4 |
Identical messages in a row (or repeated paragraphs within one streamed message) that trip the guard |
| Same-tool repeat count | loopToolRepeat |
5 |
Calls of the same tool with identical arguments and results that trip the guard |
| Setting | Key | Default | Notes |
|---|---|---|---|
| Verbose logs | verbose |
true |
Log decisions with the [auto-continue] prefix |
Two keys are written by the plugin itself: locale (mirrors the DSH language, default en) and sessionModes (per-session choices from the composer, default {}). You normally do not edit them.
With Classify errors on, network errors, timeouts, HTTP 5xx and 429 are retried. HTTP 401 and 403, and codes or messages about auth, credentials or API keys, balance or quota, unknown models, or context length are treated as permanent and skipped (with a notification if enabled). MALFORMED_RESPONSE is always retryable unless it carries an explicit 401 or 403.
If a provider returns an error that you know is safe to retry (check first that typing "continue" by hand works), add a narrow, stable fragment instead of turning classification off:
- id: auto-continue
config:
retryableErrorPatterns: |-
Upstream rejected the request as invalid
Patterns are plain substrings, not regular expressions. Cooldown and Max consecutive still apply.
turn/end with error, max-tokens, a silent ending, or completed (loop mode only) starts the flow. After a host restart, the startup scan checks open and stored sessions every 3 seconds until the scan window ends. The loop guard watches running turns and cancels one that repeats itself.blocked) are left alone, and so are permanent errors. Everything else recoverable goes to recovery. A normal completion only continues in Autonomous loop mode, which skips the cooldown and the consecutive limit but respects loopMaxIterations.graceMs. A new turn or a message from you cancels the send.offlineCheckMs, then goes through grace and cooldown again. With HTTP(S)_PROXY or ALL_PROXY set, only interfaces are checked.agent.followup using the session's preset and model. If user turns are already queued, the continue message is moved ahead of them while their order is kept. With resumeGoals on, a goal the restart disarmed is re-armed.Child sessions. Outside of Resume subagent sessions, subagent and team-member sessions are never resumed directly. With the setting on, a failed child is recovered in two steps: the engine first asks the host to cold-resume the disposed child from its persisted session, delivering the continuation to the child itself, so the main conversation is not woken; when the host cannot resume it (no persistence, no live parent, or a child that is not continuable), the failure is handed to the main conversation as one message, at most once per five minutes. That hand-off stays silent while the main conversation is recovering itself, because any user message cancels its queued continuation. If the main conversation has no live agent at that moment, the hand-off is kept until it is live again. A manual Resume now also cold-resumes a disposed child. After a restart, with Wake child sessions after restart on, the startup scan collects children a restart interrupted (at most 8 child logs per pass) and sends their root session one message listing them, once per batch. The root decides whether to continue or wrap up. A root still mid-turn is left to normal recovery, and a root you stopped yourself is never woken.
Unreadable sessions. If a session's history cannot be read during the startup scan, that session is skipped and an error is logged; other sessions still recover (#58). Repair it and restart DSH within the scan window to try again.
Cold-read budget. A stored session is judged by its whole log, so the sweep decodes one full history per session. To keep a large profile from exhausting the host heap, one host instance reads at most 32 stored logs, most recently active first. The order comes from the projection checkpoint cache (timeContext.lastMessageTime, then sessionListMetadata.lastPromptAt), falling back to the session creation time. Each session counts once, even if its read is retried. The order is the same on every start, so sessions past the budget are skipped rather than queued; they are the least recently active ones, and the freshness window (15 minutes by default) has almost always passed for them. A checkpoint can lag behind a log but never lead it, so it only orders the reads: freshness is still decided by the events at the tail of the log.
| Symptom | What to check |
|---|---|
| "Skipping profile bundle" or "incompatible with dsh 0.2.0-rc.1" | Update to plugin 0.12.1 or newer in the profile the app actually uses, then restart |
| Plugin enabled, but no settings fields | Open the main Plugins page, not Settings → Built-in plugins, and select General |
/api/auto-continue-bridge returns 404 |
The host component did not load. Check the DSH startup log and --dump-config, then reload the page |
| An error was not resumed | Check the global switch and the session mode. Look for [auto-continue] log lines: they say whether the error was classified as permanent, the session hit Max consecutive, or the retry is held offline |
| Sessions not resumed after a restart | Scan on host startup must be on, and the interruption must be newer than the scan window (15 minutes by default) |
| Settings are ignored after migrating | Make sure there is one top-level - id: auto-continue entry in cordis.patch.yml and no leftover insert row; see the migration notes under Install |
| Compact composer layout missing on a phone | Restart DSH and reload the remote page after updating the plugin |
agent.followup; the loop guard may call agent.cancel first. A resumed agent keeps the session's existing tools and permissions.api.deepseek.com, www.baidu.com and one.one.one.one. It opens no connection and sends no request.~/.dsh/settings.yaml on older hosts). Retry counters, cooldowns, one-hour pauses and statistics are kept in memory only.Use Node.js 22.
npm ci
npm run typecheck
npm run build
npm test
npm run test:runtime runs the settings, startup-recovery and restart tests against published DSH packages. Install the pinned fixtures first:
for v in 0.1.7 0.2.0 0.2.0-rc.2 0.2.1 0.2.1-rc.2; do npm ci --prefix "tests/fixtures/dsh-$v"; done
npm run test:runtime
The runtime tests drive real DSH services with a deterministic model adapter; they make no requests to a model provider. CI also checks that the committed lib/ matches a fresh build and runs dsh-plugin-check.
The banners and social preview are generated by npm run docs:assets; the workflow map is an Archify export (docs/auto-continue-workflow.*, sources in *.archify.json) (render the PNG with rsvg-convert -w 1280 -h 640 docs/social-preview.svg -o docs/social-preview.png). See docs/screenshots/README.md for how the screenshots are captured.
MIT © Hsiang Nianian
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。