Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

fix: DeepSeek Harness 0.1.2rc1 drives MCP servers; omp advertises only the tools it has (#135)

github-actions[bot]41449ad3a07c
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 41ac0dbf..5a8b9e2d 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -318,17 +318,23 @@ install_backends() {
try_install "Oh My Pi" install_omp || true
fi
- if wanted dsh && [ ! -x "$(backend_bin dsh)" ]; then
- echo "[harnessrouter] installing DeepSeek Harness (MIT, developer preview — version-pinned)…"
+ # The dsh venv lives on the data volume, so a pin bump in the image must reach a volume that
+ # already has a venv: dsh-ready names the version it was built for, and a mismatch rebuilds
+ # the venv (sessions live under ~/.dsh, not in it). The 0.1.0rc7 -> 0.1.2rc1 move is where
+ # this was learned: the image changed and every existing volume would have kept rc7.
+ DSH_PIN="0.1.2rc1"
+ if wanted dsh && [ "$("$(backend_bin dsh)" 2>/dev/null)" != "$DSH_PIN" ]; then
+ echo "[harnessrouter] installing DeepSeek Harness $DSH_PIN (MIT, developer preview — version-pinned)…"
# Pinned EXACTLY, not 'latest': upstream is a developer preview that warns of breaking
# changes, and the runner's driver/normalizer are written against these bytes. An upgrade
# is an adapter-compatibility change that lands through a PR, never through a fresh volume
# pulling a newer wheel. Own venv: its dependency tree must not fight hermes's.
+ rm -rf "$TOOLS/dsh-venv"
try_install "DeepSeek Harness" sh -c "\"$PY\" -m venv \"$TOOLS/dsh-venv\" \
&& \"$TOOLS/dsh-venv/bin/pip\" install --no-cache-dir -q \
- 'deepseek-harness-sdk==0.1.0rc7' 'deepseek-harness-runtime-bin==0.1.0rc7' pyyaml \
+ 'deepseek-harness-sdk==$DSH_PIN' 'deepseek-harness-runtime-bin==$DSH_PIN' pyyaml \
&& \"$TOOLS/dsh-venv/bin/python\" -c 'import deepseek_harness, deepseek_harness_runtime, yaml; deepseek_harness_runtime.bundled_runtime_path()' \
- && printf '#!/bin/sh\nexit 0\n' > \"$TOOLS/dsh-venv/bin/dsh-ready\" \
+ && printf '#!/bin/sh\necho %s\n' '$DSH_PIN' > \"$TOOLS/dsh-venv/bin/dsh-ready\" \
&& chmod +x \"$TOOLS/dsh-venv/bin/dsh-ready\"" || true
# dsh-ready exists ONLY after the import check proved the runtime executable resolves —
# a venv whose pip half-failed must not report the backend as available.
diff --git a/docs/support-matrix-notes.md b/docs/support-matrix-notes.md
index 04fe8a2e..93ea0555 100644
--- a/docs/support-matrix-notes.md
+++ b/docs/support-matrix-notes.md
@@ -179,3 +179,17 @@ Every column in the tables above was measured before that change and was judged
scenario counts stand as measured, and none of them is evidence either way about duplicate cards. The
duplicate itself is fixed in 0.15.1, verified on the release across gemini, cline, qwen, dsh, opencode
and omp: one stored file, one rendered card in each.
+
+## dsh on the 0.1.2rc1 runtime (2026-09-08)
+
+The pin moved from 0.1.0rc7 to 0.1.2rc1 because rc7's runtime does not carry the MCP client at all
+(zero `dsh-mcp-client` strings in its binary), which is why the custom-harness dimension found dsh never
+calling a configured server. The new runtime composes an `sdk` profile that the driver overlays with a
+`--patch` file: the stock JSON-RPC server row disabled and the resume-or-create server inserted (a patch
+cannot rename a row), one `dsh-mcp-client` row per server, and the pi-ai route merged into the stock
+`llm-pi-ai` row. Measured locally through the real driver against TokenRouter with
+`deepseek/deepseek-v4-flash`: `mcp__deepwiki__read_wiki_structure` called and answered in 10 s, a second
+process resumed a session and recalled its codeword, and a bash call carried its name through the relay.
+The sdk profile also offers more tools than rc7 did (glob, grep, str_replace_editor, web_search,
+web_fetch, skill, subagent_fork, workflow); the catalog lists them. Every dsh column before this date
+was judged on rc7.
diff --git a/gateway/app.py b/gateway/app.py
index 6ab87553..6d840055 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -12564,27 +12564,35 @@ _BASE_CATALOG: dict[str, dict] = {
"omp": {
"label": "Oh My Pi", "backend": "omp", "status": "ready",
"system_prompt": ("You are Oh My Pi (OMP), an autonomous coding agent. You operate on "
- "a real git workspace with shell, file access, LSP, Python, browser, "
+ "a real git workspace with shell, file access, LSP, web search, "
"and subagents to complete engineering tasks end to end."),
+ # The ten names omp 18.1.13 accepts on --tools, read by probing the binary itself (see
+ # ALL_OMP_TOOLS in runner/server.py). "python" and "browser" are not among them: omp
+ # refuses an unknown name on the switch and the turn dies before it starts, so a toggle
+ # offered here for either would have produced exactly that exit.
"tools": [("bash", "Bash"), ("read", "File Read"), ("write", "File Write"),
("edit", "Edit"), ("glob", "Glob"), ("grep", "Grep"),
- ("lsp", "LSP"), ("python", "Python"), ("todo", "Todo"),
- ("task", "Task (subagents)"), ("browser", "Browser"),
+ ("lsp", "LSP"), ("todo", "Todo"), ("task", "Task (subagents)"),
("web_search", "Web Search")],
"tool_enforcement": "hard",
},
"dsh": {
"label": "DeepSeek Harness", "backend": "dsh", "status": "ready",
- # MCP note: the pinned runtime wheel (0.1.0rc7) does not bundle dsh's MCP client yet,
- # so configured MCP servers are announced-and-skipped per turn (see dsh_driver.py).
- # The runner flips DSH_RUNTIME_HAS_MCP when the pin moves to a build that ships it.
+ # MCP servers ride the driver's patch overlay on the runtime's sdk profile (one
+ # dsh-mcp-client row per server, see runner/dsh_driver.py) since the 0.1.2rc1 pin.
"system_prompt": ("You are DeepSeek Harness, an autonomous coding agent. You work on a "
"real git workspace, running shell commands and editing files to "
"complete the task end to end."),
- # The bundled runtime's model-facing tools. No per-tool switch exists on the wire, so
- # disabling is an instruction to the model, the same standing as codex/hermes.
+ # The sdk profile's model-facing tools, read off the request header of a 0.1.2rc1 turn
+ # on 2026-09-08 (goal, plan, job and agent-messaging internals left out). No per-tool
+ # switch exists on the wire, so disabling is an instruction to the model, the same
+ # standing as codex/hermes.
"tools": [("bash", "Bash"), ("read", "File Read"), ("write", "File Write"),
- ("edit", "Edit"), ("todo_write", "Todo"), ("subagent", "Subagent")],
+ ("edit", "Edit"), ("str_replace_editor", "String Replace Editor"),
+ ("glob", "Glob"), ("grep", "Grep"), ("web_search", "Web Search"),
+ ("web_fetch", "Web Fetch"), ("todo_write", "Todo"), ("skill", "Skill"),
+ ("subagent", "Subagent"), ("subagent_fork", "Subagent (fork)"),
+ ("workflow", "Workflow")],
"tool_enforcement": "instruction",
},
"opencode": {
diff --git a/gateway/tests/test_base_catalog_honesty.py b/gateway/tests/test_base_catalog_honesty.py
new file mode 100644
index 00000000..bb1a858b
--- /dev/null
+++ b/gateway/tests/test_base_catalog_honesty.py
@@ -0,0 +1,36 @@
+"""What a base advertises must be what its runtime accepts.
+
+Found by the custom-harness dimension: omp's entry listed "python" and "browser" as hard-enforced
+switches, so the console offered toggles that put an unknown name on omp's --tools and killed
+every turn. dsh's list is the sdk profile's request header, read off a 0.1.2rc1 turn.
+"""
+import os
+import pathlib
+import sys
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
+os.environ.setdefault("HR_BACKING", "local")
+import app as A # noqa: E402
+
+# Read by probing omp 18.1.13 itself: every name below is accepted on --tools, "python" and
+# "browser" are refused with "Unknown tool". runner/server.py pins the same set as ALL_OMP_TOOLS.
+OMP_ACCEPTED = {"bash", "read", "write", "edit", "glob", "grep", "lsp", "todo", "task", "web_search"}
+# The tools the 0.1.2rc1 sdk profile put in front of the model (request/header, 2026-09-08).
+DSH_OFFERED = {"bash", "create_goal", "edit", "exit_plan_mode", "get_goal", "glob", "grep", "interrupt_agent",
+ "job_kill", "job_list", "job_output", "list_agents", "ralph", "read", "read_image", "send_message",
+ "skill", "str_replace_editor", "subagent", "subagent_fork", "todo_write", "update_goal",
+ "web_fetch", "web_search", "workflow", "write"}
+
+
+def test_omp_advertises_only_the_tools_its_binary_accepts():
+ names = {n for n, _ in A._BASE_CATALOG["omp"]["tools"]}
+ assert names == OMP_ACCEPTED, f"a toggle for {sorted(names - OMP_ACCEPTED)} would put a refused name on --tools"
+ assert A._BASE_CATALOG["omp"]["tool_enforcement"] == "hard"
+ prompt = A._BASE_CATALOG["omp"]["system_prompt"].lower()
+ assert "python" not in prompt and "browser" not in prompt, "the prompt promises a tool the agent does not have"
+
+
+def test_dsh_advertises_tools_its_profile_offers():
+ names = {n for n, _ in A._BASE_CATALOG["dsh"]["tools"]}
+ assert names <= DSH_OFFERED, f"not offered by the sdk profile: {sorted(names - DSH_OFFERED)}"
+ assert A._BASE_CATALOG["dsh"]["tool_enforcement"] == "instruction"
diff --git a/runner/dsh_driver.py b/runner/dsh_driver.py
index 20d0f984..b0363e0b 100644
--- a/runner/dsh_driver.py
+++ b/runner/dsh_driver.py
@@ -384,27 +384,38 @@ def _emit(method: str, payload) -> None:
sys.stdout.flush()
-# Whether the PINNED runtime wheel bundles @deepseek-ai/dsh-mcp-client. rc7 does NOT — the
-# upstream sdk-runtime README already documents the plugin as bundled, but the wheel predates
-# it: naming the entry makes the plugin tree fail, and a failed tree leaves the runtime alive
-# with a mute stdout, which reads as a hang (measured: the initialize response simply never
-# comes). Flip this when the wheel pin moves to a build that ships the plugin — and re-verify.
-DSH_RUNTIME_HAS_MCP = False
-
-
-def _compose_cordis(home: pathlib.Path, servers: list[dict], llm: dict | None = None,
- relay_port: int = 0, model: str = "") -> str:
- """Our runtime composition: the wheel's bundled default, with the SDK server entry swapped
- for the resume-or-create subclass (see hr_dsh_server.cjs — packaged-bin loads
- configuration-relative plugins), plus one dsh-mcp-client entry per enabled MCP server."""
- import deepseek_harness_runtime as runtime
- base = pathlib.Path(runtime.bundled_default_config_path()).read_text()
- needle = "name: '@deepseek-ai/dsh-sdk-jsonrpc-server'"
- if base.count(needle) != 1:
- raise SystemExit("dsh bundled cordis no longer names the sdk server exactly once — "
- "re-verify hr_dsh_server.cjs against this runtime before shipping")
- base = base.replace(needle, "name: './hr_dsh_server.cjs'")
- blocks = []
+def _compose_patch(home: pathlib.Path, servers: list[dict], llm: dict | None = None,
+ relay_port: int = 0, model: str = "", cwd: str = "") -> str:
+ """Our overlay on the runtime's stock `sdk` profile, in the loader's own patch grammar: a row
+ named by id is merged, `disabled: true` stops one, and `insert` appends new rows.
+
+ The stock JSON-RPC server row is disabled and ours inserted in its place (see
+ hr_dsh_server.mjs: resume-or-create), one dsh-mcp-client row is inserted per enabled MCP
+ server, and a non-deepseek family gets its route merged into the stock dsh-llm-pi-ai row.
+ A patch cannot rename a row, which is why the server is disable-plus-insert rather than the
+ name swap the previous runtime's bundled cordis.yml allowed.
+
+ The sdk profile's sandboxing executor rows are disabled and the local executors inserted, the
+ composition rc7 shipped (dsh-bash-local, dsh-fs-local). This is the state upstream itself
+ names, "sandbox_permissions is not available in this composition (no sandboxing executor to
+ escalate)": with a sandboxing executor mounted, every file tool advertises the escalation
+ fields `sandbox_permissions` and `justification`, meant for a one-shot retry after a denial.
+ GPT models fill them on every write regardless, and under danger-full-access each such call is
+ refused as "not strictly wider than this call's current mode": twenty refused writes in one
+ turn, the file never created, on gpt-5.2 through gpt-6-astra (the dsh matrix column through
+ Vercel, 2026-09-08); DeepSeek and Claude leave the fields alone. A field that does not exist
+ cannot be filled. The workspace and the container are the boundary here, as for every other
+ backend. `permission` goes with them: it throws over an unconfined executor."""
+ entries: list = [{"id": "sdk-jsonrpc-server", "disabled": True}]
+ entries += [{"id": rid, "disabled": True}
+ for rid in ("sandbox", "sandbox-policy", "bash-sandbox", "fs-sandbox", "permission")]
+ cjs = home / ".dsh" / "hr_dsh_server.mjs"
+ inserted: list = [{"id": "hr-sdk-jsonrpc-server", "name": str(cjs),
+ "inject": ["sdkAppStartup", "loader"],
+ # the stock row's default: a turn that stops on max tokens is a finished turn
+ "config": {"maxTokensAsSuccess": True}},
+ {"id": "hr-bash-local", "name": "@deepseek-ai/dsh-bash-local", "config": {"cwd": cwd}},
+ {"id": "hr-fs-local", "name": "@deepseek-ai/dsh-fs-local", "config": {"cwd": cwd}}]
for i, s in enumerate(servers):
url = (s or {}).get("url")
if not url:
@@ -420,7 +431,8 @@ def _compose_cordis(home: pathlib.Path, servers: list[dict], llm: dict | None =
hdrs.update({str(k): str(v) for k, v in s["headers"].items() if k and v is not None})
if hdrs:
entry["config"]["headers"] = hdrs
- blocks.append(entry)
+ inserted.append(entry)
+ entries.append({"insert": inserted})
if llm:
# Non-deepseek families ride dsh's OWN multi-provider layer, dsh-llm-pi-ai — which is
# pi's unified LLM library wrapped as a Cordis plugin, so the api-by-family choices are
@@ -433,7 +445,7 @@ def _compose_cordis(home: pathlib.Path, servers: list[dict], llm: dict | None =
# it wrong here produced /v1/v1/messages against the relay — measured, not guessed.
base_url = (f"http://127.0.0.1:{relay_port}" if api == "anthropic-messages"
else f"http://127.0.0.1:{relay_port}/v1")
- blocks.append({"id": "hr-llm", "name": "@deepseek-ai/dsh-llm-pi-ai", "config": {
+ entries.append({"id": "llm-pi-ai", "config": {
"providers": {"hr": {
"displayName": "HR Gateway",
"apiKeyEnv": "HR_RELAY_TOKEN",
@@ -442,15 +454,12 @@ def _compose_cordis(home: pathlib.Path, servers: list[dict], llm: dict | None =
"models": [{"id": model, "contextWindow": 200000, "maxTokens": 32000,
"input": (["text", "image"] if llm.get("vision", True) else ["text"])}],
}}}})
- path = home / ".dsh" / "cordis.yml"
+ path = home / ".dsh" / "hr.patch.yml"
path.parent.mkdir(parents=True, exist_ok=True)
import shutil
- shutil.copy(pathlib.Path(__file__).with_name("hr_dsh_server.cjs"), path.parent / "hr_dsh_server.cjs")
- extra = ""
- if blocks:
- import yaml
- extra = "\n" + yaml.safe_dump(blocks, sort_keys=False)
- path.write_text(base + extra)
+ shutil.copy(pathlib.Path(__file__).with_name("hr_dsh_server.mjs"), cjs)
+ import yaml
+ path.write_text(yaml.safe_dump(entries, sort_keys=False))
return str(path)
@@ -461,8 +470,6 @@ def main() -> int:
UPSTREAM_KEY = os.environ.pop("HR_DSH_API_KEY", "")
home = pathlib.Path(os.environ.get("HOME") or ".")
cwd = job.get("cwd") or os.getcwd()
- sessions = home / ".dsh" / "sessions"
- sessions.mkdir(parents=True, exist_ok=True)
srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), _Relay)
threading.Thread(target=srv.serve_forever, daemon=True).start()
@@ -472,19 +479,22 @@ def main() -> int:
from deepseek_harness import DeepSeekHarness
os.environ["HR_RELAY_TOKEN"] = "hr-relay" # the placeholder the pi-ai route resolves
- mcp = job.get("mcp_servers") or []
- if mcp and not DSH_RUNTIME_HAS_MCP:
- # The pi precedent: a capability the harness asked for but this build cannot provide is
- # SAID, and the turn still runs — a loud line beats a task wedged on a mute runtime.
- print("[dsh] MCP servers are configured on this harness, but the pinned DeepSeek Harness "
- "runtime (0.1.0rc7) does not bundle its MCP client yet — this turn runs without "
- "them. The next runtime pin restores them.", flush=True)
- mcp = []
+ # The sdk profile's approval policy reads this ('never' only under danger-full-access, 'ask'
+ # otherwise), and a headless turn has no one to ask. The sandbox policy read it too before the
+ # sandboxing executor rows were taken out of the composition (see _compose_patch): its default
+ # refused EVERY command on a host with no bubblewrap and no Landlock, which is this product's
+ # container ("no sandbox backend is usable on this host; refusing to run the command
+ # unconfined", measured 2026-09-08 on 0.1.2rc1: the skill's script never ran and the agent
+ # quoted its source instead).
+ os.environ["DSH_PERMISSION_MODE"] = "danger-full-access"
llm = job.get("llm") # None => the verified deepseek-official path
+ # The SDK launches `dsh --profile sdk --patch <ours>` against an explicit home; the profile
+ # keeps sessions under $DSH_HOME/sessions, so ~/.dsh/sessions is where every earlier
+ # runtime already put them.
kwargs = dict(provider=("hr" if llm else "deepseek-official"), model=job["model"],
- cwd=cwd, session_root=str(sessions),
- cordis=_compose_cordis(home, mcp, llm=llm,
- relay_port=srv.server_address[1], model=job["model"]),
+ cwd=cwd, dsh_home=str(home / ".dsh"),
+ patches=(_compose_patch(home, job.get("mcp_servers") or [], llm=llm,
+ relay_port=srv.server_address[1], model=job["model"], cwd=cwd),),
# A runtime whose plugin tree failed stays alive with a mute stdout; without a
# bound the initialize request waits forever and the turn reads as a hang.
request_timeout_seconds=180.0)
diff --git a/runner/hr_dsh_server.cjs b/runner/hr_dsh_server.mjs
similarity index 59%
rename from runner/hr_dsh_server.cjs
rename to runner/hr_dsh_server.mjs
index 4d28ae26..d91c69eb 100644
--- a/runner/hr_dsh_server.cjs
+++ b/runner/hr_dsh_server.mjs
@@ -5,36 +5,49 @@
* coordinator refuses a create whose sessionId already has a persisted log (a fresh process has
* no in-memory seed, so adoption cannot apply). That makes every cross-process follow-up die
* with "persisted log on disk that does not match this live session (id collision)" — captured
- * live on 2026-08-20, and precisely the continuation gap the DeepSeek-Harness audit predicted.
- * The wire itself has no resume method, so the fix lives at the one seam upstream left open:
- * this file loads as a CONFIGURATION-RELATIVE plugin (a documented packaged-bin feature),
- * subclasses the exported server class from the bundled snapshot, and tries
- * ctx.agents.resume({resumeSessionId}) before falling back to the parent's create.
+ * live on 2026-08-20 against 0.1.0-rc.7 and again on 2026-09-08 against 0.1.2-rc.1. The wire
+ * itself has no resume method, so the fix lives at the one seam upstream left open: this file
+ * loads as a plugin row inserted by the driver's patch overlay (the stock server row is
+ * disabled beside it), subclasses the exported server class from the bundled snapshot, and
+ * tries ctx.agents.resume({resumeSessionId}) before falling back to the parent's create.
*
* Version-locked: refuses to boot against any other upstream version, loudly, because this
- * reaches into TS-private fields (this.ctx / this.provider / this.model / this.maxTokens)
- * that only exist by compiled-JS convention.
+ * reaches into TS-private fields (this.ctx / this.provider / this.model / this.reasoningEffort /
+ * this.maxTokens / this.sessions) that only exist by compiled-JS convention.
+ *
+ * An ES module on purpose: the snapshot's packages are ESM and the loader imports plugin rows
+ * concurrently, so a CommonJS require() of @deepseek-ai/dsh-session raced a load already in
+ * flight (ERR_REQUIRE_ESM_RACE_CONDITION, measured 2026-09-08). import() waits for it instead.
*/
-'use strict'
+import path from 'node:path'
+import { createRequire } from 'node:module'
+import { pathToFileURL } from 'node:url'
-// This file lives OUTSIDE the runtime's pkg snapshot, so its own require cannot resolve the
-// bundled '@deepseek-ai/*' modules. The snapshot's patched fs is process-global though, so a
-// createRequire anchored INSIDE the snapshot's node_modules resolves them fine. The anchor is
-// derived from the running entry script (…/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-demo/lib/
-// packaged-bin.js), which holds for both runtime carriers.
-const path = require('node:path')
-const { createRequire } = require('node:module')
+// This file lives OUTSIDE the runtime's snapshot, so a bare '@deepseek-ai/*' specifier cannot
+// resolve from here. A require anchored INSIDE the snapshot's node_modules resolves the paths;
+// the modules themselves are then imported, the way the loader loads them. The anchor is
+// derived from the running entry script (…/node_modules/@deepseek-ai/dsh/lib/bin.js).
const entry = process.argv[1] || ''
const nmIdx = entry.lastIndexOf('node_modules')
if (nmIdx < 0) {
throw new Error(`hr-sdk-jsonrpc-server: cannot locate the runtime's node_modules from entry '${entry}'`)
}
-const sreq = createRequire(path.join(entry.slice(0, nmIdx + 'node_modules'.length), 'hr-anchor.js'))
-const base = sreq('@deepseek-ai/dsh-sdk-jsonrpc-server')
-const { SessionId } = sreq('@deepseek-ai/dsh-session')
-const { JsonRpcLineTransport } = sreq('@deepseek-ai/dsh-sdk-protocol')
+const nmRoot = entry.slice(0, nmIdx + 'node_modules'.length)
+const sreq = createRequire(path.join(nmRoot, 'hr-anchor.js'))
+const load = async (name) => {
+ let file
+ try {
+ file = sreq.resolve(name)
+ } catch {
+ file = path.join(nmRoot, name, 'lib', 'index.js') // an import-only exports map: the compiled entry
+ }
+ return import(pathToFileURL(file).href)
+}
+const base = await load('@deepseek-ai/dsh-sdk-jsonrpc-server')
+const { SessionId } = await load('@deepseek-ai/dsh-session')
+const { JsonRpcLineTransport } = await load('@deepseek-ai/dsh-sdk-protocol')
-const PINNED = '0.1.0-rc.7' // the repo-wide version the runtime wheel bundles
+const PINNED = '0.1.2-rc.1' // the repo-wide version the runtime wheel bundles
const got = sreq('@deepseek-ai/dsh-sdk-jsonrpc-server/package.json').version
if (got !== PINNED) {
throw new Error(`hr-sdk-jsonrpc-server is pinned to @deepseek-ai/dsh-sdk-jsonrpc-server@${PINNED} ` +
@@ -49,6 +62,7 @@ class HrServer extends base.HarnessSdkJsonRpcServer {
agentOptions: {
provider: this.provider,
model: this.model,
+ ...this.reasoningEffort === undefined ? {} : { reasoningEffort: this.reasoningEffort },
...this.maxTokens === undefined ? {} : { maxTokens: this.maxTokens },
},
})
@@ -65,10 +79,10 @@ class HrServer extends base.HarnessSdkJsonRpcServer {
}
}
-exports.name = 'hr-sdk-jsonrpc-server'
-exports.inject = ['agents']
+export const name = 'hr-sdk-jsonrpc-server'
+export const inject = ['agents']
-exports.apply = function apply(ctx, config) {
+export function apply(ctx, config) {
const rootFiber = ctx.root.fiber
const transport = new JsonRpcLineTransport(process.stdin, process.stdout)
const server = new HrServer(ctx, transport, {
diff --git a/runner/server.py b/runner/server.py
index 2b578966..a313e897 100644
--- a/runner/server.py
+++ b/runner/server.py
@@ -1994,7 +1994,12 @@ def _pi_to_claude(obj: dict, state: dict) -> list[dict]:
# <agent_dir>/sessions/<cwd slug>/<ts>_<id>.jsonl, -r <id> recalls the first message, --tools=read
# leaves a write unwritten, and every assistant message names the model it ran.
OMP_PROVIDERS = {"anthropic", "openai", "azure", "openrouter", "tokenrouter", "openai-api"}
-ALL_OMP_TOOLS = {"bash", "read", "write", "edit", "glob", "grep", "lsp", "python", "todo", "task", "browser", "web_search"}
+# The built-in tools omp 18.1.13 accepts on --tools, read off the binary by probing each name (a
+# rejected name kills the turn: "Unknown tool in --tools"). "python" and "browser" were in this
+# list and are not tools of this build, so every harness that disabled ANY tool sent an allowlist
+# omp refused, and every one of its turns died with a stack trace (found by the custom-harness
+# matrix dimension, 2026-09-08). A CLI bump re-probes this list; the test beside it pins it.
+ALL_OMP_TOOLS = {"bash", "read", "write", "edit", "glob", "grep", "lsp", "todo", "task", "web_search"}
def _omp_has_session(agent_dir: pathlib.Path, session_id: str) -> bool:
@@ -2020,8 +2025,13 @@ def _omp_has_session(agent_dir: pathlib.Path, session_id: str) -> bool:
def _omp_write_mcp(agent_dir: pathlib.Path, servers: list[dict] | None) -> bool:
"""Write <agent_dir>/mcp.json for OMP native MCP support.
- OMP supports native project and user MCP configurations with the standard
- mcpServers schema. Returns whether any server was written.
+ OMP reads the user file at <agent_dir>/mcp.json (PI_CODING_AGENT_DIR) with the standard
+ mcpServers schema. `type: "http"` is what docs/mcp-config.md requires on an HTTP entry ("http
+ transport: Required: type, url"), so the entry says it. Measured on 18.1.13 (2026-09-08): the
+ loader also infers it, `transport ?? (command ? "stdio" : url ? "http" : "stdio")`, so an
+ untyped entry with a url was served too; the dimension's earlier miss on omp was its judge,
+ which reads tool names, while omp dispatches MCP as a `write` to
+ xd://mcp__<server>_<tool>. Returns whether any server was written.
"""
entries: dict = {}
for s in servers or []:
@@ -2029,7 +2039,7 @@ def _omp_write_mcp(agent_dir: pathlib.Path, servers: list[dict] | None) -> bool:
if not url:
continue
name = _mcp_name((s or {}).get("name") or (s or {}).get("id") or "mcp")
- entry: dict = {"url": url}
+ entry: dict = {"type": "http", "url": url}
auth = (s or {}).get("auth")
if auth:
hdr = auth if str(auth).lower().startswith("bearer ") else f"Bearer {auth}"
@@ -2103,7 +2113,11 @@ def _build_omp(provider: str, auth: Auth, model: str, prompt: str, cwd: str, env
if tools_disabled:
disabled = {x.split(" (")[0].strip().lower() for x in tools_disabled if x and x.strip()}
enabled = [t for t in sorted(ALL_OMP_TOOLS) if t not in disabled]
- if not enabled:
+ # A disable list that names none of omp's tools (a name from another runtime, say) changes
+ # nothing, so nothing is sent: an allowlist is only a constraint when it removes something.
+ if len(enabled) == len(ALL_OMP_TOOLS):
+ pass
+ elif not enabled:
cmd += ["--no-tools"]
else:
cmd += [f"--tools={','.join(enabled)}"]
diff --git a/runner/tests/test_dsh_normalize.py b/runner/tests/test_dsh_normalize.py
index 8cde73c5..025ba66a 100644
--- a/runner/tests/test_dsh_normalize.py
+++ b/runner/tests/test_dsh_normalize.py
@@ -1,6 +1,7 @@
"""The dsh normalizer and driver pieces, against live-captured wire shapes.
-Every fixture below is verbatim from `deepseek-harness-sdk==0.1.0rc7` runs on 2026-08-20:
+Every fixture below is verbatim from `deepseek-harness-sdk==0.1.0rc7` runs on 2026-08-20; the
+relay and event shapes were re-verified against 0.1.2rc1 on 2026-09-08 (same envelope, same types):
the bad-key run (error terminal), the TokenRouter tool run (tool/call + tool/result +
usage + retry ladder), and the raw TokenRouter SSE whose empty-string id/name fields are
the reason the driver's relay exists.
@@ -186,22 +187,54 @@ def test_build_dsh_native_anthropic_default_base(tmp_path):
assert env["HR_DSH_BASE_URL"] == "https://api.anthropic.com/v1"
-def test_compose_cordis_v1_normalization_per_api(tmp_path, monkeypatch):
+def _patch(tmp_path, servers, llm=None, model="m"):
+ import yaml
+ home = tmp_path / "home"
+ out = pathlib.Path(dsh_driver._compose_patch(home, servers, llm=llm, relay_port=9999, model=model, cwd=str(tmp_path / "ws")))
+ return out.read_text(), yaml.safe_load(out.read_text())
+
+
+def test_compose_patch_v1_normalization_per_api(tmp_path):
"""anthropic-messages appends /v1/messages itself — its relay base must be bare; the openai
apis want /v1 present. The doubled /v1/v1/messages this guards against was measured live."""
- import types, sys as _sys
- fake = types.ModuleType("deepseek_harness_runtime")
- cfg = tmp_path / "bundled.yml"
- cfg.write_text("- id: sdk-jsonrpc-server\n name: '@deepseek-ai/dsh-sdk-jsonrpc-server'\n")
- fake.bundled_default_config_path = lambda: str(cfg)
- monkeypatch.setitem(_sys.modules, "deepseek_harness_runtime", fake)
- home = tmp_path / "home"
- out_a = pathlib.Path(dsh_driver._compose_cordis(home, [], llm={"api": "anthropic-messages"},
- relay_port=9999, model="claude-haiku-4-5")).read_text()
- assert "baseURL: http://127.0.0.1:9999\n" in out_a and "9999/v1" not in out_a
- out_o = pathlib.Path(dsh_driver._compose_cordis(home, [], llm={"api": "openai-responses"},
- relay_port=9999, model="gpt-5.4-mini")).read_text()
- assert "baseURL: http://127.0.0.1:9999/v1" in out_o
+ text_a, _ = _patch(tmp_path, [], llm={"api": "anthropic-messages"}, model="claude-haiku-4-5")
+ assert "baseURL: http://127.0.0.1:9999\n" in text_a and "9999/v1" not in text_a
+ text_o, _ = _patch(tmp_path, [], llm={"api": "openai-responses"}, model="gpt-5.4-mini")
+ assert "baseURL: http://127.0.0.1:9999/v1" in text_o
+
+
+def test_compose_patch_swaps_the_server_row_and_inserts_one_mcp_row_per_server(tmp_path):
+ """The loader's patch grammar (0.1.2rc1): a row named by id is merged, `disabled: true` stops
+ one, `insert` appends. A patch cannot rename a row, so the resume-or-create server is
+ disable-plus-insert; every MCP server becomes one dsh-mcp-client row with its headers."""
+ _, doc = _patch(tmp_path, [{"name": "deep wiki!", "url": "https://mcp.example/mcp", "auth": "tok",
+ "headers": {"X-Trace": "1"}},
+ {"name": "nourl"}])
+ disabled = [e["id"] for e in doc if e.get("disabled") is True]
+ assert disabled == ["sdk-jsonrpc-server", "sandbox", "sandbox-policy", "bash-sandbox", "fs-sandbox", "permission"]
+ rows = [e for e in doc if "insert" in e][0]["insert"]
+ assert rows[0]["id"] == "hr-sdk-jsonrpc-server" and rows[0]["name"].endswith("/.dsh/hr_dsh_server.mjs")
+ assert rows[0]["inject"] == ["sdkAppStartup", "loader"] and rows[0]["config"] == {"maxTokensAsSuccess": True}
+ assert (tmp_path / "home" / ".dsh" / "hr_dsh_server.mjs").exists()
+ # no sandboxing executor in the composition: the local executors, so no file tool advertises
+ # the escalation fields GPT models fill on every call
+ assert [(r["name"], r["config"]) for r in rows if r["id"] in ("hr-bash-local", "hr-fs-local")] == [
+ ("@deepseek-ai/dsh-bash-local", {"cwd": str(tmp_path / "ws")}), ("@deepseek-ai/dsh-fs-local", {"cwd": str(tmp_path / "ws")})]
+ mcp = [r for r in rows if r["name"] == "@deepseek-ai/dsh-mcp-client"]
+ assert len(mcp) == 1, "a server without a url is not a server"
+ assert mcp[0]["config"] == {"transport": "streamable-http", "serverName": "deepwiki",
+ "url": "https://mcp.example/mcp",
+ "headers": {"Authorization": "Bearer tok", "X-Trace": "1"}}
+ assert not [e for e in doc if e.get("id") == "llm-pi-ai"], "the deepseek-official path merges nothing into llm-pi-ai"
+
+
+def test_compose_patch_merges_the_route_into_the_stock_pi_ai_row(tmp_path):
+ _, doc = _patch(tmp_path, [], llm={"api": "openai-completions", "vision": False}, model="qwen/qwen3.7-max")
+ row = doc[-1]
+ assert row["id"] == "llm-pi-ai" and "name" not in row, "a patch merges by id; naming the row is a rename, which the loader refuses"
+ hr = row["config"]["providers"]["hr"]
+ assert hr["apiKeyEnv"] == "HR_RELAY_TOKEN" and hr["models"][0] == {
+ "id": "qwen/qwen3.7-max", "contextWindow": 200000, "maxTokens": 32000, "input": ["text"]}
# ── reasoning_effort strip-and-retry (conformance T-01 against LLMTR, 2026-08-20) ──────────────
diff --git a/runner/tests/test_omp_backend.py b/runner/tests/test_omp_backend.py
index ad255aea..ac49c75b 100644
--- a/runner/tests/test_omp_backend.py
+++ b/runner/tests/test_omp_backend.py
@@ -143,6 +143,28 @@ def test_omp_all_tools_disabled_passes_no_tools():
assert "--no-tools" in cmd
+def test_the_omp_tool_list_is_what_the_pinned_build_accepts():
+ """Read off omp 18.1.13 by probing each name on --tools (2026-09-08): "python" and "browser"
+ were in this list and are not tools of that build, so every harness that disabled ANY tool sent
+ an allowlist omp refused ("Unknown tool in --tools") and every one of its turns died."""
+ from server import ALL_OMP_TOOLS
+ assert ALL_OMP_TOOLS == {"bash", "read", "write", "edit", "glob", "grep", "lsp", "todo", "task", "web_search"}
+ assert "python" not in ALL_OMP_TOOLS and "browser" not in ALL_OMP_TOOLS
+
+
+def test_a_disable_list_that_names_none_of_omps_tools_sends_no_allowlist():
+ """A name from another runtime ("WebSearch", say) removes nothing, so nothing is sent: an
+ allowlist is only a constraint when it removes something, and sending one for nothing is what
+ put a refused name in front of omp."""
+ d = tempfile.mkdtemp()
+ env = {"HOME": d}
+ auth = Auth(api_key="sk-test")
+ cmd = _build_omp("openai", auth, "gpt-5.4", "do task", d, env, tools_disabled=["WebSearch", "Grep (inherited)"])
+ assert not [x for x in cmd if x.startswith("--tools=")] or "grep" not in cmd[[i for i, x in enumerate(cmd) if x.startswith("--tools=")][0]]
+ cmd2 = _build_omp("openai", auth, "gpt-5.4", "do task", d, env, tools_disabled=["WebSearch"])
+ assert not [x for x in cmd2 if x.startswith("--tools=")] and "--no-tools" not in cmd2
+
+
def test_omp_mcp_config_written():
d = tempfile.mkdtemp()
env = {"HOME": d}
@@ -353,3 +375,16 @@ def test_omp_turn_e2e_with_mock_llm():
assert data.get("done") is True
assert data.get("status") == "done"
assert "OMP works!" in data.get("result", "")
+
+
+def test_omp_mcp_entries_carry_the_http_type_omp_requires(tmp_path):
+ """omp's docs/mcp-config.md: an http transport entry requires `type: "http"` and `url`, so the
+ entry carries it. (18.1.13 also infers http from a url when the type is absent; the entry
+ matches the documented schema rather than the inference.)"""
+ from server import _omp_write_mcp
+ ok = _omp_write_mcp(tmp_path, [{"name": "deepwiki", "url": "https://mcp.deepwiki.com/mcp", "auth": "tok"},
+ {"name": "nourl"}])
+ assert ok
+ doc = json.loads((tmp_path / "mcp.json").read_text())
+ assert doc["mcpServers"] == {"deepwiki": {"type": "http", "url": "https://mcp.deepwiki.com/mcp",
+ "headers": {"Authorization": "Bearer tok"}}}
diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.ts
index 2829bb0e..397be057 100644
--- a/ui/src/lib/harness.ts
+++ b/ui/src/lib/harness.ts
@@ -106,7 +106,7 @@ export const OOB: OobHarness[] = [
{ id: 'omp', name: 'Oh My Pi', version: 'v18.1.13', backend: 'omp', status: 'ready',
// pi's lineage, pi's reach: the placeholder is pi's list; the gateway's catalog wins once fetched
models: ['gpt-5.4', 'gpt-6-astra', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5', 'gpt-5.4-mini', 'gpt-5.2', 'claude-opus-5', 'claude-fable-5', 'claude-opus-4.8', 'claude-sonnet-5', 'claude-opus-4.7', 'claude-sonnet-4.6', 'claude-haiku-4.5', 'gemini-3.6-flash', 'gemini-3.8-flash', 'gemini-3.7-flash', 'gemini-3.5-flash', 'gemini-3.5-flash-lite', 'gemini-3.1-flash-lite', 'gemini-3.1-pro-preview', 'gemini-3-flash-preview', 'gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.5-flash-lite', 'deepseek-v4-pro', 'kimi-k3', 'qwen3.7-max'], defaultModel: 'gpt-5.4', moreModels: 0,
- systemPrompt: 'You are Oh My Pi (OMP), an autonomous coding agent. You operate on a real git workspace with shell, file access, LSP, Python, browser, and subagents to complete engineering tasks end to end.',
+ systemPrompt: 'You are Oh My Pi (OMP), an autonomous coding agent. You operate on a real git workspace with shell, file access, LSP, web search, and subagents to complete engineering tasks end to end.',
tools: [], skills: [] },
];