Skip to content

The agent that grows with you

review-fix(gateway): pin split_markdown_atoms empty-fence atoms to main

Teknium58dca1be5148
diff --git a/tests/gateway/test_fence_chunker.py b/tests/gateway/test_fence_chunker.py
index 5bd5ba41d16..9c39b01aa9b 100644
--- a/tests/gateway/test_fence_chunker.py
+++ b/tests/gateway/test_fence_chunker.py
@@ -174,3 +174,15 @@ def test_mixed_emoji_newline_text_utf16_limit():
)
assert all(utf16_len(c) <= 500 for c in chunks)
assert all(c for c in chunks)
+
+
+# ── split_markdown_atoms: empty ``` ``` blocks (main parity) ─────────────────
+
+
+def test_empty_fence_block_atoms_match_main():
+ """An empty fenced block (``` immediately followed by ```) is its own
+ atom and the following text starts a fresh one — main's chunk boundaries."""
+ assert split_markdown_atoms("```\n```\ntext") == ["```\n```", "text"]
+ assert split_markdown_atoms("```\n```\ncode\n```\ntail") == ["```\n```", "code", "```\ntail"]
+ assert split_markdown_atoms("```py\n```\n\n```\n```") == ["```py\n```", "```\n```"]
+ assert split_markdown_atoms("a\n```\ncode\n```\nb") == ["a", "```\ncode\n```", "b"]