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(tests): async tests were counted as failures, and the resume test asserted the bug
richard-epsilla6336b953b964
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 1bb34146..7c70d233 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -33,7 +33,7 @@ jobs:run: sudo apt-get update -qq && sudo apt-get install -y -qq ffmpeg# jsonschema is test-only: test_response_error_envelope.py validates failed Responses# against the spec schema. It stays out of requirements.txt so it never ships in the image.- - run: pip install -r gateway/requirements.txt pytest jsonschema+ - run: pip install -r gateway/requirements.txt pytest pytest-asyncio jsonschema- run: python -m pytest gateway/tests -qrunner:@@ -47,7 +47,7 @@ jobs:cache-dependency-path: runner/requirements.txt# httpx: the runner suite drives the app through FastAPI's TestClient, which needs it. The# runner itself does not, so it stays out of requirements.txt and lives with pytest here.- - run: pip install -r runner/requirements.txt pytest httpx+ - run: pip install -r runner/requirements.txt pytest pytest-asyncio httpx- run: python -m pytest runner/tests -qconformance:diff --git a/gateway/pytest.ini b/gateway/pytest.ininew file mode 100644index 00000000..97ea14e8--- /dev/null+++ b/gateway/pytest.ini@@ -0,0 +1,8 @@+# Async tests run natively.+#+# Without pytest-asyncio every `async def` test is reported "async def functions are not natively+# supported" and counted as a failure, so a whole file of coverage can sit inert while CI stays+# red for a reason that looks unrelated to the change that added it.+[pytest]+asyncio_mode = auto+asyncio_default_fixture_loop_scope = functiondiff --git a/runner/pytest.ini b/runner/pytest.ininew file mode 100644index 00000000..37310dee--- /dev/null+++ b/runner/pytest.ini@@ -0,0 +1,4 @@+# Async tests run natively — see gateway/pytest.ini for why this is not optional.+[pytest]+asyncio_mode = auto+asyncio_default_fixture_loop_scope = functiondiff --git a/runner/tests/test_opencode_normalize.py b/runner/tests/test_opencode_normalize.pyindex bf210ee1..e606a2ce 100644--- a/runner/tests/test_opencode_normalize.py+++ b/runner/tests/test_opencode_normalize.py@@ -197,11 +197,43 @@ def test_argv_requests_thinking_or_reasoning_never_arrives():assert "--thinking" in cmd-def test_resume_passes_the_session_id():- cmd, _, _ = _argv(resume_session_id="ses_abc")+def test_resume_passes_the_session_id_when_that_session_is_here():+ """The conversation is in this workspace's database, so resume it."""+ d = tempfile.mkdtemp()+ env: dict = {"HOME": d}+ db = pathlib.Path(d) / ".local" / "share" / "opencode"+ db.mkdir(parents=True, exist_ok=True)+ (db / "opencode.db").write_bytes(b"sqlite-ish bytes ses_abc more bytes")+ auth = Auth(api_key="sk-test", base_url="https://relay.example/v1")+ cmd = _build_opencode("openai-api", auth, "gpt-5.4", "do it", d, env, resume_session_id="ses_abc")assert "--session" in cmd and "ses_abc" in cmd+def test_resume_is_dropped_when_the_session_is_not_in_this_workspace():+ """opencode exits 1 with no output when told to resume a session its database does not hold,+ and every later turn passes the same dead id, so the conversation stays broken rather than+ failing once. Start a fresh CLI thread in the same workspace instead."""+ d = tempfile.mkdtemp()+ env: dict = {"HOME": d} # no database at all: a recycled sandbox+ auth = Auth(api_key="sk-test", base_url="https://relay.example/v1")+ cmd = _build_opencode("openai-api", auth, "gpt-5.4", "do it", d, env, resume_session_id="ses_gone")+ assert "--session" not in cmd and "ses_gone" not in cmd+ assert cmd[-1] == "do it" # the turn still runs+++def test_resume_finds_a_session_still_sitting_in_the_write_ahead_log():+ """The previous turn's write may not have been checkpointed into the main database yet."""+ d = tempfile.mkdtemp()+ env: dict = {"HOME": d}+ db = pathlib.Path(d) / ".local" / "share" / "opencode"+ db.mkdir(parents=True, exist_ok=True)+ (db / "opencode.db").write_bytes(b"header only")+ (db / "opencode.db-wal").write_bytes(b"wal frame ses_wal payload")+ auth = Auth(api_key="sk-test", base_url="https://relay.example/v1")+ cmd = _build_opencode("openai-api", auth, "gpt-5.4", "do it", d, env, resume_session_id="ses_wal")+ assert "--session" in cmd and "ses_wal" in cmd++def test_key_goes_to_the_environment_and_never_into_the_config_file():cmd, d, env = _argv()assert env["HR_OPENCODE_KEY"] == "sk-test"