From 157630285b89a7995cc4ea1961a8505a9951fe5d Mon Sep 17 00:00:00 2001 From: haochen <3033940900@qq.com> Date: Fri, 9 Oct 2026 15:57:18 +0800 Subject: [PATCH] fix(llm-text): respect quoted reasoning tag delimiters (#6535) Co-authored-by: Zhangchenhao-111 <285911435+Zhangchenhao-111@users.noreply.github.com> Co-authored-by: Willem Jiang --- README.md | 2 +- .../packages/harness/deerflow/utils/AGENTS.md | 2 ++ .../harness/deerflow/utils/llm_text.py | 19 +++++++++++++++++-- backend/tests/test_utils_llm_text.py | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 98284e2e7f..a6f7820b08 100644 --- a/README.md +++ b/README.md @@ -1754,7 +1754,7 @@ Rebuild with `make up` after changing the managed extension set. See Gateway-generated follow-up suggestions now normalize both plain-string model output and block/list-style rich content before parsing the JSON array response, so provider-specific content wrappers do not silently drop suggestions. -Backend response cleanup preserves unrelated tag names such as `` and `` in follow-up suggestions and polished drafts; only the exact `` name (optionally followed by attributes) starts a reasoning block. Self-closing `` and `` tags are empty reasoning blocks and leave the following answer intact. +Backend response cleanup preserves unrelated tag names such as `` and `` in follow-up suggestions and polished drafts; only the exact `` name (optionally followed by attributes) starts a reasoning block. Self-closing `` and `` tags are empty reasoning blocks and leave the following answer intact. Delimiters inside quoted attributes, such as ``, also leave the following answer intact. The Web UI composer can polish draft input before sending. The rewrite runs as a short Gateway LLM request using the `input_polish` model configuration, keeps slash skill prefixes such as `/data-analysis`, and only replaces the local draft after the user clicks the polish button; it does not create a thread run or persist a message. diff --git a/backend/packages/harness/deerflow/utils/AGENTS.md b/backend/packages/harness/deerflow/utils/AGENTS.md index ca7e45eaa4..250f24133c 100644 --- a/backend/packages/harness/deerflow/utils/AGENTS.md +++ b/backend/packages/harness/deerflow/utils/AGENTS.md @@ -41,6 +41,8 @@ name; punctuated names such as ``, ``, and `` and `` tags are empty reasoning blocks: remove the tag without consuming subsequent text. +Both cleanup functions find opening delimiters outside quoted attributes; a +quoted `>` cannot terminate the tag or hide an answer after a self-closing tag. Keep exact unfinished `