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: the edit and shell strippers take fences of any length (#221)
github-actions[bot]61d1441f946c
diff --git a/runner/aider_driver.py b/runner/aider_driver.pyindex eca07f3b..46131afc 100644--- a/runner/aider_driver.py+++ b/runner/aider_driver.py@@ -49,7 +49,10 @@ _T0 = time.time()# 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?",+# Fences are three OR MORE backticks: aider's own parser takes any length (a block whose content+# holds ``` is fenced with ````), and gpt-5.4 closes with four. A stripper that took exactly three+# left the fourth behind as the whole answer (an answer card reading "`", hosted 2026-09-19).+_EDIT_BLOCK = re.compile(r"(?:^\S+\n)?`{3,}[^\n]*\n(?:\S+\n)?<{5,9} SEARCH\n.*?^>{5,9} REPLACE\n`{3,}[ \t]*\n?",re.S | re.M)@@ -75,12 +78,13 @@ def _strip_shell_blocks(text: str) -> str:out, lines, i = [], (text or "").splitlines(), 0while i < len(lines):line = lines[i]- if line.strip() in _SHELL_FENCES or any(line.strip().startswith(f + " ") for f in _SHELL_FENCES):+ opener = "```" + line.strip().lstrip("`") # a fence of any length, read as three+ if opener.strip() in _SHELL_FENCES or any(opener.startswith(f + " ") for f in _SHELL_FENCES):i += 1while i < len(lines) and not lines[i].strip().startswith("```"):i += 1if i < len(lines):- rest = lines[i].strip()[3:].strip()+ rest = lines[i].strip().lstrip("`").strip()if rest:out.append(rest)i += 1diff --git a/runner/tests/test_aider_driver.py b/runner/tests/test_aider_driver.pyindex 8dfbbfa9..e8628be9 100644--- a/runner/tests/test_aider_driver.py+++ b/runner/tests/test_aider_driver.py@@ -295,6 +295,12 @@ def test_edit_blocks_are_stripped_from_the_answer_and_the_edits_render_as_cards(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`."+ # fences of four backticks, which aider's parser takes and gpt-5.4 writes: nothing is left+ # behind (a stripper that took exactly three left "`" as the whole answer, hosted 2026-09-19)+ four = ("````python\nbuild.py\n<<<<<<< SEARCH\n=======\nx = 1\n>>>>>>> REPLACE\n````\n"+ "````bash\npython3 build.py\n````\n")+ assert aider_driver.strip_edit_blocks(four) == ""+ assert aider_driver.strip_edit_blocks("````bash\nls\n````\nDone.") == "Done."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