dsh-max-token-auto-continue: Root Agent Auto-Continues After Max-Tokens Truncation

Introduction

When running long tasks in DeepSeek Harness (DSH), a turn of the root agent may end with turn/end and reason max-tokens because the model reached the maximum output token limit. At this point, the session is often not complete, but by default, you need to send another message to continue. For coding, document generation, or multi-step workflows that require continuous output, this pause interrupts the rhythm.

The community plugin dsh-max-token-auto-continue (maintainer Wepoi9) automatically continues execution via the established DSH path after the agent becomes idle, once the above ending reason is detected. It uses a retry cap and fail-closed rules to avoid infinite retries. This article compiles installation and behavior notes based on the repository README and package.json (plugin version 0.1.0, license MIT). For the DSH community plugin directory, see the SkillHub entry (Community-maintained; no affiliation with the DeepSeek Harness core distribution).

What is this

dsh-max-token-auto-continue is a community host plugin for DSH: when the root agent ends a turn due to max-tokens, it automatically continues the session. Normal sessions use agent.followup(), while sessions with an active, disarmed /goal use GoalService.resume(). It does not impersonate human input, does not persist session data, and does not access external networks.

In the SkillHub classification, it is categorized as Workflow. The GitHub star count is 0 (based on directory/repository public information).

Core Behavior

The trigger conditions and continuation paths are as follows.

  1. Listen for the root agent turn to end with turn/end and reason max-tokens.
  2. Wait for the agent to become idle.
  3. Continue based on session type:
    - Normal session: agent.followup();
    - Active, disarmed /goal: GoalService.resume().

The continuation text and delay are fixed within the plugin; the README does not provide configurable options for them.

Safety and Boundaries

The README explicitly states the following constraints to help evaluate whether to enable it.

Key Point Description
Scope Root agent only; sub-agent turns are not auto-continued
Input Source Does not impersonate humans; continuation messages use source.kind: "dsh-max-token-auto-continue", form: "notice"
Goal State Does not auto-continue for goals that are paused, blocked, complete, or active and armed
Cancellation Conditions Updated human input, updated turns, or plugin uninstallation/disablement invalidates pending continuations
Failure Policy Stops the continuation path upon error; no infinite retries
Side Effects No persistence, no UI automation, no background network retries, no external network access

The number of consecutive auto-continuations is limited by the config maxConsecutive (default 3), forming a “bounded max-token chain”.

Configuration

In the target profile’s cordis.patch.yml, you can override the defaults by adding a config entry with the id dsh-max-token-auto-continue (the bundle declaration will write the necessary entries to the profile).

Config Item Default Meaning
enabled true Whether to enable auto-continue
maxConsecutive 3 Maximum number of automatic continuations on the same consecutive max-token chain

Installation and Activation

The plugin does not provide remote one-click installation via commands like dsh plugin add github:...; you need to locally clone the repository, build it, and add it to the profile using an absolute path.

  1. In the repository root directory, install dependencies, build, and run tests:
npm install
npm run build
npm test
  1. Add the local checkout directory to the target profile (replace <profile> with web for the Web environment):
dsh plugin --profile <profile> add <absolute-path-to-this-repository>
dsh --profile <profile> --dump-config
  1. If you need to change enabled / maxConsecutive, configure the entry with the id dsh-max-token-auto-continue in the corresponding profile’s cordis.patch.yml.

Build artifacts: TypeScript is compiled to lib/, and the plugin entry point is lib/src/index.js. @deepseek-ai/dsh-llm is resolved by the DSH process at runtime; the plugin uses the host’s bundled copy.

Compatibility with DSH Versions

The README records that the latest DSH version with completed live E2E verification is 0.2.1-rc.2 (2026-10-17: Build, 13 tests, zero plugin rejections in the web profile, normal path max-token auto-continue, and Goal resume, etc.). The engines.dsh in package.json also declares multiple compatibility targets from 0.1.6-alpha.2 to 0.2.1-rc.2; however, 0.2.1-alpha.2 only has declarations and source-level API review, with no live verification completed on that version. Auto-continue and Goal resume on 0.2.1-alpha.1 have also not been re-verified on that version. Before upgrading DSH, it is recommended to check the Compatibility table in the repository README.

Typical Usage and Operational Notes

The README does not provide a separate “business scenario script”; the actual effect is: in long output tasks, when the root agent ends multiple times due to max-tokens, the plugin automatically inserts a notice-form follow-up (or Goal resume) after becoming idle, until maxConsecutive is reached or updated human input/new turns occur.

Operationally, the README emphasizes: the plugin continues work without waiting for a human message after output is truncated, which is suitable for long tasks. However, if the model hits max-tokens in the wrong direction, it may also prolong unintended tasks. The main constraints remain: Root agent only, maxConsecutive, override by new input/new turns, and fail-closed.

The plugin runs with the current DSH process permissions; before installation, please review the source code and LICENSE yourself to ensure compliance with your security and compliance requirements.

Privacy and Contribution

The plugin does not persist session data and does not send data to external services; changes to the session are limited to the bounded continuation messages or Goal resume calls described above.

For bug reports or PRs, please go to the GitHub repository; if reporting compatibility issues, the README suggests including the DSH version, profile, whether it is a normal session or /goal, the observed turn/end reason, and whether the continuation was expected.

Links

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye