Introduction¶
When switching the model to Tencent CodeBuddy’s buddy channel in DeepSeek Harness (DSH), a common phenomenon is that every request fails immediately with an HTTP 400 error. The error messages resemble “Request intercepted, please resend” or Illegal API invocation from an unapproved channel. However, if the request does not carry DSH’s default system prompt, the conversation proceeds normally with the same account and endpoint. This indicates that the issue often stems from a conflict between the system content assembled by DSH and the upstream validation rules, rather than a simple account or model configuration error.
Below is an introduction to the community plugin dsh-buddy-guard (Maintainer: AsterLuo, Category: Client). It makes minimal modifications to the first paragraph of content during the system prompt assembly phase, restoring the usability of the buddy channel in DSH. The installation commands and configuration items are derived from the project README; please review the source code and MIT license before use. The plugin runs with the privileges of the current DSH process.
What is this¶
dsh-buddy-guard is a Cordis plugin for DSH designed to address INVALID_REQUEST (HTTP 400) errors in the CodeBuddy / buddy (Tencent) channel within the Harness, caused by the system prompt triggering upstream rejections.
Project Repository: https://github.com/AsterLuo/dsh-buddy-guard
Community Directory Page: https://www.skillhub.cn/plugins/AsterLuo/dsh-buddy-guard
The current package version is 0.1.0, requiring Node >= 20.
Problem and Root Cause (README Verified, 2026-10-21)¶
When selecting any model (e.g., hy4-preview, deepseek-v4.1-flash, hy3) on the buddy channel, every request carrying DSH’s system prompt results in a 400 error. The upstream behavior recorded in the README is: it performs a prefix match on the system text. If the system text begins with the following sentence:
You are an AI agent powered by DeepSeek Harness.
it will be rejected immediately. Boundary tests in the README indicate that adding a single leading space before this sentence results in a 200 response. Modifying X-Domain, X-Product-Code, endpoints, User-Agent, or model names did not change the 400 result. The rule matches the beginning of the system content; adding just one character at the front disrupts the match, while adding spaces or newlines at the end of the sentence is ineffective.
Core Functionality¶
The plugin listens to system-prompt/assemble. Within the returned assembly result, it adds a leading space to the first non-empty section. After renderPrompt joins the sections using \n\n, the entire rendered system text begins with that space, thereby bypassing the aforementioned prefix match.
- By default, it only applies to the
buddyprovider; other providers pass through unchanged. - The
providerslist can be disabled or adjusted via configuration.
The README explains: Early versions hooked into llm/stream to modify requests using next(modifiedOptions), which was ineffective under the Cordis waterfall implementation (next does not accept arguments, so modifications are discarded); only replacing parameters via the listener’s return value works. Therefore, the current implementation handles this at system-prompt/assemble.
Installation and Activation¶
Use the official command to install the package into the node_modules of the specified profile and register it in dsh.profile.bundles (this will not modify your existing cordis.patch.yml):
dsh plugin add github:AsterLuo/dsh-buddy-guard --profile <your-profile>
Pinning the version is recommended:
dsh plugin add github:AsterLuo/dsh-buddy-guard#v0.1.0 --profile <your-profile>
Restarting DSH is mandatory after installation—configuration is read only once at startup.
Manual Installation (README Steps)¶
- Clone this repository to
<DSH_HOME>/profiles/<profile>/node_modules/dsh-buddy-guard/ - In that profile’s
package.json, append"dsh-buddy-guard"todsh.profile.bundles - Add
"dsh-buddy-guard": "0.1.0"todependenciesin the same file - Use
--dump-configto verify the presence ofbuddy-guardrelated lines - Restart DSH
Configuration¶
Configuration example for the plugin in the Cordis patch:
- id: buddy-guard
name: 'dsh-buddy-guard'
config:
enabled: true
providers:
- buddy
enabled: Master switch.providers: List of providers requiring the prefix, default is['buddy'].
Typical Usage and Verification¶
After the installation and restart steps above, switch to any buddy model in DSH and send a message. If a reply is received normally, the plugin is working.
If the error persists (400), the README suggests checking the following in order:
- Run
--dump-configagain to confirm the existence ofbuddy-guardlines. - Confirm that
lib/index.jsexists and is not empty. - Confirm that the package is listed in
dsh.profile.bundles(the README states this is the most commonly missed step). - Confirm that DSH has been truly restarted.
In-project tests:
npm test
Use Cases and Notes¶
Who is this for: Developers who have configured the Tencent CodeBuddy China Region buddy channel (e.g., accounts related to www.codebuddy.cn) in DSH and are experiencing total 400 failures due to the DSH default system prompt.
Limitations to be aware of:
- The README explicitly states: This approach bypasses upstream content validation, and rules may change at any time. If the error reappears, boundary tests must be conducted again to find new trigger conditions before considering adjustments to
GUARD_PREFIXwithin the plugin. - The explanation for “unapproved channel” in the README includes: inconsistencies where the account is for CodeBuddy China, but the client still uses the international product form. This plugin merely makes the current combination temporarily usable; it does not eliminate this underlying inconsistency. Using the international version workbuddy can completely avoid this check.
- The plugin runs with the privileges of the DSH process. Please read the repository source code and license before installation; do not blindly add it to a production profile without review.
The DSH ecosystem emphasizes “everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer. The plugin introduced here is also maintained by the community maintainer AsterLuo.
Conclusion¶
dsh-buddy-guard resolves the HTTP 400 triggered by default agent text between DSH and the CodeBuddy buddy channel with a single space before the system prompt. It has a low implementation cost and configurable behavior. If you are blocked by Illegal API invocation from an unapproved channel, follow the README to install, restart, and verify with --dump-config.
- Directory Page: https://www.skillhub.cn/plugins/AsterLuo/dsh-buddy-guard
- GitHub: https://github.com/AsterLuo/dsh-buddy-guard