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.

2.0 KB
Raw Blame
"""A model served on the Responses API alone is not offered on a harness that speaks chat/completions only."""
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

# Measured against OpenAI directly: called with function tools these answer on /v1/responses and are
# refused on /v1/chat/completions. gpt-6-astra joined them on 2026-09-07 with the same sentence,
# "Function tools with reasoning_effort are not supported for gpt-6-astra in /v1/chat/completions".
# The facts live in the gateway (the renderer lists the pairs they exclude as "not run"); this test
# keeps them honest.
RESPONSES_ONLY = set(gw.RESPONSES_ONLY_MODELS)
CHAT_ONLY_BACKENDS = gw.CHAT_ONLY_BACKENDS
RESPONSES_BACKENDS = ("codex", "hermes", "pi", "dsh", "opencode", "kilo", "omp")


def test_responses_only_models_stay_off_chat_only_harnesses():
    for backend in CHAT_ONLY_BACKENDS:
        listed = set(gw._MODEL_CATALOG[backend]["models"])
        assert not (listed & RESPONSES_ONLY), f"{backend} lists {listed & RESPONSES_ONLY}"


def test_the_harnesses_that_speak_responses_keep_it():
    for backend in RESPONSES_BACKENDS:
        for model in RESPONSES_ONLY:
            assert model in gw._MODEL_CATALOG[backend]["models"], f"{backend} is missing {model}"


def test_gpt_6_astra_is_served_by_every_provider_we_route_to():
    """Each id read from that provider's own model list on the day it was added (2026-09-07):
    OpenAI and our Azure resource serve it bare, the aggregators under OpenAI's vendor prefix."""
    assert gw._vendor_models("openai")["gpt-6-astra"] == "gpt-6-astra"
    assert gw._vendor_models("azure-foundry")["gpt-6-astra"] == "gpt-6-astra"
    for provider in ("openrouter", "tokenrouter", "vercel", "llmtr"):
        assert gw._vendor_models(provider)["gpt-6-astra"] == "openai/gpt-6-astra", provider
    assert "gpt-6-astra" not in gw._TOKENROUTER_NO_CHANNEL