fix(session-title): 修复 <session> 标签包裹用户文本导致标题全部回退到元数据#259
Merged
ThreeFish-AI merged 1 commit intoJun 4, 2026
Conversation
当用户实际输入被 <session> 标签完整包裹时,首轮噪声剥离会将 整个 <session> 块连同用户文本一并删除,导致 Level 1 始终返回空。 新增二次回退机制:若首轮结果为空,仅去除 <session> 外壳标签, 保留内部文本后重新剥离噪声,确保用户文本可见。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
PR #258 合并后,Dashboard 中 Session Title 全部变成
[Session] {model_name}(Level 4 兜底),用户实际输入未显示。根因:
<session>标签在某些场景下会完整包裹用户文本(而非仅作为前缀)。_NOISE_TAG_PATTERN使用re.DOTALL+.*?匹配<session>...</session>时,连同内部用户文本一并删除,导致 Level 1 始终返回空。改动
_sanitize_user_text新增二次回退提取(executor.py):当首轮噪声剥离结果为空时,检测是否含
<session>标签,若是则:<session>/</session>外壳标签,保留内部文本这确保用户文本在
<session>包裹场景下仍可被提取。新增测试(
test_router_executor.py):<session>包裹纯用户文本 → 二次回退提取用户文本<session>包裹混合内容(元数据 + 噪声 + 用户文本)→ 噪声被剥离,用户文本可见<session>仅作为前缀(原有行为)→ 不受影响<session>内全为噪声 → 仍返回空,回退到 Level 4验证