When developing an agent with DeepSeek Harness (DSH), you may encounter a situation where streamed content is output normally, but an error inevitably occurs at the end of a conversation turn. This is usually because the pi-ai SDK used by DSH requires a streamed response to end with finish_reason, while some aggregate endpoints do not send this signal.

dsh-model-fix is a DSH plugin maintained by Retr67. It specifically fixes the streaming termination defect of muse-spark-1.2 and gpt-5.6-luna on opencode aggregate endpoints.

Core Functionality

The plugin operates during the llm/stream waterfall stage of DSH. When content has already been output in a streamed response, but the end of the response causes the error code to be TRANSPORT / STREAM_CLOSED due to an endpoint defect (missing finish_reason or [DONE]), it rewrites the termination status to a normal stop.

It fixes only this specific scenario:
1. Content has been output (e.g., text-delta / reasoning-delta is present).
2. The error message explicitly indicates “missing termination event” (e.g., Stream ended without finish_reason).

For real transport failures (such as Socket closure) or empty responses, the plugin does not intervene and preserves the original behavior.

Installation and Enablement

Install the plugin using the official DSH command-line tool. After installation, you must restart the target profile for it to take effect.

npx -y @deepseek-ai/dsh plugin --profile web add github:Retr67/dsh-model-fix

After installation, restart the service running that profile (for example, dsh web).

Configuration

The plugin is configured via the cordis.patch.yml file. The main configuration items are modelPattern and providers.

Field Default Description
modelPattern ^(muse-spark\|gpt-5\.6-luna) Regular expression for matching model IDs; only matching models are repaired.
providers [] Whitelist of Provider route keys. If left empty, it matches all qualifying models in all providers.

Configuration Example

Add the following configuration to cordis.patch.yml:

- id: model-fix
  name: dsh-model-fix
  config:
    modelPattern: '^(muse-spark|gpt-5\.6-luna)'
    providers: []

Custom Scope:
- If you want to repair only gpt-5.6-luna, change modelPattern to '^gpt-5\.6-luna'.
- If you want to restrict it to a specific route, add providers: ['opencode-go'].

Applicable Scenarios and Precautions

Technical Requirements

  • Node.js version: The plugin relies on Node.js and requires version ^22.19.0 or >=24.

Privacy and Settings Notes

Using this plugin to fix the streaming termination defect does not require enabling the “Allow models that train on request data” setting on the opencode platform.
- This setting concerns data training authorization and is privacy-sensitive; it should not be enabled just to use the model.
- This plugin fixes a missing streaming transport protocol signal and has nothing to do with that privacy setting.

Summary

dsh-model-fix resolves the issue where DSH agent conversation failures and retries are triggered because opencode aggregate endpoints do not send the standard finish_reason. After the fix, direct model connections work normally, avoiding unnecessary token consumption.

Project URL: https://github.com/Retr67/dsh-model-fix