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
fix(gateway): the broker takes an Azure endpoint as the portal gives it (#80)
github-actions[bot]cb77edc3d430
diff --git a/gateway/app.py b/gateway/app.pyindex 7257c3b9..d9a48546 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -2996,6 +2996,17 @@ async def _broker_resolve(conn_name: str, org: str | None) -> dict | None:return _with_provider_base(conn)+def _provider_base_url(provider: str, base_url: str) -> str:+ """The URL the broker forwards to. An Azure OpenAI endpoint is pasted from the portal as the+ bare resource (https://<resource>.openai.azure.com/); its OpenAI-compatible surface lives+ under /openai/v1, and a bare base forwarded as-is 404s on every call ("Resource not found",+ the matrix's Azure column, 2026-09-06). Any other provider's base is used as given."""+ base = (base_url or "").strip().rstrip("/")+ if base and provider.lower() in ("azure", "azure-foundry") and "/openai/" not in base:+ base += "/openai/v1"+ return base++@app.api_route("/v1/llm/{path:path}", methods=["GET", "POST", "PUT", "PATCH", "DELETE"])async def llm_broker(path: str, request: Request):claims = _verify_turn_cred(_broker_token(request))@@ -3007,7 +3018,7 @@ async def llm_broker(path: str, request: Request):if not conn:raise HTTPException(502, "connection unavailable")- base = str(conn.get("base_url") or "").rstrip("/")+ base = _provider_base_url(str(conn.get("provider") or ""), str(conn.get("base_url") or ""))if not base:raise HTTPException(502, "connection has no base_url")# CLIs append their own version segment (…/v1/messages, …/v1/responses) while providerdiff --git a/gateway/tests/test_broker_provider_base.py b/gateway/tests/test_broker_provider_base.pyindex 39ed9351..7b457a6f 100644--- a/gateway/tests/test_broker_provider_base.py+++ b/gateway/tests/test_broker_provider_base.py@@ -44,3 +44,11 @@ def test_a_vault_connection_gets_the_default_too(monkeypatch):monkeypatch.setattr(gw, "_get_connection", get)conn = asyncio.run(gw._broker_resolve("openai", "org.a"))assert conn["base_url"] == "https://api.openai.com/v1"+++def test_azure_bare_endpoint_gets_its_openai_surface():+ assert gw._provider_base_url("azure-foundry", "https://r.openai.azure.com/") == "https://r.openai.azure.com/openai/v1"+ assert gw._provider_base_url("azure", "https://r.openai.azure.com") == "https://r.openai.azure.com/openai/v1"+ assert gw._provider_base_url("azure-foundry", "https://r.openai.azure.com/openai/v1/") == "https://r.openai.azure.com/openai/v1"+ assert gw._provider_base_url("openai", "https://api.openai.com/v1/") == "https://api.openai.com/v1"+ assert gw._provider_base_url("openrouter", "") == ""