dsh-tencent-channel-fix: Fix buddy / workbuddy channel 400 (code 11128)

Preface

When using Tencent-affiliated channels like buddy and workbuddy in DeepSeek Harness (DSH), a common phenomenon occurs: the first message of a new session fails immediately, returning a 400 with error code 11128. The error message is typically something like “Illegal API invocation from an unapproved channel” or “Request intercepted, please resend.” The error often does not specify exactly which request header or system prompt triggered the interception, making troubleshooting costly.

Updating dsh-our-free-model overwrites related files entirely; if you rely solely on manually editing local node_modules, the fixes will be lost after the next plugin update. Below, we introduce the community plugin dsh-tencent-channel-fix (Maintainer: basaltfold, Category: Workflow), which explains how to automatically patch two known issues every time DSH starts and provide observable status when upstream anchors drift.

What is this

dsh-tencent-channel-fix is a DSH plugin that performs idempotent repairs on two defects related to the Tencent channel gateway within dsh-our-free-model. It reapplies these repairs after every dsh-our-free-model upgrade to prevent regressions.

The plugin only modifies two files under dsh-our-free-model: adapter/kernel.js and vendor/channel-pack/pack.js. It does not modify providers, model rows, routing, credentials, or other DSH configurations.

The Two Things the Gateway Actually Rejects

The Tencent channel gateway independently checks two types of content in requests; fixing only one will still result in a 400.

1. Attribution User-Agent

dsh-our-free-model/adapter/kernel.js writes the Harness identity into the request’s User-Agent, for example:

deepseek-harness/0.2.1-rc.2 (+https://github.com/deepseek-ai/deepseek-harness)

The deepseek-harness string is on the gateway’s blacklist, and the check is case-insensitive (DeepSeek-Harness/0.2.1 will also be rejected). The README notes that curl, node, axios, and other UAs passed in testing.

2. Harness Identity Sentence in System Prompt

The beginning of the DSH base system prompt contains:

You are an AI agent powered by DeepSeek Harness.

The gateway treats powered by DeepSeek Harness as a content fingerprint. If it appears in a system message, the entire request is rejected.

dsh-our-free-model already has rewriteTencentContentFingerprints, but it only executes on the gateway path (convertMessage / toMessages). The direct adapter path actually used by buddy assembles system messages using messages.unshift(...) and does not go through the rewriter, so this sentence is sent as-is.

The README’s controlled test results on a real endpoint:

Request Combination Result
Original system + Original UA 400 code 11128
Original system + Fixed UA 400 code 11128
Rewritten system + Fixed UA 200 OK

Why Use a Plugin Instead of Manual Editing

Both issues are text strings inside the dsh-our-free-model package. Its updater rewrites files entirely, so manual modifications disappear after the next update—this is the direct cause of these issues recurring.

The plugin patches the aforementioned files during apply() on every startup (before the first model request and before relevant modules are lazy-loaded) and features:

  • Idempotent: If a file is already patched (marked), it is not rewritten.
  • Drift Awareness: If upstream anchors move, it skips the corresponding patch and reports it, rather than forcefully half-writing.
  • Rollbackable: It backs up before writing and validates with node --check after writing; if validation fails, it restores the original file.

Therefore, after a dsh-our-free-model upgrade, repairs can be automatically redone on the next startup instead of silently regressing.

Core Features

  1. Automatically applies three sets of repairs on startup (Attribution UA, Content Fingerprints, Direct Path System Rewrite).
  2. Slash command /tencent-fix: status (default), apply, restore, why.
  3. Local loopback: GET /dsh-tencent-channel-fix returns the same JSON as status (non-GET returns 405).
  4. Optional configuration: autoApply, target, verbose (see below).
  5. The rewrite scope within pack.js is limited to TENCENT_PROVIDERS = ["buddy", "workbuddy"]; other channels are unaffected. The UA still retains version info but removes the blocked token and URL.

Installation and Activation

Official installation command (from README):

dsh plugin add dsh-tencent-channel-fix

Or install from the GitHub repository:

dsh plugin add github:basaltfold/dsh-tencent-channel-fix

Restart DSH once after installation. The startup log may show:

[dsh-tencent-channel-fix] repair applied — applied attribution-user-agent, content-fingerprints, direct-system-rewrite. Active from the next model request.

Or when anchors do not match due to upstream changes:

[dsh-tencent-channel-fix] repair incomplete (upstream dsh-our-free-model changed) — drifted ...

The plugin runs with the current DSH process permissions and writes files to the dsh-our-free-model directory under your profile. Please read the repository source code and MIT license before installation to ensure it meets your security and compliance requirements.

Typical Usage

View Repair Status

Run in a DSH conversation or command entry:

/tencent-fix

Or explicitly:

/tencent-fix status

Example output (from README):

dsh-tencent-channel-fix · patch revision 1
target: C:\Users\you\.dsh\profiles\desktop\node_modules\dsh-our-free-model
dsh-our-free-model: 2.5.7

OK      attribution-user-agent — Attribution User-Agent (400 / code 11128)
OK      content-fingerprints — Rejected system-prompt fingerprints (400 / code 11128)
OK      direct-system-rewrite — Direct adapter path system rewrite (400 / code 11128)

3/3 patches in place.

Immediate Repatch and Restore

  • /tencent-fix apply: Force immediate repair, printing successful items and drift items.
  • /tencent-fix restore: Restore from the latest backup, undoing repairs.
  • /tencent-fix why: Output root cause explanation within the session.

Optional Configuration

Can be inserted into the bundle (field names follow the README):

- insert:
    - id: tencent-channel-fix
      name: 'dsh-tencent-channel-fix'
      config:
        autoApply: true    # false = only report drift, do not write files
        target: ''         # explicitly specify dsh-our-free-model directory
        verbose: false     # log every step, including no-op startups

When target is empty, it resolves ${profile}/node_modules/dsh-our-free-model based on the current profile, then attempts Node resolution paths and ~/.dsh/profiles/*/node_modules/.

Local Read-Only Check (No Write to Install Directory)

node -e "import('dsh-tencent-channel-fix/patcher').then(m => console.log(m.formatStatus(m.resolveTarget({}))))"

Applicable Scenarios and Notes

Who it is for: Developers who configure and use buddy and workbuddy channels in DSH and encounter 400 / code 11128 on the first message; workflow scenarios that require continued availability after frequent dsh-our-free-model upgrades.

Notes:

  • The repairs target the UA and system fingerprints sent by DSH itself; similar errors may also come from prompts or header fields of other CLI proxy projects (the README mentions the same source gateway behavior as issues with buddy-proxy, magpie, etc.). The scope of this plugin is limited to DSH-related items within the two files mentioned above.
  • If future changes to dsh-our-free-model cause anchor drift, /tencent-fix status will mark it as drifted and skip that patch; anchors need to be re-derived based on the new files and PATCHES within the plugin updated (maintainer-side work).
  • Community plugin directories (like SkillHub) have no official affiliation with DeepSeek or High-Flyer; installation and disk writing behavior are undertaken by your local DSH process, so please audit the source code yourself.

The repository provides npm test (README: 29 tests, no network, does not touch real installations) for maintainer verification; ordinary users can rely on status after installation and whether channel requests return 200.

Conclusion

dsh-tencent-channel-fix transforms “Tencent Channel 11128” from a repetitive manual editing of node_modules into an observable, rollbackable, and self-healing startup repair, focusing on the UA and system fingerprint issues on the buddy / workbuddy paths.

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

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

Xiaoye