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.

cheetahclaws: bound every provider call, and the measured column

master5db33104409188
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index bd0ab8a3..1f6e40c6 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -60,7 +60,9 @@ jobs:
# runner itself does not, so it stays out of requirements.txt and lives with pytest here.
# The System One Harness is on the runner's venv in the image (docker/entrypoint.sh pins the tag);
# the driver's tests import it, and skip without it, so the suite installs the same pin.
- - run: pip install -r runner/requirements.txt pytest pytest-asyncio httpx "systemone-harness @ git+https://github.com/HarnessRouter/[email protected]"
+ # CheetahClaws the same way: its driver tests run the pinned package against a stub endpoint
+ # (they skip without it), and it resolves beside the runner's own pins (pip check is clean).
+ - run: pip install -r runner/requirements.txt pytest pytest-asyncio httpx "systemone-harness @ git+https://github.com/HarnessRouter/[email protected]" "cheetahclaws==3.5.88"
- run: python -m pytest runner/tests -q
conformance:
diff --git a/docs/support-matrix-notes.md b/docs/support-matrix-notes.md
index 3dd76a0a..4f7164bc 100644
--- a/docs/support-matrix-notes.md
+++ b/docs/support-matrix-notes.md
@@ -1355,3 +1355,97 @@ wrote `trace.json` with `config_version: 1` and 61 archived frames; a probe with
script ran on `script/s1` and finished. The calibration itself (baseline, one change, validation)
runs on a Calibrator on the claude base with the calibrate package.
+## The cheetahclaws backend: CheetahClaws 3.5.88 (2026-09-24)
+
+CheetahClaws (SAIL-Research-Lab/cheetahclaws, PyPI `cheetahclaws`, Apache-2.0), a Python
+reimplementation of the Claude Code agent loop, as the sixteenth base (#229). The turn process is
+`runner/cheetahclaws_driver.py` inside a pinned venv: the CLI's own agent loop
+(`cheetahclaws.agent.run`, the generator its REPL and its headless bridge runner consume) is
+driven in process and every event is re-emitted as it is yielded, `__hr_init` first and
+`__hr_result` last, normalised by `_cheetahclaws_to_claude`.
+
+### Behaviour measured before the column ran (3.5.88, against a stub and the live instance)
+
+- **No event stream, and the session file is not one.** `cheetahclaws -p` prints the final answer
+ and ANSI tool cards; `session_latest.json` is rewritten by `autosave_session` once per USER turn,
+ after `run_query` returns, never between messages. Tailing it would give a silent turn and then
+ everything at once. In process the loop's own events stream: conformance S-09 passed with "events
+ spread over 5.1s", and the console renders text deltas and tool cards as they happen.
+- **Provider failures are prose and exit 0.** Against a stub, `cheetahclaws -p` printed
+ `[Failed — APIConnectionError: Connection error.. Hint: …]` (unreachable),
+ `[Failed — AuthenticationError: Error code: 401 - {…}. Hint: Check your API key: /config …]`
+ (bad key) and `[Retry 1/3 after 6s — rate_limit: …]` ×3 then `[Failed — RateLimitError: Error
+ code: 429 …]`, exit 0 each time. The driver's verdict is the history's shape instead (the loop
+ appends an assistant message only for a completion that came back); the `[Failed — …]` sentence is
+ kept as the reason, minus a hint that names a slash command. Recorded, and pinned, in
+ `runner/tests/fixtures/cheetahclaws/`. Live: a key the gateway refuses failed the turn with
+ `Failed — BadRequestError: Error code: 400 - {… 'No connected db.' …}` (the gateway's own answer
+ to an unknown key), 27 s.
+- **A dead endpoint hung the turn.** The CLI builds its OpenAI client with the SDK's 600 s timeout
+ and two retries of its own under the loop's three: a turn aimed at an address the instance's
+ firewall drops was still `running` at 600 s with nothing in its record. The driver now gives every
+ client a 300 s read timeout (`HR_CHEETAHCLAWS_TIMEOUT`, aider's budget) and no SDK retries, so the
+ loop's ladder is the only one: the same turn failed at 581 s with `Failed — APIConnectionError:
+ Connection error.`, and an endpoint that accepts and never answers fails in 23 s at a 2 s timeout
+ (`Failed — APITimeoutError: Request timed out.`, pinned by a test).
+- **Resume.** No resume flag: `-p` always starts from an empty state, and continuing is the REPL's
+ `/resume`. The driver loads the session file (the CLI's own `_migrate_session`) when it names the
+ requested id and writes it back with the CLI's own `autosave_session`, the id held fixed per
+ session. `_resume_lost` asks the same file. Recycle through the API: two turns, the sandbox
+ recycled (hydrated from the checkpoint), the session file identical, the recall turn answered
+ `M1-tools-pool`.
+- **Instructions and skills.** The CLI reads `CLAUDE.md` only (walking up from the cwd, plus
+ `~/.claude/CLAUDE.md`); there is no AGENTS.md discovery in the package, so with both present only
+ CLAUDE.md is loaded. It drops the whole file when a line matches its prompt-injection scan; the
+ driver says so in the record. Skills land in the project-level `.cheetahclaws/skills/`, which the
+ loader reads first; `.cheetahclaws/` is CLI state (its `tasks.json` tracker too) and never a
+ produced file, and the tracker is not checkpointed.
+- **Tool policy is hard, measured with a control.** The driver sets the CLI's `disabled_tools`: the
+ tool leaves the schema the provider receives (stub capture) and a call to it is refused at
+ execution. Live, with Bash, Write, Edit, NotebookEdit and Agent withheld, the model still called
+ Bash and Write by name; each came back `Error: tool 'Bash' is not enabled by the 'full' tool
+ profile for this turn.`, no file was written, and the answer said it had no write tool. The same
+ request with nothing withheld wrote the file through Write. AskUserQuestion (it blocks on a
+ terminal nobody is at), ReadEmail/SendEmail (no mailbox is configured) and the tools of optional
+ extras the bare install lacks (WebBrowse, ReadPDF, ReadSpreadsheet, ReadImage) are withheld on
+ every turn and not offered as toggles.
+- **Served model and usage come from the relay's taps.** The session file carries gross prompt
+ tokens with no cache split and no model. The CLI's `custom/` client streams without
+ `stream_options`, so the relay asks for the usage chunk on this route (`stream_usage`, pinned
+ against an upstream that sends usage only when asked); a live turn's Response carried
+ `input_tokens` 9118 / `output_tokens` 31 off the relay, and conformance T-03 read the served
+ model the same way.
+- **MCP** connects in a background thread at import in `-p`, racing the first model call; the
+ driver waits for it, and a server that does not connect becomes `mcp_unavailable`.
+
+### Versions and the column
+
+Measured on a self-hosted instance built from this branch (main at d54ebf8 plus the change,
+default build arguments), one container, `HR_BACKENDS=cheetahclaws`, a fresh volume; CheetahClaws
+3.5.88 installed by the entrypoint (wheel digest verified, import check passed, `pip check` clean).
+One `custom` connection in the OpenAI format to an OpenAI-compatible gateway whose model ids are
+pool aliases, each routed over several upstream models with fallbacks between pools; the three
+aliases it serves are the column's models. The instance has no egress beyond that gateway, so the
+public MCP probe was not reachable.
+
+- **Conformance** (`uhp-conformance` 2026.9.12.post2 from this tree, `--class full`, tools-pool):
+ 75/75, CONFORMANT (full).
+- **Console column** `cheetahclaws-custom`, two passes of the five scenarios on each alias; the table
+ keeps the second and the first try in its notes. tools-pool 5/5 (the first pass missed the recall
+ by answering "Thought process"). fast-pool and coder-pool answer the recall with `M-<alias>` or
+ the previous turn's `DONE`: their histories were intact (same session file before and after the
+ recycle, and the same scenario through the API recalled M1 on tools-pool), so this is the
+ recall of the small models behind those aliases. coder-pool's artifact turn wrote no file in one
+ of two passes. The rows marked "served as" are the gateway's fallback between its own pools,
+ which rule 2 rightly counts as a substitution.
+- **Custom harness** (`custom-harness.mjs`, `MCP_URL=off`, the base's default id mapped to
+ tools-pool on the connection): the stamp skill read, its script run from the workspace,
+ `stamp.txt` produced, WebSearch withheld and unused, 15 s. One earlier run had no settled turn in
+ the script's 420 s window; not reproduced, cause not established.
+- **Plugin matrix** (`plugins/run-matrix.py`, tools-pool): skills 1/1, stdio MCP 1/1
+ (`PLUGIN_MCP_OK`, through the CLI's own MCP client). The SSE and streamable-HTTP columns need the
+ public probe and were not run.
+- **Not measured here:** the hosted provider columns (OpenRouter, TokenRouter, Vercel, the hosted
+ HarnessRouter API), so `_MODEL_CATALOG["cheetahclaws"]` is offered, not measured; and a benchmark
+ column.
+
diff --git a/docs/support-matrix.md b/docs/support-matrix.md
index c4c77837..52461805 100644
--- a/docs/support-matrix.md
+++ b/docs/support-matrix.md
@@ -216,6 +216,21 @@ Not run in this column, 8 pairs the provider serves that the harness did not run
- pi x gpt-6-astra: not run, not run in this column
- qwen x gpt-6-astra: not run, the model answers on the Responses API only and this harness speaks chat/completions only
+## Provider: cheetahclaws-custom
+
+| Harness | Model | First | Follow-up | Switch | Artifact | Recycle | Served by | Notes |
+|---|---|---|---|---|---|---|---|---|
+| cheetahclaws | coder-pool | pass | pass | pass (tools-pool) | FAIL | FAIL | lab-chat | served as fast-pool, local-floor (finding below) ; artifact: no file card (files: none); Create a file named hello-cheetahclaws.txt containing exactly the word HELLO, then reply DONE. CHEETAHCLAWS ; recycle: answered without M1-coder-pool: What exact word did I ask you to reply with in my very first message of this task? Reply with just that word ; retested once; first try: recycle answered without M1-coder-pool: What exact word did I ask you to reply with in m |
+| cheetahclaws | fast-pool | pass | pass | pass (tools-pool) | pass | FAIL | lab-chat | served as local-floor (finding below) ; recycle: answered without M1-fast-pool: What exact word did I ask you to reply with in my very first message of this task? Reply with just that word. ; retested once; first try: artifact no file card (files: none); Create a file named hello-cheetahclaws.txt containin; recycle answered without M1-fast-pool: What exact word did I ask you to reply with in my |
+| cheetahclaws | tools-pool | pass | pass | pass (fast-pool) | pass | pass | lab-chat | retested once; first try: recycle answered without M1-tools-pool: What exact word did I ask you to reply with in m |
+
+3 pairs, 5 of 5 scenario runs passed; 2 pairs served by another connection or as another model are findings, not counted.
+
+Findings, pairs served by a connection other than the one under test or as a model other than the id asked for:
+
+- cheetahclaws x coder-pool: served as fast-pool, local-floor (the CLI reports the model it ran)
+- cheetahclaws x fast-pool: served as local-floor (the CLI reports the model it ran)
+
## Provider: codex-azure-e2
| Harness | Model | First | Follow-up | Switch | Artifact | Recycle | Served by | Notes |
diff --git a/runner/cheetahclaws_driver.py b/runner/cheetahclaws_driver.py
index 923742c2..c3cb04af 100644
--- a/runner/cheetahclaws_driver.py
+++ b/runner/cheetahclaws_driver.py
@@ -74,6 +74,37 @@ OPTIONAL_TOOLS = {"WebBrowse": "playwright", "ReadPDF": "fitz", "ReadSpreadsheet
"ReadImage": "PIL"}
+def bound_provider_calls(read_seconds: float) -> None:
+ """Give every OpenAI client the CLI builds a timeout, and let the loop's own ladder retry.
+
+ WITHOUT THIS A TURN CAN HANG FOR AN HOUR. `custom/` builds `OpenAI(api_key=…, base_url=…)` per
+ call (providers.py, stream_openai_compat) with the SDK's defaults: a 600 s timeout and two
+ retries of its own, and the agent loop retries each failed call three more times on top
+ (agent.py). Measured on the live instance: a turn aimed at an endpoint whose packets are
+ dropped was still running after 600 s with nothing in its record. The read timeout here is the
+ same budget aider's --timeout carries (HR_CHEETAHCLAWS_TIMEOUT, 300 s by default); the SDK's
+ own retries are turned off so the loop's ladder — the one that says `[Retry n/3 …]` and ends
+ on the `[Failed — …]` the record keeps — is the only one, bounding a dead endpoint to four
+ attempts. `from openai import OpenAI` runs inside that function on every call, so replacing
+ the module attribute reaches it."""
+ import httpx
+ import openai
+
+ base = openai.OpenAI
+ if getattr(base, "_hr_bounded", False):
+ return
+
+ class _Bounded(base): # type: ignore[misc, valid-type]
+ _hr_bounded = True
+
+ def __init__(self, *a, **kw):
+ kw.setdefault("timeout", httpx.Timeout(read_seconds, connect=30.0, write=60.0, pool=30.0))
+ kw.setdefault("max_retries", 0)
+ super().__init__(*a, **kw)
+
+ openai.OpenAI = _Bounded
+
+
def unavailable_tools() -> list[str]:
import importlib.util
return sorted(t for t, mod in OPTIONAL_TOOLS.items() if importlib.util.find_spec(mod) is None)
@@ -244,6 +275,7 @@ def main() -> int:
"quiet": True,
})
bootstrap(config)
+ bound_provider_calls(float(os.environ.get("HR_CHEETAHCLAWS_TIMEOUT") or 300))
# MCP: connect every configured server and register its tools BEFORE the tool list is
# taken, instead of racing the background connect the import started.
diff --git a/runner/tests/fixtures/cheetahclaws/turn-timeout.ndjson b/runner/tests/fixtures/cheetahclaws/turn-timeout.ndjson
new file mode 100644
index 00000000..1cc560b5
--- /dev/null
+++ b/runner/tests/fixtures/cheetahclaws/turn-timeout.ndjson
@@ -0,0 +1,6 @@
+{"m": "__hr_init", "p": {"session_id": "c989e08d", "resumed": false, "messages": 0}}
+{"m": "notice", "p": {"text": "[Retry 1/3 after 2s \u2014 timeout: Request timed out.]"}}
+{"m": "notice", "p": {"text": "[Retry 2/3 after 4s \u2014 timeout: Request timed out.]"}}
+{"m": "notice", "p": {"text": "[Retry 3/3 after 8s \u2014 timeout: Request timed out.]"}}
+{"m": "notice", "p": {"text": "[Failed \u2014 APITimeoutError: Request timed out.. Hint: Request timed out. Will retry.]"}}
+{"m": "__hr_result", "p": {"ok": false, "subtype": "error", "final": "", "reason": "Failed \u2014 APITimeoutError: Request timed out.. Hint: Request timed out. Will retry.", "session_id": "c989e08d", "calls": 0, "seconds": 23.01}}
diff --git a/runner/tests/test_cheetahclaws_backend.py b/runner/tests/test_cheetahclaws_backend.py
index 3a3d8b66..21eecedf 100644
--- a/runner/tests/test_cheetahclaws_backend.py
+++ b/runner/tests/test_cheetahclaws_backend.py
@@ -61,6 +61,7 @@ def _result(events: list[dict]) -> dict:
("turn-unreachable.ndjson", "Failed — APIConnectionError: Connection error."),
("turn-401.ndjson", "Failed — AuthenticationError: Error code: 401"),
("turn-429.ndjson", "Failed — RateLimitError: Error code: 429"),
+ ("turn-timeout.ndjson", "Failed — APITimeoutError: Request timed out."),
])
def test_a_provider_failure_fails_the_turn_with_the_clis_own_sentence(fixture, prefix):
events, state = _normalise(_lines(fixture))
@@ -478,3 +479,54 @@ def test_an_mcp_server_that_did_not_connect_becomes_a_note_on_the_reply():
out = _cheetahclaws_to_claude({"m": "mcp_unavailable", "p": {"servers": [{"name": "dead", "reason": "refused"}]}}, {})
assert out == [{"type": "system", "subtype": "mcp_unavailable", "servers": [{"name": "dead", "reason": "refused"}]}]
assert _cheetahclaws_to_claude({"m": "mcp_unavailable", "p": {"servers": []}}, {}) == []
+
+
+# ── a provider that never answers: bounded, not an hour-long silent turn ──
+def test_every_client_the_cli_builds_gets_a_timeout_and_no_retries_of_its_own():
+ openai = pytest.importorskip("openai")
+ before = openai.OpenAI
+ try:
+ drv.bound_provider_calls(7.0)
+ c = openai.OpenAI(api_key="x", base_url="http://127.0.0.1:1/v1")
+ assert c.timeout.read == 7.0 and c.timeout.connect == 30.0 and c.max_retries == 0
+ drv.bound_provider_calls(9.0) # idempotent: not wrapped twice
+ assert openai.OpenAI(api_key="x", base_url="http://127.0.0.1:1/v1").timeout.read == 7.0
+ finally:
+ openai.OpenAI = before
+
+
+class _Hang(http.server.BaseHTTPRequestHandler):
+ def log_message(self, *a):
+ pass
+
+ def do_GET(self):
+ self.send_response(200)
+ self.send_header("content-length", "11")
+ self.end_headers()
+ self.wfile.write(b'{"data":[]}')
+
+ def do_POST(self):
+ import time
+ time.sleep(60)
+
+
+def test_an_endpoint_that_accepts_and_never_answers_fails_the_turn_in_bounded_time():
+ """Measured 2026-09-24 on 3.5.88 with HR_CHEETAHCLAWS_TIMEOUT=2: four attempts and the loop's
+ 2/4/8 s backoff, 23 s, ending on the CLI's own timeout sentence. Without the bound the SDK's
+ 600 s timeout and its own retries sat under the loop's (a live turn still running at 600 s)."""
+ pytest.importorskip("cheetahclaws", reason="the pinned CheetahClaws lives in its own venv, not here")
+ srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), _Hang)
+ threading.Thread(target=srv.serve_forever, daemon=True).start()
+ try:
+ ws = tempfile.mkdtemp()
+ home = pathlib.Path(ws, ".harness", "home")
+ home.mkdir(parents=True)
+ env = {**os.environ, "HOME": str(home), "USERPROFILE": str(home), "HR_CHEETAHCLAWS_TIMEOUT": "2",
+ "CUSTOM_BASE_URL": f"http://127.0.0.1:{srv.server_address[1]}/v1", "CUSTOM_API_KEY": "hr-relay-placeholder"}
+ out = subprocess.run([sys.executable, drv.__file__, json.dumps({"cwd": ws, "model": "custom/m", "prompt": "hi"})],
+ cwd=ws, env=env, capture_output=True, text=True, timeout=90)
+ res = json.loads(out.stdout.splitlines()[-1])["p"]
+ assert res["ok"] is False and res["reason"].startswith("Failed — APITimeoutError: Request timed out.")
+ assert res["seconds"] < 60
+ finally:
+ srv.shutdown()