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
files: an archive that cannot be whole answers file_not_found, the protocol's code for it (#568)
github-actions[bot]dcf6219d2e56
diff --git a/gateway/app.py b/gateway/app.pyindex 45629784..e60661a9 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -11785,8 +11785,9 @@ async def session_files_archive(sid: str, request: Request, changed: bool = Falsdata, _media, fname = got_add_bytes(fname, data)if missing:- raise HTTPException(404, f"{len(missing)} of {len(want_ids)} files are no longer available: "- + ", ".join(missing[:5]) + (", …" if len(missing) > 5 else ""))+ raise uhp_error(404, "file_not_found",+ f"{len(missing)} of {len(want_ids)} files are no longer available: "+ + ", ".join(missing[:5]) + (", …" if len(missing) > 5 else ""))elif changed:blob = await _blob_get(f"sessions/{sid}/changed.json", kb=RESP_BLOB_KB)try:@@ -11809,8 +11810,8 @@ async def session_files_archive(sid: str, request: Request, changed: bool = Falscontinue_add_bytes(path, got[0])if gone:- raise HTTPException(404, f"{len(gone)} of {asked} files are no longer available: "- + ", ".join(gone[:5]) + (", …" if len(gone) > 5 else ""))+ raise uhp_error(404, "file_not_found", f"{len(gone)} of {asked} files are no longer available: "+ + ", ".join(gone[:5]) + (", …" if len(gone) > 5 else ""))else:tf = await _workspace_tar(sid)if tf is None:@@ -11851,7 +11852,8 @@ async def session_files_archive(sid: str, request: Request, changed: bool = Falsnput += _ntotal += _totif not nput:- raise HTTPException(404, "no files to archive")+ # the protocol's own code for a file that is not there (errors.md §3.1), not the generic one+ raise uhp_error(404, "file_not_found", "There are no files to put in an archive.")except BaseException:try:os.unlink(zpath)diff --git a/gateway/tests/test_files_archive.py b/gateway/tests/test_files_archive.pyindex caf1075d..7cff97b1 100644--- a/gateway/tests/test_files_archive.py+++ b/gateway/tests/test_files_archive.py@@ -42,6 +42,7 @@ def test_a_missing_cited_file_refuses_the_archive_by_name(monkeypatch, tmp_path)r = TestClient(gw.app).get(f"/v1/sessions/s1/files/archive?files={ids}")assert r.status_code == 404assert "1 of 2 files" in r.text and "output/gone.json" in r.text+ assert r.json()["error"]["code"] == "file_not_found" # the protocol's code (errors.md §3.1)def test_the_single_download_names_the_file_without_its_folder(monkeypatch):@@ -70,6 +71,14 @@ def test_an_unreadable_changed_file_refuses_the_archive_by_name(monkeypatch, tmpr = TestClient(gw.app).get("/v1/sessions/s1/files/archive?changed=true")assert r.status_code == 404assert "1 of 2 files" in r.text and "output/gone.json" in r.text+ assert r.json()["error"]["code"] == "file_not_found"+++def test_an_archive_with_nothing_in_it_is_a_file_not_found(monkeypatch, tmp_path):+ _wire_changed(monkeypatch, tmp_path, {})+ r = TestClient(gw.app).get("/v1/sessions/s1/files/archive?changed=true")+ assert r.status_code == 404+ assert r.json()["error"]["code"] == "file_not_found"def test_a_readable_changed_set_still_archives_every_file(monkeypatch, tmp_path):