dsh-workbuddy-codex: Monitoring the Local WorkBuddy Reverse Proxy Chain in DSH

Introduction

A common setup for integrating WorkBuddy into DeepSeek Harness (DSH) involves routing the model selector through the workbuddy provider, backed by a local wb2api gateway that translates OpenAI-compatible /v1/chat/completions requests for WorkBuddy. If you also need to use OpenAI Codex CLI, an additional bridging process is required in between to translate the Responses API into Chat Completions.

None of these three segments automatically run as system services. After a restart or if the process exits, the provider plugin may still load and list models, but the first actual request will hit a dead port. This document introduces dsh-workbuddy-codex: a plugin that probes health checks when the Harness loads, spawns missing processes, and periodically re-checks via a timer, ensuring the gateway and bridge continue to respond on their local ports.

What is this

dsh-workbuddy-codex is a DSH workflow plugin released by the maintainer kangjiazhen (the npm package name matches the repository name; the version in the current documentation is 0.3.2, MIT License). It does not reimplement the gateway, nor does it fork the WorkBuddy adapter; the gateway is orchestrated as a subprocess, and provider routing is delegated to the dependency package dsh-llm-workbuddy via ctx.plugin(), with that package maintaining the adapter, settings, and check-in logic.

The three parts of the local chain that must be ready simultaneously are as follows (ports and roles from the documentation):

Address Component Function
127.0.0.1:7863 wb2api gateway OpenAI-compatible /v1/chat/completions
127.0.0.1:7864 Built-in Responses bridge Responses API → chat/completions, for Codex CLI
— workbuddy provider Model selector routing, mounted by dsh-llm-workbuddy

If you enable dsh-llm-workbuddy separately alongside this plugin, the one that registers the route first takes effect; the other will log a message and yield. Neither layout will throw an error as a result.

Core Features

Process Supervision

When the plugin loads, it probes each health endpoint and spawns whatever is missing; afterwards, it checks again via a timer, and crashed processes will be restarted. The api_key in the config.json within the gateway directory is used by both the bridge and the provider, so the port and key only need to be configured once on the gateway side.

Built-in Codex Bridge

Starting from version 0.1xx, Codex CLI only uses the OpenAI Responses API (POST /v1/responses), while the WorkBuddy gateway only implements Chat Completions. Connecting directly to the gateway will result in a 404 for /v1/responses, and Codex can no longer switch back to wire_api = "chat" in its configuration. This plugin includes a zero-dependency bridge script (bridge/codex-chat-bridge.mjs) sourced from the same codebase as codex-chat-bridge. Simply install the plugin; there is no need to clone a second repository.

The data path is:

Codex CLI --(Responses)--> bridge :7864 --(ChatCompletions)--> gateway :7863 --> WorkBuddy

Provider Delegation

The workbuddy route is mounted via the dependency dsh-llm-workbuddy. If this package is not installed in the environment, the plugin will still supervise the gateway and bridge, and will log a hint to install it using the command dsh plugin add dsh-llm-workbuddy, without interrupting the Harness.

Configuration

Configuration is written under the config key of the workbuddy-codex entry in the profile’s cordis.yml; the cordis.patch.yml provided with the package contains the complete default values. Common options are as follows:

Key Default Value Description
gatewayDir ~/Documents/deepseek-harness/default-workspace/workbuddy2api-panel Directory containing the gateway config.json
provider.enabled true Whether to register the workbuddy route
provider.baseURL Empty (falls back to gateway.baseURL) Gateway URL used by the adapter
provider.discovery true Whether to fetch the model list from the gateway’s /v1/models
provider.autoCheckin true Whether to automatically complete the WorkBuddy daily check-in
gateway.acceptStatus [200, 503] The gateway may return 503 when no account is available, but is still considered alive
bridge.conversationId auto Semantically required when interfacing with WorkBuddy; a missing value will cause an upstream 400 and may trigger the gateway to disable the account
bridge.maxPromptTokens 1200000 Returns 413 if the local estimate exceeds the limit; 0 disables this

Installation and Activation

Official installation command (from the repository README):

dsh plugin add git+https://github.com/kangjiazhen/dsh-workbuddy-codex.git

Local directory development installation:

dsh plugin add file:/path/to/dsh-workbuddy-codex

The package includes cordis.patch.yml; once it becomes a profile dependency, the workbuddy-codex configuration entry will be written automatically. The runtime environment requires Node >=18 (see engines in package.json).

Migrating from a standalone dsh-llm-workbuddy

If the profile previously included dsh-llm-workbuddy in dsh.profile.bundles, the documentation suggests changing it to keep only this plugin as the bundle. However, dsh-llm-workbuddy must remain in dependencies, because this plugin mounts the provider via import:

"dsh": { "profile": { "bundles": [
  // "dsh-llm-workbuddy",   <- Remove this line
  "dsh-workbuddy-codex"
] } }

Common issues when git installation fails

pnpm may rewrite git+https://… to SSH, resulting in Permission denied (publickey) if there is no GitHub SSH key:

npm config set git-protocol https

In a proxy environment, git itself must be configured to use the proxy (pnpm does not inherit proxy settings when calling git):

git config --global http.proxy http://127.0.0.1:7890

Typical Usage: With Codex CLI

The bridge listens on 7864 and provides the Responses API externally. Point to this address in ~/.codex/config.toml (example from the README):

model = "global:gpt-5.3-codex"
model_provider = "wb"

[model_providers.wb]
name = "workbuddy"
base_url = "http://127.0.0.1:7864/v1"
wire_api = "responses"
experimental_bearer_token = "anything"
request_max_retries = 2
stream_max_retries = 2

The bridge does not validate the bearer string itself, but Codex requires it to be non-empty; actual authentication uses the api_key read from the gateway’s config.json. Afterwards, you can use Codex as usual, for example:

codex exec "list the files in this directory"

If the account tier does not allow a certain model, the gateway will return 11158 model not allowed for user type [...], which is an account permission issue rather than a bridge failure.

Two settings that must not be omitted

1. bridge.conversationId (default auto)

The WorkBuddy upstream validates conversation-related headers; if missing, it may return 400, and the gateway will classify the error as an account issue and disable the account. By default, the bridge derives a stable ID based on the Codex session and writes it to metadata.conversation_id. Do not clear it; the plugin will warn at startup if the configuration is improper. If an account has been mistakenly disabled, you can restore it via the gateway panel without needing to log in again:

# Panel address: http://127.0.0.1:7863/panel/
curl -X POST http://127.0.0.1:7863/panel/api/accounts/<uid>/revive

2. Gateway api_key

Requests to the gateway must carry the key consistent with config.json; the plugin reads it via gatewayDir and passes it to the bridge, avoiding manual copying.

Scenarios and Notes

This is suitable for developers who are already using the WorkBuddy wb2api panel locally and want to install the “provider + gateway + Codex bridge” all at once within their DSH profile, with unified supervision by the Harness process. The DSH community plugin directory (such as SkillHub) has no official affiliation with DeepSeek or High-Flyer; please read the repository source code and the MIT license yourself before installing. The plugin runs with the user and permissions of the current dsh process, spawns local subprocesses, and reads your configured gatewayDir. Before installation and activation, you should confirm that the path and the exposure scope of the keys are acceptable.

Conclusion

dsh-workbuddy-codex consolidates the supervision of the WorkBuddy local reverse proxy chain, provider mounting, and the Responses bridge required by Codex into a single DSH plugin, reducing hidden failures where “models can be selected but cannot be chatted with” after a restart. Repository and documentation: https://github.com/kangjiazhen/dsh-workbuddy-codex.

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

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

Xiaoye