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.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
fix(tools): a disabled tool the agent still uses, and a tools list the UI made up
richard-epsilla3958c71ec07a
diff --git a/gateway/app.py b/gateway/app.pyindex f321f2a7..def1ae9d 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -6333,10 +6333,56 @@ async def test_mcp_public(body: McpTestBody, request: Request) -> dict:# ── custom harnesses (per-org, server-persisted; replaces the client localStorage seam) ───────-# Bases this server can execute. Derived from the same mapping the turn loop uses-# (_backend_of_harness), so the two cannot disagree: anything not listed here has no backend and-# could only fail at task time.-_SUPPORTED_BASES = ("codex", "claude-code", "claude", "hermes")+# ── base harness catalog ─────────────────────────────────────────────────────────────────+# What each base IS. The console used to carry its own copy of this — models, tools, skills and+# system prompts hard-coded in the frontend — which drifted from what the server actually runs: it+# advertised four built-in skills (docx/pdf/pptx/xlsx) that exist nowhere, and a model list that+# went stale the moment the catalog here changed. Anything a user sees about a base is served from+# this table plus the live model catalog, so there is one answer and it is the running one.+#+# `tools` carries BOTH the real name and how far disabling it actually goes, because those differ by+# runtime and the console must not imply a guarantee the runtime cannot keep (see the protocol's+# harnesses.md §4.3):+# hard — the CLI enforces it (claude: --disallowedTools takes these exact names).+# instruction — no per-tool switch exists; the name is written into the agent doc as a request.+_BASE_CATALOG: dict[str, dict] = {+ "codex": {+ "label": "Codex", "backend": "codex", "status": "ready",+ "system_prompt": ("You are Codex, an autonomous software-engineering agent. You operate on "+ "a real git workspace with shell access, reading and editing files and "+ "running commands to complete the task, returning reviewable diffs and "+ "results."),+ "tools": [("shell", "Shell"), ("apply_patch", "Apply Patch"), ("read_file", "File Read"),+ ("write_file", "File Write"), ("git", "Git")],+ "tool_enforcement": "instruction",+ },+ "claude-code": {+ "label": "Claude Code", "backend": "claude", "status": "ready",+ "system_prompt": ("You are Claude Code, an agentic coding assistant. You work on a real "+ "local git working tree with bash, edit files, run tests, and use "+ "sub-agents to complete engineering tasks end to end."),+ # These are the names Claude Code's --disallowedTools accepts. They are the real thing, not+ # display labels: a label with a suffix would silently fail to match and disable nothing.+ "tools": [("Bash", "Bash"), ("Read", "Read"), ("Edit", "Edit"), ("Write", "Write"),+ ("Grep", "Grep"), ("Glob", "Glob"), ("WebFetch", "WebFetch"),+ ("WebSearch", "WebSearch"), ("Task", "Task (subagents)")],+ "tool_enforcement": "hard",+ },+ "hermes": {+ "label": "Hermes", "backend": "hermes", "status": "ready",+ "system_prompt": ("You are Hermes, a self-improving autonomous agent. You work on a real "+ "project workspace with shell and file access, complete tasks end to end, "+ "and build a persistent memory and skill library from what you learn."),+ "tools": [("terminal", "Terminal"), ("read_file", "File Read"), ("write_file", "File Write"),+ ("patch", "Patch"), ("search_files", "Search"), ("web_search", "Web Search"),+ ("web_extract", "Web Extract")],+ "tool_enforcement": "instruction",+ },+}++# Bases this server can execute. Derived from the catalog above so the two cannot disagree —+# `claude` is accepted as an alias for `claude-code` because existing harnesses store it.+_SUPPORTED_BASES = tuple(_BASE_CATALOG) + ("claude",)def _require_supported_base(base: str) -> str:@@ -6624,6 +6670,40 @@ async def get_harness_public(hid: str, request: Request) -> dict:return _harness_out(v)[email protected]("/v1/bases")+async def list_bases(request: Request) -> dict:+ """What each base harness is, and what it can actually do here.++ The console renders bases entirely from this: models with live availability, the real tool names+ and how far disabling one goes, and the built-in skills — which is an EMPTY list, deliberately.+ Codex, Claude Code and Hermes each discover their own bundled skills at run time and expose no+ way to enumerate them from outside a turn, so this server does not know them. It says so rather+ than listing plausible names: the console previously showed four (docx, pdf, pptx, xlsx) that+ exist nowhere, and every control next to them — Replace, Disable — acted on nothing.+ """+ org, _ = await _pub_org_member(request)+ out = []+ for bid, b in _BASE_CATALOG.items():+ backend = b["backend"]+ cat = _MODEL_CATALOG.get(backend, {})+ servable = await _servable_models(org, backend)+ ok = (lambda m: True) if servable is None else (lambda m: m in servable)+ out.append({+ "id": bid, "object": "harness.base", "label": b["label"], "backend": backend,+ "status": b["status"], "systemPrompt": b["system_prompt"],+ "defaultModel": cat.get("default", ""),+ "models": [{"id": m, "available": ok(m), "default": m == cat.get("default")}+ for m in cat.get("models", [])],+ "tools": [{"name": n, "label": lbl, "enforcement": b["tool_enforcement"]}+ for n, lbl in b["tools"]],+ # Honest emptiness: see the docstring. `builtinSkillsEnumerable` lets the console say+ # "this base brings its own" instead of implying the base has none at all.+ "builtinSkills": [],+ "builtinSkillsEnumerable": False,+ })+ return {"bases": out}++@app.get("/v1/models")async def list_models(request: Request) -> dict:"""Global model catalog (public, Bearer): every backend's available models + default. Callersdiff --git a/protocol/conformance/README.md b/protocol/conformance/README.mdindex 8dd480dc..4b80d90c 100644--- a/protocol/conformance/README.md+++ b/protocol/conformance/README.md@@ -121,6 +121,23 @@ config-level check would have seen:7. **The MCP URL policy was advisory.** It ran only on the console's "Test connection" button, sothe console refused a URL that a turn then connected to anyway. It is now one function applied atboth config time and run time.+8. **Claude's hard block was a no-op, and the product claimed it was hard.** Disabled tools were+ passed as `--disallowedTools`, which belongs to the permission-prompt system — and autonomous+ runs pass `--dangerously-skip-permissions`, which turns that system off. The flag was accepted+ and ignored, so an operator who disabled `Bash` watched the agent run `Bash`. The restriction is+ now written into the runtime's settings file as a deny rule, which the skip-permissions flag does+ not override. Proven both ways against a live agent: with the tool enabled it ran the command;+ with it disabled the agent reported having no such tool and did not run it.++### What these checks do not establish++The suite verifies that `disabledTools` **persists**, not that it is **enforced**. Enforcement is+deliberately not checked, because §4.3 permits instruction-level enforcement, and an agent that+obeys an instruction is indistinguishable over HTTP from a runtime that blocks the tool — so a+behavioural check would pass a server whose block does nothing whenever the model happened to+comply. Defect 8 was a no-op block that a behavioural check would have called conformant on most+runs. Enforcement is verified against the runtime, by disabling a tool and asserting the agent never+invokes it, and it belongs in an implementation's own test suite rather than here.## Adding a checkdiff --git a/runner/server.py b/runner/server.pyindex 2b1e58fa..ecda6a6f 100644--- a/runner/server.py+++ b/runner/server.py@@ -830,10 +830,26 @@ def _build_claude(provider: str, auth: Auth, model: str, prompt: str, max_turns:cmd.append("--include-partial-messages")if mcp_config: # owner-attached MCP servers (.harness/mcp.json) — adds their tools this turncmd += ["--mcp-config", mcp_config]- if disallowed_tools: # built-in tools the harness disabled (catalog labels → real Claude tool names)+ # Disabled tools go in settings.json, NOT on the command line. `--disallowedTools` is part of+ # the permission prompt system, and we pass --dangerously-skip-permissions (autonomous runs+ # cannot answer a prompt), which disables that system wholesale — so the flag was accepted,+ # ignored, and the console showed "Disabled" next to a tool the agent went on using. Verified+ # both ways against the CLI: with the flag the agent still ran bash; with this deny list it+ # reported having no shell tool and did not run it.+ if disallowed_tools:names = [t.split(" (")[0].strip() for t in disallowed_tools if t and t.strip()]if names:- cmd += ["--disallowedTools", ",".join(names)]+ settings_path = cfg_dir / "settings.json"+ try:+ current = json.loads(settings_path.read_text()) if settings_path.exists() else {}+ if not isinstance(current, dict):+ current = {}+ except Exception: # noqa: BLE001 — a corrupt file must not lose the restriction+ current = {}+ perms = current.get("permissions") if isinstance(current.get("permissions"), dict) else {}+ perms["deny"] = names+ current["permissions"] = perms+ settings_path.write_text(json.dumps(current, indent=2))if resume_session_id:# Only resume if the conversation file is ACTUALLY in the (re)hydrated workspace. A prior turn# can record a cli_session_id but fail before checkpointing its .jsonl — then `--resume <id>`diff --git a/ui/src/app/(app)/harnesses/[id]/page.tsx b/ui/src/app/(app)/harnesses/[id]/page.tsxindex 706dc1ca..1061325b 100644--- a/ui/src/app/(app)/harnesses/[id]/page.tsx+++ b/ui/src/app/(app)/harnesses/[id]/page.tsx@@ -7,7 +7,7 @@ import { useEffect, useMemo, useState } from 'react';import { SkelPage } from '@/components/Skel';import { useParams, useRouter } from 'next/navigation';import {- OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,+ OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,modelAvailable,type CustomHarness, type OobHarness } from '@/lib/harness';import { HarnessLogo } from '@/components/HarnessLogo';@@ -52,6 +52,11 @@ export default function HarnessSettingsPage() {const dirty = useMemo(() => JSON.stringify(draft) !== JSON.stringify(saved), [draft, saved]);useModelCatalog(); // model list comes from the gateway, not a local copyconst base = oob || oobById(draft?.base || '') || null;+ // Capabilities come from the server, never from the static table: it once advertised four+ // built-in skills that existed nowhere, with controls beside them that acted on nothing.+ const bases = useBases();+ const srvBase = bases?.[base?.id || draft?.base || ''] || null;+ const baseTools = srvBase?.tools || [];const models = oobModels(base);const upd = (p: Partial<CustomHarness>) => setDraft((d) => (d ? { ...d, ...p } : d));@@ -88,7 +93,7 @@ export default function HarnessSettingsPage() {const readOnly = Boolean(oob);const skills = draft?.skills || [];const ownSkills = skills.map((s, idx) => ({ s, idx })).filter(({ s }) => isOwnSkill(s));- const baseSkillNames = (base?.skills || []).filter((n) => !ownSkills.some(({ s }) => s.name === n));+ const baseSkillNames = (srvBase?.builtinSkills || []).filter((n) => !ownSkills.some(({ s }) => s.name === n));const disabledTools = new Set(draft?.disabledTools || []);const stats = statsFor(cards);@@ -183,17 +188,19 @@ export default function HarnessSettingsPage() {<section className="form-section"><div><h3>Tools</h3><p>Control inherited tools and add MCP servers for external capabilities.</p></div><div className="field-stack">- <div className="section-actions"><strong>{(base?.tools?.length || 0) + (draft?.mcpServers?.length || 0)} configured tools</strong>+ <div className="section-actions"><strong>{baseTools.length + (draft?.mcpServers?.length || 0)} configured tools</strong>{!readOnly && <button className="button small" type="button" onClick={() => setMcpModal({ idx: null })}><iconify-icon icon="tabler:plus"></iconify-icon>Add MCP</button>}</div><div className="capability-list">- {(base?.tools || []).map((t) => (- <div key={t} className="capability-row">+ {baseTools.map((t) => (+ <div key={t.name} className="capability-row"><span className="capability-icon"><iconify-icon icon="tabler:plug"></iconify-icon></span>- <div className="capability-copy"><strong>{t}</strong><span>Inherited from {base?.name}</span></div>+ <div className="capability-copy"><strong>{t.label}</strong>+ <span>Built into {base?.name}+ {t.enforcement === 'instruction' && ' · disabling asks the agent not to use it'}</span></div><div className="capability-actions">- <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!disabledTools.has(t)}- onClick={() => upd({ disabledTools: disabledTools.has(t) ? (draft?.disabledTools || []).filter((x) => x !== t) : [...(draft?.disabledTools || []), t] })}>- {disabledTools.has(t) ? 'Disabled' : 'Enabled'}</button>+ <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!disabledTools.has(t.name)}+ onClick={() => upd({ disabledTools: disabledTools.has(t.name) ? (draft?.disabledTools || []).filter((x) => x !== t.name) : [...(draft?.disabledTools || []), t.name] })}>+ {disabledTools.has(t.name) ? 'Disabled' : 'Enabled'}</button></div></div>))}@@ -256,6 +263,15 @@ export default function HarnessSettingsPage() {</div>);})}+ {ownSkills.length === 0 && baseSkillNames.length === 0 && (+ <div className="capability-row">+ <span className="capability-icon"><iconify-icon icon="tabler:bulb"></iconify-icon></span>+ <div className="capability-copy"><strong>No Skills added yet</strong>+ <span>{srvBase && !srvBase.builtinSkillsEnumerable+ ? `${base?.name} brings its own Skills and discovers them when it runs, so they can't be listed here. Add a Skill to give this Harness something of your own.`+ : 'Add a Skill to give this Harness a workflow of your own.'}</span></div>+ </div>+ )}</div></div></section>diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.tsindex 7f51cd52..dd1b9976 100644--- a/ui/src/lib/harness.ts+++ b/ui/src/lib/harness.ts@@ -1,6 +1,11 @@-// Harness data layer. Out-of-box catalog is static for v1 (will read the runner /backends-// metadata next). Custom harnesses are persisted server-side per-org in the VectorGraph tenant-// via the gateway (/api/harness/v1/orgs/{org}/harnesses); the BFF injects the internal trust key.+// Harness data layer.+//+// What a base harness CAN DO — its models, its tools, its built-in skills, its system prompt —+// comes from the server (/v1/bases), never from this file. It used to be hard-coded here, and it+// drifted: the console advertised four built-in skills (docx, pdf, pptx, xlsx) that exist nowhere,+// with Replace and Disable buttons next to them acting on nothing, while the agent actually had a+// completely different set the CLI discovers for itself. The static table below now carries only+// identity and presentation; every capability field is filled in from the server.import { useEffect, useState } from 'react';import { harnessFetch } from '@/lib/hfetch';@@ -44,13 +49,11 @@ export const OOB: OobHarness[] = [{ id: 'codex', name: 'Codex', version: 'v1.0.1', backend: 'codex', status: 'ready',models: ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5', 'gpt-5.4', 'gpt-5.4-mini', 'gpt-5.2'], defaultModel: 'gpt-5.5', moreModels: 0,systemPrompt: 'You are Codex, an autonomous software-engineering agent. You operate on a real git workspace with shell access, reading and editing files and running commands to complete the task, returning reviewable diffs and results.',- tools: ['Shell', 'Apply Patch', 'File Read/Write', 'Git', 'Network (sandboxed)'],- skills: ['docx', 'pdf', 'pptx', 'xlsx'] },+ tools: [], skills: [] },{ id: 'claude-code', name: 'Claude Code', version: 'v1.0.1', backend: 'claude', status: 'ready',models: ['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'], defaultModel: 'claude-opus-4.8', moreModels: 0,systemPrompt: 'You are Claude Code, an agentic coding assistant. You work on a real local git working tree with bash, edit files, run tests, and use sub-agents to complete engineering tasks end to end.',- tools: ['Bash', 'Read', 'Edit', 'Write', 'Grep', 'Glob', 'WebFetch', 'Task (subagents)'],- skills: ['docx', 'pdf', 'pptx', 'xlsx'] },+ tools: [], skills: [] },{ id: 'pi', name: 'Pi', version: 'v1.0.1', backend: null, status: 'soon',models: [], moreModels: 0,systemPrompt: 'Pi harness, coming soon.', tools: [], skills: [] },@@ -58,8 +61,7 @@ export const OOB: OobHarness[] = [// Multi-family: Hermes runs any frontier model, the gpt + claude catalogs, default gpt-5.5.models: ['gpt-5.5', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.4', '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', 'deepseek-v4-pro', 'kimi-k3', 'glm-5.2', 'qwen3.7-max'], defaultModel: 'gpt-5.5', moreModels: 0,systemPrompt: 'You are Hermes, a self-improving autonomous agent. You work on a real project workspace with shell and file access, complete tasks end to end, and build a persistent memory and skill library from what you learn, getting more capable the longer you run.',- tools: ['Terminal', 'File Read/Write', 'Patch', 'Search', 'Web Search', 'Web Extract', 'Browser'],- skills: ['docx', 'pdf', 'pptx', 'xlsx'] },+ tools: [], skills: [] },];export const oobById = (id: string) => OOB.find((o) => o.id === id) || null;@@ -136,6 +138,51 @@ export const oobDefaultModel = (o: OobHarness | null | undefined): string => {return o.defaultModel || fromServer || oobModels(o)[0] || '';};+export interface BaseTool { name: string; label: string; enforcement: 'hard' | 'instruction' }+export interface BaseInfo {+ id: string; label: string; backend: string; status: string; systemPrompt: string;+ defaultModel: string;+ models: { id: string; available: boolean; default: boolean }[];+ tools: BaseTool[];+ /** Built-in skills the SERVER can enumerate. Empty when it cannot — see builtinSkillsEnumerable. */+ builtinSkills: string[];+ /** false means the base brings its own skills but nothing outside a turn can list them. The UI+ * must say that rather than render an empty list as "this base has no skills". */+ builtinSkillsEnumerable: boolean;+}++let _bases: Record<string, BaseInfo> | null = null;+let _basesInflight: Promise<Record<string, BaseInfo>> | null = null;++async function fetchBases(): Promise<Record<string, BaseInfo>> {+ if (_bases) return _bases;+ if (_basesInflight) return _basesInflight;+ _basesInflight = (async () => {+ try {+ const r = await harnessFetch('/api/harness/v1/bases', { headers: gwHeaders(), cache: 'no-store' });+ if (!r.ok) return {};+ const doc = await r.json();+ const map: Record<string, BaseInfo> = {};+ for (const b of doc.bases || []) map[b.id] = b as BaseInfo;+ _bases = map;+ return map;+ } catch { return {}; }+ finally { _basesInflight = null; }+ })();+ return _basesInflight;+}++/** Server-described bases. null until loaded — a caller shows nothing rather than a guess. */+export function useBases(): Record<string, BaseInfo> | null {+ const [b, setB] = useState<Record<string, BaseInfo> | null>(_bases);+ useEffect(() => {+ let alive = true;+ fetchBases().then((m) => { if (alive && Object.keys(m).length) setB(m); });+ return () => { alive = false; };+ }, []);+ return b;+}+/** Load the server catalog once per tab and re-render when it lands. Any surface that shows a* model picker calls this; without it the placeholder literals would be what the user sees. */export function useModelCatalog(): ModelCatalog | null {