dsh-finish-reason-patch
Run the following command in DeepSeek Harness:
dsh plugin install Canson666/dsh-finish-reason-patch
Paste the following prompt into your AI chat to install this plugin:
Run dsh plugin install Canson666/dsh-finish-reason-patch inside DeepSeek Harness to install; the plugin source is hosted at https://github.com/Canson666/dsh-finish-reason-patch .
About this plugin
When you route GPT-family models, gateways, or OpenAI-compatible proxies through DSH, some providers deliver the full streaming output yet never emit a terminal finish_reason. The underlying pi-ai adapter in DSH interprets this as a transport error and aborts a perfectly complete model turn. dsh-finish-reason-patch applies a precise tolerance patch at exactly that layer.
The plugin hooks the llm/stream waterfall that every model call passes through via LlmRuntime.streamWithRegistration—agent turns, session-title requests, subagent calls, and prepared invocations. When the terminal finish is precisely the missing-finish_reason error, it is rewritten to a normal stop (or to tool-calls if tool-call deltas were already delivered), letting the turn complete gracefully. In edge cases where a gateway streams only usage metadata or nothing at all, the empty response is accepted as a finished turn instead of entering a retry loop. All other error types—transport resets, rate limits, HTTP failures—pass through untouched, so the existing retry policy still applies to genuinely broken responses.
This plugin is for developers who rely on DSH to call GPT-family models or OpenAI-compatible endpoints through gateways and occasionally see turns abort without a clear cause. It has zero external dependencies, composes automatically at boot, and leaves no trace in any shipped DSH file when removed.
Use Cases
- GPT-family model delivers full streaming output through a gateway but never emits finish_reason, aborting the agent turn
- An OpenAI-compatible proxy streams only usage tokens or nothing at all before ending the stream, causing a retry loop
- Subagent or session-title requests are mapped to a TRANSPORT error due to the missing terminal marker, breaking the task chain
Best For
- Developers using DSH to call GPT-family or OpenAI-compatible models
- Engineering teams routing LLM API calls through third-party gateways or proxies
- Users whose turns abort unexpectedly with a TRANSPORT or Stream ended without finish_reason log entry
Related Plugins
ModLens is a vision plugin for DeepSeek Harness that gives text-only models sight by reading images pasted directly into chat, with zero-config setup and multiple vision engines.
On-demand vision for text-only DeepSeek Harness agents: built-in free keyless vision chain and 14 vision tools, routing image turns as tool calls to vision models with pixel fidelity, no Python needed, one-command install.
Give text-only models in DeepSeek Harness eyes, enabling image Q&A, long-screenshot OCR, UI restoration, and GUI visual tasks.
An armor-breaking plugin for DeepSeek: rewrites instruction priority, expands refusal-blocked phrases, persists across sessions, and shows a green active indicator.