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.

harness: a field under either spelling, and the runtime defaults shown as what they are (#212)

github-actions[bot]6353b5b0a911
diff --git a/gateway/app.py b/gateway/app.py
index d2373c17..96c2b5fd 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -42,7 +42,7 @@ import redis.asyncio as aioredis
from fastapi import Depends, FastAPI, File, Form, Header, HTTPException, Request, Response, UploadFile
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
from starlette.background import BackgroundTask
-from pydantic import BaseModel
+from pydantic import AliasChoices, BaseModel, ConfigDict, Field
import backing # pluggable graph/blob/secret stores (vg | local)
import media_plane # the media plane (capability catalog, provider adapters, ffmpeg)
@@ -330,6 +330,11 @@ PUBLIC_BASE_URL = os.environ.get("HARNESS_PUBLIC_BASE_URL", "").rstrip("/")
# Default per-turn wall-clock cap when neither the request nor the harness sets one.
# The runner's MAX_TURN_SECONDS (6h) remains the hard ceiling either way.
DEFAULT_TIMEOUT_S = int(os.environ.get("HARNESS_DEFAULT_TIMEOUT_S", "7200"))
+# Default agent-step budget when neither the request nor the harness sets one. Both defaults are
+# served on /v1/bases as `runtimeDefaults`, so the console shows the number that will actually
+# apply instead of a guess of its own: a customer whose task ran away asked what the limit was and
+# the settings page answered with a grey placeholder (2026-09-17).
+DEFAULT_MAX_STEP = int(os.environ.get("HARNESS_DEFAULT_MAX_STEP", "400"))
def _file_url(container_id: str, file_id: str) -> str:
@@ -7448,7 +7453,7 @@ async def create_response(body: CreateResponseBody, request: Request):
except (TypeError, ValueError):
return None
max_step = (_num(body.max_step) or _num(meta.get("max_step"))
- or _num((hv or {}).get("max_step")) or 400)
+ or _num((hv or {}).get("max_step")) or DEFAULT_MAX_STEP)
timeout_s = (_num(body.timeout_seconds) or _num(meta.get("timeout_seconds"))
or _num((hv or {}).get("timeout_seconds")) or DEFAULT_TIMEOUT_S)
# Pin the backend to the harness's base (a custom harness always runs on its own backend);
@@ -13407,19 +13412,31 @@ def _require_supported_base(base: str) -> str:
return b
+def _either(snake: str):
+ """A create/update field by its schema name (snake_case, HarnessCreate) OR the name the
+ harness object comes back with (camelCase, Harness). A client that mirrors what GET returned
+ sent `defaultModel` and the server stored nothing and said nothing: the request answered 200
+ with `"defaultModel": ""`, every task then had to carry a model, and the conformance suite
+ waited out its timeout per task (#199). A field the server understands under one spelling is
+ not an unknown field under the other."""
+ camel = re.sub(r"_([a-z])", lambda m: m.group(1).upper(), snake)
+ return Field(default=None, validation_alias=AliasChoices(snake, camel))
+
+
class HarnessBody(BaseModel):
+ model_config = ConfigDict(populate_by_name=True)
name: str
base: str
- base_label: str | None = None
- default_model: str | None = None
- system_prompt: str | None = None
- mcp_servers: list | None = None
+ base_label: str | None = _either("base_label")
+ default_model: str | None = _either("default_model")
+ system_prompt: str | None = _either("system_prompt")
+ mcp_servers: list | None = _either("mcp_servers")
skills: list | None = None
plugins: list | None = None # installed Agent Plugins packages (Plugins chapter)
- disabled_tools: list | None = None # inherited/built-in tool names the harness disabled
- max_step: int | None = None # default agent step budget for this harness's turns
- timeout_seconds: int | None = None # default per-turn wall-clock cap
- additional_headers: list | None = None # declared header NAMES callers may pass per request
+ disabled_tools: list | None = _either("disabled_tools") # built-in tool names the harness disabled
+ max_step: int | None = _either("max_step") # default agent step budget for this harness's turns
+ timeout_seconds: int | None = _either("timeout_seconds") # default per-turn wall-clock cap
+ additional_headers: list | None = _either("additional_headers") # header NAMES callers may pass per request
def _harness_out(v: dict) -> dict:
@@ -15100,7 +15117,10 @@ async def list_bases(request: Request) -> dict:
for n, b2 in sorted(_builtin_skills().items())],
"builtinSkillsEnumerable": False,
})
- return {"bases": out}
+ # The limits a turn gets when neither the request nor the harness sets one, so the console can
+ # show the number that will apply rather than a placeholder of its own.
+ return {"bases": out,
+ "runtimeDefaults": {"maxStep": DEFAULT_MAX_STEP, "timeoutSeconds": DEFAULT_TIMEOUT_S}}
@app.get("/v1/models")
diff --git a/gateway/tests/test_harness_body_spellings.py b/gateway/tests/test_harness_body_spellings.py
new file mode 100644
index 00000000..91ac510b
--- /dev/null
+++ b/gateway/tests/test_harness_body_spellings.py
@@ -0,0 +1,39 @@
+"""A harness create/update field is understood under both of its spellings, and the bases document
+says what the runtime defaults are.
+
+#199: a client that mirrored the shape GET returns sent `defaultModel`; the server stored nothing
+and answered 200 with `"defaultModel": ""`, so every task had to carry a model and the conformance
+suite waited out its timeout per task. The schema names the create shape in snake_case and the
+object in camelCase; a field the server understands under one is not an unknown field under the
+other."""
+import os
+import sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
+os.environ.setdefault("HR_BACKING", "local")
+import app as gw # noqa: E402
+
+
+def test_the_camel_case_spelling_lands_on_the_same_field():
+ b = gw.HarnessBody.model_validate({"name": "smoke-codex", "base": "codex", "defaultModel": "codex-tools",
+ "maxStep": 50, "timeoutSeconds": 600, "systemPrompt": "be brief",
+ "disabledTools": ["web_search"], "mcpServers": [], "additionalHeaders": ["X-Trace"]})
+ assert b.default_model == "codex-tools" and b.max_step == 50 and b.timeout_seconds == 600
+ assert b.system_prompt == "be brief" and b.disabled_tools == ["web_search"] and b.additional_headers == ["X-Trace"]
+
+
+def test_the_schema_spelling_still_lands_and_the_object_shape_carries_it_back():
+ b = gw.HarnessBody.model_validate({"name": "x", "base": "codex", "default_model": "codex-tools", "max_step": 7})
+ assert b.default_model == "codex-tools" and b.max_step == 7
+ assert gw._harness_props(b)["default_model"] == "codex-tools"
+
+
+def test_the_defaults_are_one_number_each_and_the_console_is_told():
+ """The turn's fallback and the number the console shows must be the same value from the same
+ place, or a person is shown a limit that is not the one that applies."""
+ assert gw.DEFAULT_MAX_STEP > 0 and gw.DEFAULT_TIMEOUT_S > 0
+ src = open(os.path.join(os.path.dirname(__file__), "..", "app.py")).read()
+ assert "or DEFAULT_MAX_STEP)" in src and " or 400)" not in src
+ i = src.index("async def list_bases(")
+ body = src[i:src.index("\n\n\n", i)]
+ assert '"runtimeDefaults": {"maxStep": DEFAULT_MAX_STEP, "timeoutSeconds": DEFAULT_TIMEOUT_S}' in body
diff --git a/protocol/conformance/README.md b/protocol/conformance/README.md
index bd71bb83..76c34950 100644
--- a/protocol/conformance/README.md
+++ b/protocol/conformance/README.md
@@ -22,7 +22,7 @@ uhp-conformance \
| `--api-key` | Bearer token, or set `UHP_API_KEY`. |
| `--class` | `core`, `extended` or `full`. Cumulative — `full` runs everything. |
| `--harness-id` | Run tasks against a specific harness instead of the first one listed. |
-| `--model` | Run tasks with a specific model. |
+| `--model` | Run tasks with a specific model. Required when the harness named by `--harness-id` has no default model: the suite says so and stops before the first task rather than waiting out the task timeout on each. |
| `--task-timeout` | Seconds to allow one agent task. Default 300. |
| `--only` | Comma-separated check ids, for iterating on one failure. |
| `--json` | Write a machine-readable report. |
diff --git a/protocol/conformance/uhp_conformance/cli.py b/protocol/conformance/uhp_conformance/cli.py
index 0dfe0a16..9e94aafe 100644
--- a/protocol/conformance/uhp_conformance/cli.py
+++ b/protocol/conformance/uhp_conformance/cli.py
@@ -49,6 +49,17 @@ def main(argv=None) -> int:
ctx = Context(client=Client(a.base_url, a.api_key, headers=extra), harness_id=a.harness_id,
model=a.model, task_timeout=a.task_timeout)
+ # A harness with no default model and no --model runs every task with whatever the server
+ # falls back to, which on a self-hosted instance may be an id its provider does not serve: each
+ # task then waits out --task-timeout and a full run takes half an hour to say nothing (#199).
+ # Say it before the first task instead.
+ if a.harness_id and not a.model:
+ r = ctx.client.get(f"/v1/harnesses/{a.harness_id}")
+ if r.status == 200 and not str((r.json or {}).get("defaultModel") or "").strip():
+ print(f"harness {a.harness_id} has no default model; pass --model <id> so the tasks "
+ "run on a model this server serves", file=sys.stderr)
+ return 2
+
selected = checks_for(a.cls)
if a.only:
want = {s.strip().upper() for s in a.only.split(",") if s.strip()}
diff --git a/ui/src/components/HarnessSettings.tsx b/ui/src/components/HarnessSettings.tsx
index d8ba24ee..f0cc90c3 100644
--- a/ui/src/components/HarnessSettings.tsx
+++ b/ui/src/components/HarnessSettings.tsx
@@ -10,6 +10,7 @@ import { useRouter } from 'next/navigation';
import {
OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, modelAvailability, availabilityNote, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret, pluginSchemas,
type CustomHarness, type OobHarness, type HarnessPlugin, getPluginFiles,
+ useRuntimeDefaults,
} from '@/lib/harness';
import { HarnessLogo } from '@/components/HarnessLogo';
import { CopyId } from '@/components/CopyId';
@@ -142,6 +143,9 @@ export function HarnessSettings({ id, embedded = false, onNavigate }: {
// 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();
+ // The limits that apply when a field is left empty, from the server: shown as the field's value
+ // so a person sees the number that will actually stop a runaway task, not a grey example.
+ const limits = useRuntimeDefaults();
const srvBase = bases?.[base?.id || draft?.base || ''] || null;
const baseTools = srvBase?.tools || [];
const models = oobModels(base);
@@ -456,14 +460,15 @@ export function HarnessSettings({ id, embedded = false, onNavigate }: {
<div className="field-stack">
<div className="two-column-fields">
<div className="field"><label htmlFor="hsSteps">Max steps</label>
- <input id="hsSteps" type="number" min={1} placeholder="400" disabled={readOnly}
- value={draft?.maxStep ?? ''} onChange={(e) => upd({ maxStep: e.target.value ? Math.max(1, Number(e.target.value)) : null })} />
- <span className="field-help">Maximum agent steps before the Task stops.</span></div>
+ <input id="hsSteps" type="number" min={1} disabled={readOnly}
+ value={draft?.maxStep ?? limits?.maxStep ?? ''}
+ onChange={(e) => upd({ maxStep: e.target.value ? Math.max(1, Number(e.target.value)) : null })} />
+ <span className="field-help">Maximum agent steps before the Task stops.{limits ? ` Empty means the default, ${limits.maxStep}.` : ''}</span></div>
<div className="field"><label htmlFor="hsTimeout">Timeout (minutes)</label>
- <input id="hsTimeout" type="number" min={1} placeholder="120" disabled={readOnly}
- value={draft?.timeoutSeconds ? Math.round(draft.timeoutSeconds / 60) : ''}
+ <input id="hsTimeout" type="number" min={1} disabled={readOnly}
+ value={draft?.timeoutSeconds ? Math.round(draft.timeoutSeconds / 60) : (limits ? Math.round(limits.timeoutSeconds / 60) : '')}
onChange={(e) => upd({ timeoutSeconds: e.target.value ? Math.max(1, Number(e.target.value)) * 60 : null })} />
- <span className="field-help">Maximum wall-clock execution time.</span></div>
+ <span className="field-help">Maximum wall-clock execution time.{limits ? ` Empty means the default, ${Math.round(limits.timeoutSeconds / 60)} minutes.` : ''}</span></div>
</div>
</div>
</section>
diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.ts
index 06fff959..148d2c6e 100644
--- a/ui/src/lib/harness.ts
+++ b/ui/src/lib/harness.ts
@@ -250,6 +250,10 @@ export interface BaseInfo {
let _bases: Record<string, BaseInfo> | null = null;
let _basesInflight: Promise<Record<string, BaseInfo>> | null = null;
+/** The limits a turn gets when neither the request nor the harness sets one, from the server's
+ * bases document. null until it lands: the settings page shows nothing rather than a guess. */
+export interface RuntimeDefaults { maxStep: number; timeoutSeconds: number }
+let _runtimeDefaults: RuntimeDefaults | null = null;
async function fetchBases(): Promise<Record<string, BaseInfo>> {
if (_bases) return _bases;
@@ -261,6 +265,10 @@ async function fetchBases(): Promise<Record<string, BaseInfo>> {
const doc = await r.json();
const map: Record<string, BaseInfo> = {};
for (const b of doc.bases || []) map[b.id] = b as BaseInfo;
+ const rd = doc.runtimeDefaults;
+ if (rd && Number(rd.maxStep) > 0 && Number(rd.timeoutSeconds) > 0) {
+ _runtimeDefaults = { maxStep: Number(rd.maxStep), timeoutSeconds: Number(rd.timeoutSeconds) };
+ }
_bases = map;
return map;
} catch { return {}; }
@@ -269,6 +277,17 @@ async function fetchBases(): Promise<Record<string, BaseInfo>> {
return _basesInflight;
}
+/** The server's runtime defaults, once the bases document has landed. */
+export function useRuntimeDefaults(): RuntimeDefaults | null {
+ const [d, setD] = useState<RuntimeDefaults | null>(_runtimeDefaults);
+ useEffect(() => {
+ let alive = true;
+ fetchBases().then(() => { if (alive && _runtimeDefaults) setD(_runtimeDefaults); });
+ return () => { alive = false; };
+ }, []);
+ return d;
+}
+
/** 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);