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
feat(cline): 22 live-verified models, and follow-ups that actually remember
richard-epsilla8b99b7112005
diff --git a/gateway/app.py b/gateway/app.pyindex fa443109..a6ae5aaf 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -4721,10 +4721,18 @@ _MODEL_CATALOG: dict[str, dict] = {"claude-opus-4.7", "claude-sonnet-4.6", "claude-haiku-4.5","gemini-3.6-flash", "deepseek-v4-pro", "deepseek-v4-flash", "kimi-k3","kimi-k2.7-code", "mistral-medium-3.5", "step-3.7-flash"]},- # cline: deliberately short. A model earns its row here only after a real turn completed- # against the live provider through this backend, substitution-checked — these two were.+ # cline: same relay reach as opencode/qwen (openai-compatible through the loopback relay,+ # shape repair in flight). Every row below completed a real turn through the gateway against+ # the live provider, substitution-checked, in the 2026-08-30 sweep (22/24; the two absentees+ # earned their absence: gpt-5.3-codex is refused by the aggregator on this surface, and+ # gemini-3.6-flash fails on request shape through the relay — retest before adding either)."cline": {"default": "gpt-5.4",- "models": ["gpt-5.4", "gpt-5.4-mini"]},+ "models": ["gpt-5.4", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna",+ "gpt-5.5", "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", "deepseek-v4-pro", "deepseek-v4-flash",+ "kimi-k3", "kimi-k2.7-code", "qwen3.7-max", "qwen3.8-max",+ "mistral-medium-3.5", "step-3.7-flash"]},"pi": {"default": "gpt-5.4","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", "gpt-5.3-codex",@@ -5240,6 +5248,16 @@ async def _resp_execute(translator: _RespTranslator, *, org: str, member: str, s# CLI's default system prompt; persistent project instructions live in the doc the agent reads.agent_doc = str((hv or {}).get("system_prompt") or "")status = "failed"+ # A follow-up on a no-resume backend gets the conversation handed back in its prompt. Read+ # from the durable turn records; a read failure degrades to a fresh turn rather than failing+ # the request — the workspace and AGENTS.md still carry the working context.+ runner_prompt = prompt+ if backend in _NO_RESUME_BACKENDS and resume:+ try:+ _hist = (await _session_turns_data(sid, limit=_HISTORY_MAX_TURNS)).get("turns") or []+ runner_prompt = _history_prompt(_hist, prompt)+ except Exception: # noqa: BLE001+ pass# Model→integration mapping (global token-provider routing): a mapped model runs on its# integration FIRST; the backend's policy chain stays as the failure fallback.mapped_conn = await _mapped_integration_conn(backend, model_req)@@ -5272,7 +5290,7 @@ async def _resp_execute(translator: _RespTranslator, *, org: str, member: str, scontinuebody = {"backend": conn.get("backend", backend), "provider": conn.get("provider"),"model": (conn.get("model") if conn.get("_model_resolved") else _map_model(conn, model_req)),- "prompt": prompt, "max_turns": max_step,+ "prompt": runner_prompt, "max_turns": max_step,"timeout_seconds": timeout_s,"auth": sandbox_auth, "resume_session_id": resume, "files": files_in,"mcp_servers": mcp_servers, "skills": skills, "agent_doc": agent_doc,@@ -7026,6 +7044,44 @@ async def _newest_captures(sid: str) -> dict[str, tuple[str, bool]]:return out+# Backends whose CLI cannot resume a conversation headless. cline 3.0.60: `--json --id` refuses+# a prompt in every form (argument, =form, piped stdin — each verified live, and the identical+# argv without --id runs), so the CLI starts every turn fresh. The GATEWAY owns the conversation+# (the response records), so the gateway hands it back: a follow-up turn's runner prompt carries+# a bounded transcript of the session so far. The user-facing record stays the raw message — the+# transcript rides ONLY the runner prompt, never the trace card or the turn list.+_NO_RESUME_BACKENDS = {"cline"}+_HISTORY_MAX_TURNS = 12+_HISTORY_CLIP = 4000 # per message; a pasted novel is context, not a transcript+_HISTORY_MAX_BYTES = 16000 # whole block; beyond this the oldest turns fall off first+++def _history_prompt(turns: list[dict], new_prompt: str) -> str:+ """The runner prompt for a follow-up on a backend that cannot resume.++ Most recent turns win: the block is built newest-first against the byte budget, then emitted+ oldest-first so the model reads it in order. Empty history returns the prompt unchanged."""+ rows: list[str] = []+ used = 0+ for t in reversed(turns[-_HISTORY_MAX_TURNS:]):+ u = (t.get("user") or "").strip()[:_HISTORY_CLIP]+ a = (t.get("assistant") or "").strip()[:_HISTORY_CLIP]+ piece = (f"user: {u}\n" if u else "") + (f"assistant: {a}\n" if a else "")+ if not piece:+ continue+ if used + len(piece) > _HISTORY_MAX_BYTES:+ break+ rows.append(piece)+ used += len(piece)+ if not rows:+ return new_prompt+ body = "".join(reversed(rows))+ return ("<conversation_so_far>\n"+ "This is the conversation in this session so far. Continue it; do not repeat it.\n"+ f"{body}"+ "</conversation_so_far>\n\n" + new_prompt)++async def _cfile_by_name(sid: str) -> dict[str, str]:"""filename -> newest captured `cfile_…` id. The file routes want only the id."""return {name: cid for name, (cid, _app) in (await _newest_captures(sid)).items()}diff --git a/gateway/tests/test_cline_followup.py b/gateway/tests/test_cline_followup.pynew file mode 100644index 00000000..e5b23b6c--- /dev/null+++ b/gateway/tests/test_cline_followup.py@@ -0,0 +1,40 @@+"""Follow-up continuity for a backend whose CLI cannot resume.++cline 3.0.60's `--json --id` refuses a prompt in every form (verified live, each form+individually), so the gateway hands the conversation back in the runner prompt. These pin the+transcript builder: bounded, newest-turns-win, in-order emission, and a fresh turn untouched.+"""+import pathlib+import sys++sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))+import os+os.environ.setdefault("HR_BACKING", "local")+import app as A # noqa: E402+++def test_a_fresh_turn_is_untouched():+ assert A._history_prompt([], "do it") == "do it"+++def test_history_is_prefixed_in_order_and_the_new_prompt_survives_verbatim():+ turns = [{"user": "Remember the codeword AZURE-PEACH.", "assistant": "OK"},+ {"user": "And the number 7.", "assistant": "Noted."}]+ out = A._history_prompt(turns, "What was the codeword?")+ assert out.endswith("What was the codeword?")+ assert out.index("AZURE-PEACH") < out.index("the number 7"), "history must read in order"+ assert "<conversation_so_far>" in out and "</conversation_so_far>" in out+++def test_newest_turns_win_the_byte_budget():+ turns = [{"user": f"turn {i}", "assistant": "x" * A._HISTORY_CLIP} for i in range(40)]+ out = A._history_prompt(turns, "go")+ assert "turn 39" in out, "the newest turn must always survive"+ assert "turn 0" not in out, "the oldest turns fall off first"+ assert len(out) < A._HISTORY_MAX_BYTES + A._HISTORY_CLIP + 500+++def test_only_cline_is_a_no_resume_backend():+ """Every other CLI resumes natively; adding one here is a decision with a live probe behind+ it, not a convenience."""+ assert A._NO_RESUME_BACKENDS == {"cline"}diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.tsindex 27408d1f..e9aa94ef 100644--- a/ui/src/lib/harness.ts+++ b/ui/src/lib/harness.ts@@ -88,9 +88,9 @@ export const OOB: OobHarness[] = [systemPrompt: 'You are Qwen Code, an autonomous coding agent. You work on a real git workspace with shell and file access, reading and editing files and running commands to complete the task end to end.',tools: [], skills: [] },{ id: 'cline', name: 'Cline', version: 'v3.0.60', backend: 'cline', status: 'ready',- // Placeholder only, like every list above: the gateway's catalog wins once fetched. These two- // are the rows that completed live turns through the gateway before shipping.- models: ['gpt-5.4', 'gpt-5.4-mini'], defaultModel: 'gpt-5.4', moreModels: 0,+ // Placeholder only, like every list above: the gateway's catalog wins once fetched. Every+ // row completed a live substitution-checked turn through the gateway (2026-08-30 sweep).+ models: ['gpt-5.4', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna', 'gpt-5.5', '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', 'deepseek-v4-pro', 'deepseek-v4-flash', 'kimi-k3', 'kimi-k2.7-code', 'qwen3.7-max', 'qwen3.8-max', 'mistral-medium-3.5', 'step-3.7-flash'], defaultModel: 'gpt-5.4', moreModels: 0,systemPrompt: 'You are Cline, an autonomous coding agent. You work on a real git workspace with shell and file access, reading and editing files and running commands to complete the task end to end.',tools: [], skills: [] },];