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(reconcile): the empty-output settle claims no cause, because it cannot know one
richard-epsillae3498e592dfa
diff --git a/gateway/app.py b/gateway/app.pyindex 72785c90..fb0358b4 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -2334,12 +2334,13 @@ async def _reconcile_response(rid: str, rec: dict) -> dict:if time.time() - _hb_seconds(v) < _RECONCILE_STALE_S:return recsettled = "incomplete"- # The turn was CUT (replica death, container restart), not capped. Without a reason- # the console blamed "step or time limit" for a turn that hit neither — a wrong- # diagnosis shown confidently, live on 2026-08-31 when a deploy restart landed under- # a running turn.- rec.setdefault("incomplete_details", None)- rec["incomplete_details"] = {"reason": "interrupted"}+ # NO reason is claimed here, deliberately. This branch cannot tell a turn that was+ # CUT (finalize died before the output landed) from one that ended cleanly having+ # produced no text at all — the SaaS port shipped "interrupted" on its equivalent+ # branch and caught it within the hour: a max_step=1 turn ended cleanly 'done' in+ # 71s with empty output, nothing cut, and the API confidently called it interrupted.+ # That is the invented-diagnosis bug this field exists to remove, one layer down.+ # Unknown stays absent, and the console renders the neutral badge with no line.else:hb = _hb_seconds(v)if time.time() - hb >= _RECONCILE_STALE_S: # owner stopped heartbeating → orphaneddiff --git a/gateway/tests/test_incomplete_reason.py b/gateway/tests/test_incomplete_reason.pyindex 6f84e9b5..fb7ec9e9 100644--- a/gateway/tests/test_incomplete_reason.py+++ b/gateway/tests/test_incomplete_reason.py@@ -35,3 +35,15 @@ def test_a_completed_turn_never_carries_one():tr.incomplete_reason = "max_steps" # stale attr must not leak onto a clean finishassert _tr()._response_obj("completed")["incomplete_details"] is Noneassert tr._response_obj("completed")["incomplete_details"] is None+++def test_the_empty_output_settle_never_claims_a_cause():+ """The reconciler's empty-output settle cannot tell a cut turn from one that ended cleanly+ with no text: a max_step=1 turn ends 'done' with empty output and nothing interrupted it —+ measured live on the SaaS port, which shipped "interrupted" there and caught it within the+ hour. Unknown must stay absent rather than be guessed."""+ src = open(pathlib.Path(__file__).resolve().parents[1] / "app.py").read()+ i = src.index('settled == "completed" and not (rec.get("output")')+ window = src[i:i + 1200]+ assert '"reason"' not in window.split("else:")[0], (+ "the empty-output settle claims a reason it cannot know")