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.

In owner trust the sandbox gets the provider base the broker would forward to (#91)

github-actions[bot]eaae3669a9a6
diff --git a/gateway/app.py b/gateway/app.py
index 38628291..d5c13be8 100644
--- a/gateway/app.py
+++ b/gateway/app.py
@@ -902,6 +902,12 @@ def _auth_from_conn(conn: dict, sid: str = "") -> dict | None:
out = {k: conn[k] for k in _AUTH_FIELDS if conn.get(k) is not None}
for secret in _SECRET_AUTH_FIELDS:
out.pop(secret, None)
+ # The same base the broker would forward to: an Azure endpoint pasted bare from the portal
+ # gains its /openai/v1 here as well, because in owner trust the sandbox talks to the provider
+ # with this base directly and a bare one 404s on every tool call ("Resource not found", the
+ # matrix's second Azure column, 2026-09-06: text turns answered, tool turns did not).
+ if out.get("base_url"):
+ out["base_url"] = _provider_base_url(str(conn.get("provider") or ""), str(out["base_url"]))
# Self-hosted bring-your-own-key. Brokering exists because a MULTI-TENANT sandbox runs
# someone else's agent against OUR key, so the key must never enter it. Self-hosted inverts
diff --git a/gateway/tests/test_owner_azure_base.py b/gateway/tests/test_owner_azure_base.py
new file mode 100644
index 00000000..671b04e4
--- /dev/null
+++ b/gateway/tests/test_owner_azure_base.py
@@ -0,0 +1,22 @@
+"""In owner trust the sandbox gets the provider base the broker would forward to: a bare Azure endpoint gains /openai/v1."""
+import os
+import pathlib
+import sys
+
+sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
+os.environ.setdefault("HR_BACKING", "local")
+import app as gw # noqa: E402
+
+
+def test_a_bare_azure_endpoint_gains_its_path_in_owner_trust(monkeypatch):
+ monkeypatch.setattr(gw, "SANDBOX_TRUST", "owner")
+ out = gw._auth_from_conn({"provider": "azure-foundry", "api_key": "k", "base_url": "https://res.openai.azure.com/"}, "sid1")
+ assert out["base_url"] == "https://res.openai.azure.com/openai/v1" and out["api_key"] == "k"
+
+
+def test_a_full_azure_base_and_other_providers_are_left_alone(monkeypatch):
+ monkeypatch.setattr(gw, "SANDBOX_TRUST", "owner")
+ az = gw._auth_from_conn({"provider": "azure-foundry", "api_key": "k", "base_url": "https://res.cognitiveservices.azure.com/openai/v1"}, "sid1")
+ assert az["base_url"] == "https://res.cognitiveservices.azure.com/openai/v1"
+ tr = gw._auth_from_conn({"provider": "tokenrouter", "api_key": "k", "base_url": "https://api.tokenrouter.com/v1"}, "sid1")
+ assert tr["base_url"] == "https://api.tokenrouter.com/v1"