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
aider: one nudge when a reply announces work and does none; the driver's verdict is the verdict (#220)
github-actions[bot]9cec07c581c6
diff --git a/docs/support-matrix-notes.md b/docs/support-matrix-notes.mdindex e9f511a1..fb4fae2e 100644--- a/docs/support-matrix-notes.md+++ b/docs/support-matrix-notes.md@@ -1030,3 +1030,23 @@ with a paragraph break and its shell blocks render as cards only. Re-run of thethe deck restyled in 53 s, DONE, five tool cards, no markup. The doc also says now that each lineof a bash block runs on its own (a multi-line `python3 -c "…"` ran line by line) and that binaryfiles are worked on with commands.++**After the first real tasks on the hosted service (2026-09-19, folded into open source).** "build a+1 pager ppt about SFO" on aider. A reply that announces work and does none ("I'll create a one-page+PowerPoint deck about SFO and save it in the workspace.", gpt-5.5, zero commands) ends the turn,+because aider reflects only on something to feed back; the driver now says "go ahead" once, only when+the reply reads as an announcement. A turn whose last response was an edit block and nothing else+gets the same note as one that ended on a command. The normaliser used to fail any turn that+recorded an error at any point: gpt-5.4 wrote an edit aider refused (a leading slash, "not in the+subpath"), was told, wrote it again, aider applied it, and the record said "did not conform to the+edit format"; the driver's verdict stands now. gpt-5.5 built the deck with officecli and then put+its closing answer inside a SEARCH/REPLACE block for the .pptx; aider read the binary as text and+died on its own None content; an edit block aimed at a binary is refused at aider's prompt like an+add, with the reflection that says to report instead. The stripper takes the file name inside the+fence, which gpt-5.5 writes. The notes say to name files by workspace-relative path.++What the base is, measured five times on that task: the gpt-5 family builds the deck through+officecli in about two runs of five (gpt-5.5, 29 s and 74 s, six commands) and otherwise writes+an outline .md and stops, treating the file as the deliverable under aider's coding prompt;+nemotron-3-super and claude-sonnet-4.6 built it every time on the hosted service (457 s and 428 s).+Not a harness defect: the prompt is aider's, the choice is the model's, and the record says which.diff --git a/runner/aider_driver.py b/runner/aider_driver.pyindex 5be79c32..eca07f3b 100644--- a/runner/aider_driver.py+++ b/runner/aider_driver.py@@ -46,7 +46,10 @@ _T0 = time.time()# before the fence, the fence (with or without a language), the three markers. The markers'# lengths follow editblock_coder.py (5 to 9 characters). This is aider's wire format for an edit,# and the edit is reported as a card of its own; the prose around the block is the answer.-_EDIT_BLOCK = re.compile(r"(?:^\S+\n)?```[^\n]*\n<{5,9} SEARCH\n.*?^>{5,9} REPLACE\n```\n?",+# The file name sits on the line before the fence or on the first line inside it; aider's+# parser takes both (editblock_coder.find_filename), and gpt-5.5 writes the second+# ("```python\nbuild_sfo_one_pager.py\n<<<<<<< SEARCH", hr-test 2026-09-19).+_EDIT_BLOCK = re.compile(r"(?:^\S+\n)?```[^\n]*\n(?:\S+\n)?<{5,9} SEARCH\n.*?^>{5,9} REPLACE\n```\n?",re.S | re.M)@@ -120,6 +123,10 @@ def _emit(method: str, payload) -> None:sys.stdout.flush()+# aider's two confirmations that name a file the model wants in the chat or wants to edit.+_FILE_PROMPTS = ("Add file to the chat?", "Allow edits to file that has not been added to the chat?")++class _Gate:"""The policy gate on every shell command the model proposes.@@ -229,11 +236,15 @@ def _install(coder, gate: _Gate) -> None:_emit("shell_decision", {"command": command, "tool": name,"approved": approved, "reason": reason})return approved- # A file the model named, which aider offers to add to the chat (base_coder.py:1773).- # Binary files are refused: aider reads a chat file as UTF-8 text, and a .pptx or an- # image fails that read every time it is mentioned. The model works on such files with- # commands, as the doc says.- if question == "Add file to the chat?" and subject:+ # A file the model named, which aider offers to add to the chat (base_coder.py:1773), or+ # wrote an edit block for without it being in the chat (allowed_to_edit). Binary files+ # are refused at both: aider reads a chat file as UTF-8 text, and a .pptx or an image+ # fails that read every time it is mentioned; an edit block aimed at one reads it the+ # same way and then dies on its own None content (`'NoneType' object has no attribute+ # 'splitlines'`, hr-test 2026-09-19: gpt-5.5 had built the deck with officecli and put+ # its closing answer inside a SEARCH/REPLACE block for the .pptx). The model works on+ # such files with commands, as the doc says, and the reflection below tells it so.+ if question in _FILE_PROMPTS and subject:path = str(subject) if os.path.isabs(str(subject)) else os.path.join(coder.root, str(subject))if not is_text_file(path):_emit("warning", {"text": f"{subject} is not a text file and stays out of the chat"})@@ -293,20 +304,45 @@ def _run_shell_commands_reporting(coder, gate: _Gate, reflect: bool = True):coder.run_shell_commands = wrapped-def _run_turn(coder, prompt: str) -> None:+# A reply that announces work instead of doing it: "I'll create…", "Let me…", "Sure, I will…".+# Anchored at the start, after an optional acknowledgement, so an answer that happens to contain+# the words ("The file I'll need is…") is not one.+_ANNOUNCES = re.compile(+ r"^\s*(?:(?:ok(?:ay)?|sure|certainly|got it|understood|alright|right)[,.!:]?\s*)?"+ r"(?:i(?:'ll| will| am going to|'m going to| can go ahead)|let me|first,? i(?:'ll| will)|"+ r"here(?:'s| is) (?:the|my) plan)\b", re.I)+NUDGE = ("Nothing was run or edited. If the task needs files or commands, produce them now in "+ "this reply; otherwise give your final answer.")+++def _announces_without_acting(text: str) -> bool:+ return bool(_ANNOUNCES.match(text or ""))+++def _run_turn(coder, prompt: str, gate: "_Gate | None" = None) -> None:"""aider's own reflection loop (Coder.run_one), driven directly.run_stream is run_one without the loop: it sends ONE message and stops. Reproducing the loophere is what lets a reflection — aider's mechanism for "there is more to do before this turnends", used by its lint and test paths — carry a shell command's output back to the model in the- SAME turn. The bound is aider's own max_reflections, not one invented here."""+ SAME turn. The bound is aider's own max_reflections, not one invented here.++ ONE NUDGE when a pass announced work and did none. aider reflects only on something to feed+ back (a command's output, a lint result); a reply that says "I'll create a one-page deck" and+ proposes neither an edit nor a command ends the turn with nothing done, because at a terminal+ the person would type "go ahead" (gpt-5.5 on the hosted service, 2026-09-19: that sentence+ and zero commands; gpt-5.4 twice ended after one message). The nudge is that "go ahead", once+ per turn, only when the reply reads as an announcement, so a plain answer never pays for a+ second call. Counted against aider's max_reflections like any reflection."""coder.io.user_input(prompt)coder.init_before_message()message = promptreflections = 0reported: set = set()+ nudged = Falsewhile message:coder.reflected_message = None+ calls_before = len(gate.calls) if gate is not None else 0list(coder.send_message(message))# aider_edited_files accumulates over the turn; what this pass added is reported now, so# the cards sit beside the prose that produced them.@@ -314,6 +350,11 @@ def _run_turn(coder, prompt: str) -> None:if edited:reported.update(edited)_emit("edits", {"files": edited})+ acted = bool(edited) or (gate is not None and len(gate.calls) > calls_before)+ if (not coder.reflected_message and not nudged and not acted+ and _announces_without_acting(coder.partial_response_content or "")):+ nudged = True+ coder.reflected_message = NUDGEif not coder.reflected_message:breakif reflections >= coder.max_reflections:@@ -520,7 +561,7 @@ def main() -> int:_emit("init", {"model": coder.main_model.name, "edit_format": coder.edit_format})try:- _run_turn(coder, job["prompt"])+ _run_turn(coder, job["prompt"], gate)except Exception as exc: # noqa: BLE001 — the turn's failure is the product here, not a crash_emit("error", {"text": f"{type(exc).__name__}: {exc}"})_emit("result", {"final": "", "ok": False, "edited": [], "reason": str(exc)[:500]})@@ -536,14 +577,17 @@ def main() -> int:# The result's text is what the gateway stores as the answer, so it is stripped of the# edit markup exactly as the text events were; the edits were reported as cards.final = strip_edit_blocks(coder.partial_response_content or "")- if not final and gate.calls and not failed:- # A response that was commands and nothing else leaves no answer once the blocks are- # cards: the model's last word was a command, and aider gives it no further turn when- # that command printed nothing. Measured on the hosted service (an officecli that was- # not installed ran seven times and the task ended with no text and no file). Said as- # what happened, not as an answer the model gave.+ if not final.strip() and not failed and (gate.calls or coder.aider_edited_files):+ # A response that was commands or edit blocks and nothing else leaves no answer once the+ # blocks are cards: the model's last word was a command or an edit, and aider gives it no+ # further turn when that printed nothing. Measured on the hosted service (an officecli+ # that was not installed ran seven times and the task ended with no text and no file;+ # gpt-5.4 ended after one edit block). Said as what happened, not as an answer the model+ # gave. The same two sentences on the hosted service.final = ("The task ended without a written answer after running commands. The commands "- "and their output are above.")+ "and their output are above." if gate.calls else+ "The task ended without a written answer after editing files. What it did is "+ "shown above.")_emit("result", {"final": final,"ok": not failed,diff --git a/runner/server.py b/runner/server.pyindex 2a437514..634ee55f 100644--- a/runner/server.py+++ b/runner/server.py@@ -4147,6 +4147,9 @@ def _aider_working_notes(cwd: str, servers: dict | None = None) -> str:"- Each line of a bash block runs as its own command. A program that needs more ""than one line goes into a file first (a SEARCH/REPLACE block creates it), then ""one line runs it.",+ "- Name a file in a SEARCH/REPLACE block by its path relative to this workspace "+ "(`deck.md`, `src/app.py`), never by an absolute path: a leading slash is refused "+ "and the workspace's own path repeated under it makes a nested copy.","- Binary files (documents, decks, spreadsheets, images, PDFs) cannot be added to ""the chat or edited with SEARCH/REPLACE; inspect and change them with commands.","- Report only output you were actually given. Never write the result you expect "@@ -5563,8 +5566,13 @@ def _aider_event(obj: dict, state: dict, m, p) -> list[dict]:{"type": "tool_result", "tool_use_id": tuid, "is_error": False, "content": "edited"}]}})return outif m == "result":+ # THE DRIVER'S VERDICT IS THE VERDICT. It holds the Coder and knows whether an error was+ # the last thing that happened or one the turn recovered from; this side only sees that+ # an error event passed. Failing here on any recorded error re-failed the recovered turns+ # (gpt-5.4 wrote an edit aider refused, was told, wrote it again, aider applied it, and+ # the record said "did not conform to the edit format", hr-test 2026-09-19).err = state.get("_aider_error") or ""- ok = bool(p.get("ok")) and not err+ ok = bool(p.get("ok"))final = str(p.get("final") or state.get("final") or "")if ok:state["final"] = finaldiff --git a/runner/tests/test_aider_driver.py b/runner/tests/test_aider_driver.pyindex 7f53da71..8dfbbfa9 100644--- a/runner/tests/test_aider_driver.py+++ b/runner/tests/test_aider_driver.py@@ -103,6 +103,21 @@ def _norm(events):return [e for e in out if e.get("subtype") != "init"], state+def test_an_error_the_turn_recovered_from_does_not_fail_it():+ """gpt-5.4 wrote an edit aider refused ("not in the subpath"), was told, wrote it again and+ aider applied it; the driver said ok and the normaliser said failed on the earlier error.+ The driver's verdict is the verdict; the error text is the reason only when it says not ok."""+ state: dict = {"_aider_init": True}+ _aider_to_claude({"m": "error", "p": {"text": "The LLM did not conform to the edit format."}}, state)+ _aider_to_claude({"m": "edits", "p": {"files": ["deck.md"]}}, state)+ ev = _aider_to_claude({"m": "result", "p": {"ok": True, "final": "The deck outline is in deck.md."}}, state)[0]+ assert ev["is_error"] is False and ev["result"] == "The deck outline is in deck.md."+ state = {"_aider_init": True}+ _aider_to_claude({"m": "error", "p": {"text": "litellm.AuthenticationError: bad key"}}, state)+ ev = _aider_to_claude({"m": "result", "p": {"ok": False, "final": ""}}, state)[0]+ assert ev["is_error"] is True and ev["result"] == "litellm.AuthenticationError: bad key"++def test_a_failure_on_the_error_channel_is_not_rendered_as_the_answer():"""The whole point of the driver. io.tool_error is reachable only by aider itself; the model'sprose cannot reach it. The text becomes the turn's reason and never its result."""@@ -261,6 +276,7 @@ def test_the_doc_tells_the_model_how_this_workspace_works_and_names_the_skills_bassert "## How this workspace works for you" in textassert "- `cat .harness/skills/plugin-probe/SKILL.md`" in textassert "```bash" in text and "Report only output you were actually given" in text+ assert "never by an absolute path" in text# written fresh each turn on top of the doc the turn wrote: no growth across turnsdoc.write_text("# harness contract\n")_build_aider("openai-api", Auth(api_key="sk-t", base_url="https://up.example/v1"),@@ -275,6 +291,10 @@ def test_edit_blocks_are_stripped_from_the_answer_and_the_edits_render_as_cards(text = ("I will create the file.\n\nhello.py\n```python\n<<<<<<< SEARCH\n=======\n""print(\"aider\")\n>>>>>>> REPLACE\n```\n\nDONE-FILE")assert aider_driver.strip_edit_blocks(text) == "I will create the file.\n\n\nDONE-FILE"+ # the file name inside the fence, the shape gpt-5.5 writes and aider's parser also takes+ inside = ("Deck builder:\n```python\nbuild_sfo.py\n<<<<<<< SEARCH\n=======\nfrom pptx import "+ "Presentation\n>>>>>>> REPLACE\n```\nRun it with `python3 build_sfo.py`.")+ assert aider_driver.strip_edit_blocks(inside) == "Deck builder:\nRun it with `python3 build_sfo.py`."shell = "Run this:\n```bash\ncat SKILL.md\n```"assert aider_driver.strip_edit_blocks(shell) == "Run this:" # the command renders as a card# a fence the model closed and kept writing on ("```An improved…") closes the block for aider@@ -300,8 +320,40 @@ def test_a_turn_that_ended_on_a_command_says_so_rather_than_saying_nothing():no file). The sentence states what happened; a turn with an answer, an edit-only turn (nocommands) and a failed turn keep their own text."""src = pathlib.Path(__file__).resolve().parents[1].joinpath("aider_driver.py").read_text()- assert "if not final and gate.calls and not failed:" in src+ assert "if not final.strip() and not failed and (gate.calls or coder.aider_edited_files):" in srcassert "The task ended without a written answer after running commands." in src+ assert "The task ended without a written answer after editing files." in src+++def test_a_reply_that_announces_work_and_does_none_is_nudged_once():+ """gpt-5.5 on "build a 1 pager ppt about SFO" wrote "I'll create a one-page PowerPoint deck+ about SFO and save it in the workspace." with zero commands and the turn ended; at a terminal+ the person types "go ahead". The nudge is that, once, only for a reply that reads as an+ announcement; a plain answer, a reply that acted, and a second announcement get none."""+ a = aider_driver._announces_without_acting+ assert a("I'll create a one-page PowerPoint deck about SFO and save it in the workspace.")+ assert a("Sure, I will build the deck now.") and a("Let me start by reading the skill.")+ assert a("Okay. I'm going to write the outline first.") and a("Here's the plan:\n1. read")+ assert not a("M1-gpt-5.4") and not a("The file I'll need is hello.py, which exists.")+ assert not a("Done. The deck is at SFO.pptx.") and not a("")++ class Coder:+ def __init__(self, replies):+ self.replies = list(replies); self.reflected_message = None+ self.partial_response_content = ""; self.aider_edited_files = set(); self.max_reflections = 5+ self.io = types.SimpleNamespace(user_input=lambda p: None); self.sent = []+ def init_before_message(self): pass+ def send_message(self, m):+ self.sent.append(m); self.partial_response_content = self.replies.pop(0); return iter(())+ gate = aider_driver._Gate([])+ c = Coder(["I'll create the deck and save it in the workspace.", "I'll do it right away."])+ aider_driver._run_turn(c, "build a deck", gate)+ assert c.sent == ["build a deck", aider_driver.NUDGE] # nudged once, not twice+ c = Coder(["M1-gpt-5.4"]); aider_driver._run_turn(c, "Reply with exactly: M1-gpt-5.4", gate)+ assert c.sent == ["Reply with exactly: M1-gpt-5.4"] # an answer is not nudged+ c = Coder(["I'll create it.\n\nsfo.md\n```md\n<<<<<<< SEARCH\n=======\n# SFO\n>>>>>>> REPLACE\n```"])+ c.aider_edited_files = {"sfo.md"}; aider_driver._run_turn(c, "make sfo.md", gate)+ assert c.sent == ["make sfo.md"] # it acted: no nudgedef test_agent_doc_is_written_as_agents_md_even_though_aider_reads_it_via_read():@@ -705,6 +757,12 @@ def test_a_binary_file_the_model_names_is_refused_at_aiders_add_prompt():assert io.confirm_ask("Add file to the chat?", subject="deck.pptx") is Falseassert io.confirm_ask("Add file to the chat?", subject="notes.md") is Trueassert asked == ["notes.md"] # the binary never reached aider's prompt+ # the same for an edit block aimed at a binary the model never added (gpt-5.5 put its+ # closing answer in a SEARCH/REPLACE block for the .pptx it had built; aider read the file+ # as text and crashed on its own None content)+ assert io.confirm_ask("Allow edits to file that has not been added to the chat?", subject="deck.pptx") is False+ assert io.confirm_ask("Allow edits to file that has not been added to the chat?", subject="notes.md") is True+ assert asked == ["notes.md", "notes.md"]# nobody is at aider's prompt to say what to do instead, so the turn is told and goes onassert "`deck.pptx` is a binary file" in coder.reflected_message and "```bash" in coder.reflected_message