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
gateway, runner: a 422 says where and why, never what the request carried; the tour and the browser column read the record (#342)
github-actions[bot]9f74c45043f7
diff --git a/gateway/app.py b/gateway/app.pyindex 5167ff3a..7879161c 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -40,6 +40,7 @@ import tempfileimport httpximport redis.asyncio as aioredisfrom fastapi import Depends, FastAPI, File, Form, Header, HTTPException, Request, Response, UploadFile+from fastapi.exceptions import RequestValidationErrorfrom fastapi.responses import FileResponse, JSONResponse, StreamingResponsefrom starlette.background import BackgroundTaskfrom pydantic import AliasChoices, BaseModel, ConfigDict, Field@@ -4015,6 +4016,29 @@ def uhp_error(status: int, code: str, message: str, param: str | None = None,"message": message, "param": param, "detail": detail})+++def validation_error_body(exc) -> dict:+ """A 422's body: where and why the request failed, never what it carried. FastAPI's default+ repeats each failing value under `input`, and for a missing top-level field that value is the+ whole body, so a PUT /v1/admin/integrations that omitted model_map came back with the+ operator's live provider key in the response (a reviewer's finding, 2026-09-29). Anything that+ persists response bodies (an error reporter, a proxy log, devtools) would have kept it."""+ errors = []+ for e in (exc.errors() if hasattr(exc, "errors") else []):+ errors.append({"loc": list(e.get("loc") or []), "msg": str(e.get("msg") or ""), "type": str(e.get("type") or "")})+ first = errors[0] if errors else {}+ param = ".".join(str(x) for x in first.get("loc", []) if x != "body") or None+ message = (f"{param}: {first['msg']}" if param and first.get("msg") else first.get("msg")) or "The request did not validate."+ err = {"type": "invalid_request_error", "code": "invalid_request", "message": message, "param": param, "detail": errors}+ return {"error": err, "detail": errors}++[email protected]_handler(RequestValidationError)+async def _uhp_validation_error(request: Request, exc: RequestValidationError):+ return JSONResponse(validation_error_body(exc), status_code=422, headers={"UHP-Version": UHP_VERSION})++@app.exception_handler(HTTPException)async def _uhp_http_exception(request: Request, exc: HTTPException):d = exc.detaildiff --git a/gateway/tests/test_environments.py b/gateway/tests/test_environments.pyindex 7d059563..23a3333f 100644--- a/gateway/tests/test_environments.py+++ b/gateway/tests/test_environments.py@@ -14,6 +14,7 @@ import zipfileimport pytestfrom fastapi import FastAPIfrom fastapi.testclient import TestClient+from pydantic import BaseModelsys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "runner"))@@ -229,3 +230,41 @@ def test_the_status_says_building_while_a_rebuild_runs_and_ready_wins_over_an_olassert app._env_status(1, {"status": "ready"}) == "ready"assert app._env_status(1, {"status": "failed"}) == "ready"assert app._env_status(None, {"status": "failed"}) == "failed"++++# Module level on purpose: this file has `from __future__ import annotations`, so a model defined+# inside the test would be a string annotation FastAPI cannot resolve, and the route would read it+# as a query parameter.+class _Config422(BaseModel):+ api_key: str+++class _Body422(BaseModel):+ name: str+ config: _Config422+ model_map: dict+++def test_a_request_that_does_not_validate_is_answered_without_its_body():+ """A 422 says where and why, never what the request carried: FastAPI's default echoed the whole+ body under `input` for a missing field, provider key included (a reviewer's finding)."""+ from fastapi.exceptions import RequestValidationError+ from fastapi.responses import JSONResponse++ mini = FastAPI()++ @mini.exception_handler(RequestValidationError)+ async def _h(request, exc):+ return JSONResponse(app.validation_error_body(exc), status_code=422)++ @mini.put("/integrations")+ def _put(body: _Body422):+ return {"ok": True}++ r = TestClient(mini).put("/integrations", json={"name": "Vercel", "config": {"api_key": "vck_live_SECRET_0123456789"}})+ assert r.status_code == 422+ assert "SECRET" not in r.text and "vck_live" not in r.text+ j = r.json()+ assert j["error"]["code"] == "invalid_request" and j["error"]["param"] == "model_map" and "model_map" in j["error"]["message"]+ assert j["detail"][0]["loc"] == ["body", "model_map"] and set(j["detail"][0]) == {"loc", "msg", "type"}diff --git a/runner/server.py b/runner/server.pyindex 58ec178c..4df1f16e 100644--- a/runner/server.py+++ b/runner/server.py@@ -70,12 +70,21 @@ import uuidimport yamlfrom fastapi import BackgroundTasks, FastAPI, HTTPException, Request, Response+from fastapi.exceptions import RequestValidationErrorfrom fastapi.responses import FileResponse, JSONResponsefrom pydantic import BaseModelimport environments # the read-only project layer a turn may name (runner/environments.py)app = FastAPI(title="harness-runner")++[email protected]_handler(RequestValidationError)+async def _validation_error(request: Request, exc: RequestValidationError):+ """Where and why a request failed, never what it carried: FastAPI's default repeats the+ failing value, which for a missing field is the whole body (the gateway has the same handler)."""+ errors = [{"loc": list(e.get("loc") or []), "msg": str(e.get("msg") or ""), "type": str(e.get("type") or "")} for e in exc.errors()]+ return JSONResponse({"detail": errors}, status_code=422)app.include_router(environments.router)WORKSPACE_ROOT = os.environ.get("HARNESS_WORKSPACE", "/workspace")diff --git a/scripts/support-matrix/family-tour.mjs b/scripts/support-matrix/family-tour.mjsindex 33cde7c2..36dbc0c9 100644--- a/scripts/support-matrix/family-tour.mjs+++ b/scripts/support-matrix/family-tour.mjs@@ -61,7 +61,9 @@ await page.goto(`${BASE}/harnesses?h=${encodeURIComponent(HARNESS)}${sid ? '&sidawait page.waitForSelector('textarea.wbx-composer-input', { timeout: 30000 });/** The last turn's server record, once it has settled. */-const RUNNING = ['running', 'starting', 'in_progress', 'queued'];+// `done` is the live record's word for a turn that has just finished and may still be half-written (the+// gateway maps it to completed on the response); a record read at that instant is not settled yet.+const RUNNING = ['running', 'starting', 'in_progress', 'queued', 'done'];async function lastTurn(sidNow) { const r = await api('GET', `/v1/sessions/${sidNow}/turns`); const turns = r.j?.turns || []; return { turns, last: turns[turns.length - 1], rid: r.j?.last_response_id }; }async function settle(sidNow, turnsBefore, timeoutS = TURN_CAP_S) {const t0 = Date.now();@@ -82,7 +84,9 @@ async function settle(sidNow, turnsBefore, timeoutS = TURN_CAP_S) {async function chooseModel(model) {await page.locator('button.ar2-chip[aria-haspopup="listbox"]').first().click();const opt = page.locator('button.wbx-model-opt', { hasText: new RegExp('^' + model.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(\\s|$)') }).first();- await opt.waitFor({ timeout: 10000 });+ // a model the picker does not offer at all (not mapped on this instance) is "not offered", the+ // same as a disabled one; the tour goes on and keeps what it has measured+ try { await opt.waitFor({ timeout: 10000 }); } catch { await page.keyboard.press('Escape'); return false; }const disabled = await opt.isDisabled();if (disabled) { await page.keyboard.press('Escape'); return false; }await opt.click();diff --git a/scripts/support-matrix/plugs/browser.py b/scripts/support-matrix/plugs/browser.pyindex bc2b965e..cad61e35 100644--- a/scripts/support-matrix/plugs/browser.py+++ b/scripts/support-matrix/plugs/browser.py@@ -119,6 +119,8 @@ def run_base(call, base: str, model: str, keep: bool, log) -> dict:breaktime.sleep(5)ok_tools = [r["tool"] for r in rows if r.get("outcome") == "ok"]+ refused = [r for r in rows if r.get("outcome") not in ("ok", None) and r["tool"] != "session"]+ out["refused"] = sorted({f"{r['tool']}: {r.get('error') or r.get('outcome')}" for r in refused})stop = next((r for r in rows if r["tool"] == "session"), None)out["tools"] = sorted(set(t for t in ok_tools if t != "session"))out["missing"] = [t for t in NEEDED if t not in ok_tools]@@ -131,7 +133,13 @@ def run_base(call, base: str, model: str, keep: bool, log) -> dict:if status != "completed":why.append(f"status {status or 'unknown'}" + (f": {str((d.get('error') or {}).get('message') or '')[:120]}" if isinstance(d, dict) and d.get("error") else ""))if out["missing"]:- why.append("no browser " + "/".join(out["missing"]) + " in the trace" + (" (used " + ", ".join(out["tools"]) + ")" if out["tools"] else " (no browser tool at all)"))+ # a call the plane refused is a call that was made: say so, with the plane's own words,+ # instead of "no browser tool at all" (2026-09-29: an instance without BROWSER_USE_API_KEY+ # read as a missing-tools defect)+ if out["refused"]:+ why.append("the browser calls were refused: " + "; ".join(out["refused"])[:200])+ else:+ why.append("no browser " + "/".join(out["missing"]) + " in the trace" + (" (used " + ", ".join(out["tools"]) + ")" if out["tools"] else " (no browser call in the trace at all)"))if not reached:why.append(f"answered without {REACHED}: {text[-160:].strip()!r}")if not out["stopped"]: