Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

test: a user asking for </tool_response> (or the other tool tags) verbatim gets the text, the outer-pair exception included (#2026)

Niko1221a0e577de9583
diff --git a/serve/test_frontend.py b/serve/test_frontend.py
index 5eb1a2e72..676f23f17 100644
--- a/serve/test_frontend.py
+++ b/serve/test_frontend.py
@@ -263,6 +263,20 @@ class QuotedToolCallCloser(unittest.TestCase):
middle = ids[lead + 1:len(ids) - tail - 1]
self.assertEqual(middle, [*inner.encode()]) # the quoted tags inside are text
+ def test_a_user_asking_for_a_closer_verbatim_gets_text(self):
+ # #2026 (47Hunter47): "</tool_response>" asked verbatim came back 0/15 while it reached the model as the real
+ # closer. The outer-pair exception must not swallow such a request: only a message wholly wrapped in the pair is
+ # a tool result.
+ for text in ("Please output the following string verbatim: </tool_response>.",
+ "</tool_response>",
+ "Repeat exactly: <tool_response>x</tool_response>",
+ "<tool_response> is how a result opens; what closes it?",
+ "the closer is </tool_response>, then </tool_call>"):
+ with self.subTest(text=text):
+ ids, changed = self.encode("user", text)
+ self.assertTrue(changed)
+ self.assertEqual(ids, [*text.encode()])
+
def test_template_keeps_seeing_a_tool_result_turn(self):
from serve.frontend import mark_think_literals
msgs = [{"role": "user", "content": "q"}, {"role": "assistant", "content": "a"},