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.

docs(harness): what a harness must prove, and a dimension for custom ones (#133)

github-actions[bot]801cad5051bf
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 16da6d16..d45e0a39 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,6 +7,15 @@ standard for how products work with agent harnesses, and this repository, a work
of it. Both take contributions — the specification, the conformance suite, harness support, the
implementation, and the documentation.
+## Verifying a harness
+
+A harness that answers is not a harness that works. Before a change to harness support ships, it is
+measured: five scenarios per harness and model, plus a custom harness carrying its own skill and
+tool policy, judged by rules that are enforced in code rather than by eye.
+[docs/harness-verification.md](docs/harness-verification.md) says what must be proven, how each
+claim is measured, and where the rule lives. Read it before adding a harness or changing how one
+routes, and check a change against it rather than against a green turn.
+
## Where things go
- Proposals and bug reports: GitHub Issues.
diff --git a/docs/harness-verification.md b/docs/harness-verification.md
new file mode 100644
index 00000000..ba3dd481
--- /dev/null
+++ b/docs/harness-verification.md
@@ -0,0 +1,118 @@
+# Verifying a harness
+
+A harness that answers is not a harness that works. It has to run on the connection you chose, on
+the model you asked for, keep a conversation across a model switch and a sandbox recycle, and show
+the reader what it actually produced. This page says what a harness must prove, how each claim is
+measured, and where the rule lives in code, so a change can be checked rather than believed.
+
+The tool is [`scripts/support-matrix`](../scripts/support-matrix/README.md); that README says how to
+run it. This page is about what it decides and why.
+
+## What is measured
+
+For every harness and every model its menu offers, one session runs five scenarios:
+
+| Scenario | What it proves |
+|---|---|
+| First turn | the harness starts, on the model asked for, and answers |
+| Follow-up | the session continues rather than starting again |
+| Switch | a mid-session change of model runs on the new one and keeps the thread, then switches back |
+| Artifact | a file the task must produce exists in the turn record and is shown to the reader |
+| Recycle | the sandbox is let go on purpose, then a follow-up still recalls the first message |
+
+## The rules that decide a row
+
+A scenario that "completed" is not a pass on its own. Four rules turn a run into a verdict, and each
+is enforced in code rather than by eye.
+
+**1. It ran where you said.** A turn served by a connection other than the one under test is a
+finding, never a pass. Set `EXPECT_CONNECTION` for the run; every turn record's own connection stamp
+is compared against it, so a pair served by two connections is visible.
+Enforced in `scripts/support-matrix/run.mjs` and reported by `render.py`.
+
+**2. It ran what you asked.** A served model other than the id asked for is a substitution and a
+finding. The one exception is a provider's own name for the same model: an aggregator's vendor
+prefix (`anthropic/claude-fable-5`) or a provider's dated or versioned suffix
+(`claude-haiku-4-5-20251001`) is the same model, noted in the row and counted. A different family,
+number or tier under any prefix (`google/gemini-3-flash-preview` for `gemini-3.8-flash`,
+`gemini-2.5-flash-lite` for `gemini-2.5-flash`) is another model, and stays a finding.
+Enforced in `scripts/support-matrix/samemodel.py`, pinned by `test_samemodel.py`.
+
+**3. What the reader sees is what was stored.** The artifact row requires the rendered file cards to
+BE the turn's stored files: same names, same count. Asking only whether some card carried the
+expected name let a file rendered twice pass as a produced artifact for months.
+Enforced in `scripts/support-matrix/run.mjs`.
+
+**4. The catalog does not promise what the harness cannot do.** A model a provider serves only on
+the Responses API is not offered on a harness that speaks chat/completions, because listing it there
+is a picker row that fails on send.
+Enforced by `gateway/tests/test_catalog_chat_only_backends.py`.
+
+## The custom-harness dimension
+
+The five scenarios measure routing. They say nothing about the configuration a person actually
+builds, which is where this product's own promise lives: your own skill, carrying your own script,
+and control over the tools the runtime brought with it. A harness that answers on every model and
+ignores the skill you wrote is not working.
+
+[`scripts/support-matrix/custom-harness.mjs`](../scripts/support-matrix/custom-harness.mjs) creates
+a harness per base, carrying a skill bundle whose `SKILL.md` tells the agent to run a script that
+ships beside it, and with one inherited tool switched off. It runs one turn, then deletes the
+harness. One turn per base, not per model: this measures what the harness carries, not where the
+turn routed.
+
+A row passes only if all five hold, each read from what the server stored:
+
+| Claim | How it is proven |
+|---|---|
+| The skill was stored on the harness | it comes back on a read of the harness |
+| The tool policy was stored | the disabled tool comes back too |
+| The bundle reached the agent | the answer carries a token that exists ONLY inside the script |
+| The script actually ran | the file the script writes is among the turn's produced files |
+| The tool policy took effect | no disabled tool appears among the turn's tool calls |
+
+The token is generated per run and never appears in `SKILL.md` or the prompt, so an answer carrying
+it came from the bundle rather than from the model's imagination, and the written file separates a
+script that ran from one that was merely read.
+
+Not yet covered: an MCP server as a harness tool. A self-contained instance hosts only the database
+and media servers, one needing a database and the other costing real money per call, so a fair test
+needs a reachable MCP endpoint this suite does not yet stand up. The gap is named here rather than
+papered over.
+
+## Rules for the run itself
+
+- **One provider at a time, and isolation means deletion.** A column measures what a provider can
+ actually drive, so the org holds that provider's integration and nothing else while it runs. A
+ model map pointed at an integration is not isolation: another integration can still serve the turn.
+- **A run owns the instance.** Do not deploy the console or a new image while a column is running.
+ The live-turn check passes in the gap between a worker's turns, so "no turns running" is not
+ "nothing is running", and a deploy in that gap kills a worker's session and costs the column.
+- **Never inherit a verified list from another instance.** Each instance reaches providers by its own
+ path and its own keys.
+- **Retest a bare `incomplete` before excluding a model**, and record the reproduced provider error
+ text on a row that fails.
+- **A finding is never counted as a pass.** The tables report findings separately and leave those
+ pairs out of the scenario counts.
+
+## Adding a harness
+
+A new harness is registered in five places, and is not finished until it has a measured column:
+
+1. `runner/server.py`, `BACKENDS`: its providers, default model, and the normaliser that turns its
+ output into the shape the gateway stores.
+2. `gateway/app.py`, `_MODEL_CATALOG`: the ids it offers, honestly (see rule 4), and
+ `_INTEGRATION_WIRING`: which provider types can drive it.
+3. `ui/src/lib/harness.ts`, `OOB`: the built-in harness the console lists, with its mark and models.
+4. `docker/entrypoint.sh`, how the CLI is installed on first start, under its own licence, pinned.
+5. `docs/support-matrix.md`, a column per provider, produced by the suite, with its notes in
+ `docs/support-matrix-notes.md`.
+
+Its models must be honest: every id the picker offers must run as itself, and a turn that ran on a
+different model fails rather than quietly succeeding.
+
+## Console changes
+
+Any change to a console surface must survive narrow widths. `scripts/responsive-audit.mjs` sweeps
+every surface at every width that matters and flags content wider than the box that holds it; its
+header records the last run and its result.
diff --git a/scripts/support-matrix/README.md b/scripts/support-matrix/README.md
index a479e85c..710581fb 100644
--- a/scripts/support-matrix/README.md
+++ b/scripts/support-matrix/README.md
@@ -1,5 +1,8 @@
# Support matrix suite
+What a harness must prove, and the rules that decide a row, are in
+[docs/harness-verification.md](../../docs/harness-verification.md). This file is how to run it.
+
Drives the console as one user and, for every harness and every model its menu offers, runs five
scenarios in one session: a first turn, a follow-up, a switch to another model of the harness (then
back), an artifact (a file the task must produce, checked on the transcript's file cards), and a
diff --git a/scripts/support-matrix/custom-harness.mjs b/scripts/support-matrix/custom-harness.mjs
new file mode 100644
index 00000000..6292084e
--- /dev/null
+++ b/scripts/support-matrix/custom-harness.mjs
@@ -0,0 +1,160 @@
+// The custom-harness dimension: a harness a person configured, rather than a built-in one.
+//
+// The five per-model scenarios measure routing: the right connection, the right model, a session
+// that survives a switch and a recycle. They say nothing about the configuration a person actually
+// builds, which is where this product's own promise lives: your own skill, carrying your own
+// script, and control over the tools the runtime brought with it. A harness that answers on every
+// model and ignores the skill you wrote is not working.
+//
+// BASE=https://your-instance HR_USER=… HR_PASS=… BASES=codex,claude-code,pi node custom-harness.mjs
+//
+// One turn per base, not per model: this tests what the harness carries, not where the turn routed.
+// Costs one short turn each.
+import { chromium } from 'playwright';
+import crypto from 'node:crypto';
+
+const BASE = process.env.BASE;
+const BASES = (process.env.BASES || 'codex,claude-code,hermes,pi,dsh,opencode,omp').split(',');
+const RESULTS = process.env.RESULTS || 'results-custom.json';
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const TERMINAL = new Set(['done', 'completed', 'failed', 'incomplete', 'cancelled']);
+const log = (s) => console.log(`${new Date().toISOString()} ${s}`);
+
+// The token lives ONLY inside the script, never in SKILL.md and never in the prompt, so an answer
+// that carries it came from the bundle rather than from the model's imagination.
+const token = 'STAMP-' + crypto.randomBytes(6).toString('hex');
+const SKILL = (name) => ({
+ name,
+ files: [
+ { path: 'SKILL.md', content: [
+ `---`, `name: ${name}`,
+ `description: Report this harness's build stamp. Use it whenever a stamp is asked for.`,
+ `---`, ``,
+ `# Build stamp`, ``,
+ `From the task's working directory, WITHOUT changing directory first, run this skill's`,
+ `own \`stamp.py\` with python3, giving its full path:`, ``,
+ '```bash', `python3 <this skill's directory>/stamp.py`, '```', ``,
+ `It prints one line and writes \`stamp.txt\` beside the task's other outputs, which is why`,
+ `it must run from the task's working directory rather than from this skill's.`, ``,
+ `Reply with exactly the line it printed, and nothing else.`,
+ ].join('\n') },
+ { path: 'stamp.py', content: [
+ `# Writes the stamp beside the task's other outputs and prints it.`,
+ `import pathlib`,
+ `stamp = ${JSON.stringify(token)}`,
+ `pathlib.Path('stamp.txt').write_text(stamp + '\\n')`,
+ `print(stamp)`,
+ ].join('\n') },
+ ],
+});
+
+const b = await chromium.launch({ ignoreHTTPSErrors: !!process.env.IGNORE_TLS });
+const ctx = await b.newContext({ viewport: { width: 1440, height: 900 }, ignoreHTTPSErrors: !!process.env.IGNORE_TLS });
+const page = await ctx.newPage();
+const api = (path, init) => page.evaluate(async ([p, i]) => {
+ const r = await fetch(p, i || {}); let j = null; try { j = await r.json(); } catch { /* not json */ }
+ return { status: r.status, json: j };
+}, [path, init]);
+const results = {};
+
+try {
+ await page.goto(`${BASE}/login`, { waitUntil: 'domcontentloaded' }); await sleep(2000);
+ if (page.url().includes('/login')) {
+ const set = async (sel, v) => page.$eval(sel, (el, x) => {
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set.call(el, x);
+ el.dispatchEvent(new Event('input', { bubbles: true }));
+ }, v);
+ await set('#sh-user', process.env.HR_USER || 'harnessrouter');
+ await set('#sh-pass', process.env.HR_PASS);
+ await page.click('button[type=submit]');
+ await page.waitForURL((u) => !u.pathname.includes('/login'), { timeout: 60000 });
+ }
+ await sleep(1500);
+
+ for (const base of BASES) {
+ const rec = { base, at: new Date().toISOString() };
+ let hid = null;
+ try {
+ // A harness a person would build: its own skill (with its own script), and one inherited
+ // tool switched off, which is the other half of what the Tools panel offers.
+ const created = await api('/api/harness/v1/harnesses', {
+ method: 'POST', headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ name: `matrix custom ${base}`, base,
+ system_prompt: 'You follow your skills exactly.',
+ skills: [SKILL('matrix-stamp')],
+ disabled_tools: ['WebSearch'],
+ }),
+ });
+ rec.created = created.status;
+ hid = created.json && (created.json.id || created.json.harness_id);
+ if (!hid) { rec.why = `create failed: HTTP ${created.status}`; results[base] = rec; log(`CUSTOM ${base} FAIL ${rec.why}`); continue; }
+
+ // the skill and the disabled tool must be what the server stored, not just what was sent
+ const back = await api(`/api/harness/v1/harnesses/${hid}`);
+ const h = back.json || {};
+ rec.skill_stored = ((h.skills || []).some((s) => (s.name || s.id) === 'matrix-stamp'));
+ rec.tool_disabled_stored = (h.disabledTools || h.disabled_tools || []).includes('WebSearch');
+
+ const t0 = Date.now();
+ const turn = await api('/api/harness/v1/responses', {
+ method: 'POST', headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ input: 'Report this harness build stamp.', stream: false, store: true,
+ metadata: { harness_id: hid } }),
+ });
+ rec.turn_status = turn.status;
+ const sid = turn.json && (turn.json.session_id || (turn.json.metadata || {}).session_id);
+ rec.sid = sid || null;
+ if (!sid) { rec.why = `no session: HTTP ${turn.status}`; results[base] = rec; log(`CUSTOM ${base} FAIL ${rec.why}`); continue; }
+
+ let last = null;
+ for (let i = 0; i < 140; i++) {
+ await sleep(3000);
+ const feed = await api(`/api/harness/v1/sessions/${sid}/turns`);
+ const turns = (feed.json && feed.json.turns) || [];
+ const t = turns[turns.length - 1];
+ if (t && TERMINAL.has(String(t.status)) && (t.assistant || t.error)) { last = t; break; }
+ }
+ // produced files are attached a few seconds AFTER the turn goes terminal
+ for (let i = 0; i < 12 && last && !(last.files || []).length; i++) {
+ await sleep(3000);
+ const feed = await api(`/api/harness/v1/sessions/${sid}/turns`);
+ const turns = (feed.json && feed.json.turns) || [];
+ last = turns[turns.length - 1] || last;
+ }
+ rec.s = Math.round((Date.now() - t0) / 1000);
+ rec.status = last && last.status;
+ const answer = String((last && last.assistant) || '');
+ const files = ((last && last.files) || []).map((f) => f.filename || f.name || '');
+ const tools = ((last && last.tools) || []).map((t) => String(t.name || ''));
+ rec.files = files; rec.tools = tools;
+ // a failed turn has to say why, or the row teaches nothing
+ rec.error = String((last && (last.error || last.incomplete_reason)) || '').slice(0, 300);
+ // the three claims, each read from the stored record
+ rec.skill_reached = answer.includes(token); // the bundle got to the agent
+ rec.script_ran = files.some((f) => f.includes('stamp.txt')); // its script actually executed
+ rec.disabled_tool_unused = !tools.some((t) => /websearch/i.test(t));
+ rec.ok = !!(rec.skill_stored && rec.tool_disabled_stored && rec.skill_reached && rec.script_ran && rec.disabled_tool_unused);
+ rec.why = rec.ok ? '' : [
+ rec.skill_stored ? '' : 'the skill was not stored on the harness',
+ rec.tool_disabled_stored ? '' : 'the disabled tool was not stored',
+ rec.skill_reached ? '' : `the answer does not carry the skill's stamp: ${answer.slice(-160)}`,
+ rec.script_ran ? '' : `the skill's script left no file (files: ${files.join(',') || 'none'})`,
+ rec.disabled_tool_unused ? '' : `a disabled tool was called: ${tools.join(',')}`,
+ rec.error ? `the turn ended: ${rec.error}` : '',
+ ].filter(Boolean).join('; ');
+ log(`CUSTOM ${base} ${rec.ok ? 'ok' : 'FAIL'} ${rec.s}s ${rec.why}`);
+ if (sid) await api(`/api/harness/v1/sessions/${sid}`, { method: 'DELETE' });
+ } catch (e) {
+ rec.error = String(e).slice(0, 300); log(`CUSTOM ${base} ERROR ${rec.error}`);
+ } finally {
+ if (hid) await api(`/api/harness/v1/harnesses/${hid}`, { method: 'DELETE' }).catch(() => {});
+ results[base] = rec;
+ await page.evaluate(([p, r]) => fetch(p, { method: 'POST' }).catch(() => r), ['/noop', null]).catch(() => {});
+ }
+ }
+ const fs = await import('node:fs');
+ fs.writeFileSync(RESULTS, JSON.stringify(results, null, 1));
+ const ok = Object.values(results).filter((r) => r.ok).length;
+ log(`CUSTOM_DONE ${ok} of ${Object.keys(results).length} bases carried their own skill, script and tool policy`);
+} finally { await b.close(); }