fix: CC追问三轮修复——内联禁令全量扩例外+让位唯一锚点+禁数字回显

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-08 13:02:17 +08:00
parent 206beae11b
commit 714e22bde5
2 changed files with 40 additions and 13 deletions
+25 -3
View File
@@ -954,18 +954,40 @@ def test_contact_completion_note_serial_priority():
def test_reminder_cc_round_confirmed_block_yields_to_cc_note():
"""生产验收场景①修复: CC 追问轮 confirmed 块让位——同轮两个"逐字使用这句"
竞争时 GLM 稳定服从更显眼的 NO_CONTACT_ALREADY 确认句,压制国家代码追问。"""
"""生产验收场景①修复(三轮终版): CC 追问轮 confirmed 块让位——同轮两个
"逐字使用这句"竞争时 GLM 稳定服从更显眼的 NO_CONTACT_ALREADY 确认句,
压制国家代码追问;让位段给唯一逐字锚点+禁数字回显(防自创确认句带号)。"""
raw = {"联系方式": {"whatsapp": "0501234567"}} # 裸号 → CC 追问轮
text = ConversationManager._build_context_reminder(raw, "yes", [])
assert "Could you send the full number with the country code" in text # CC 句在场
assert "Got it — our manager will reach out" not in text # 确认句让位(逐字建议消失)
assert "本轮不要使用确认句" in text # 让位语义钉死
# 反向钉死边界: 同画像换带前缀号(非 CC 轮) → 确认句回归
assert "绝不写出号码数字" in text # 禁数字回显(三轮回归堵漏)
assert "重发完整号一次" in text # confirmed 块禁令已扩例外
# 反向钉死边界: 同画像换带前缀号(非 CC 轮) → 确认句回归,无让位段
raw2 = {"联系方式": {"whatsapp": "+966501234567"}}
text2 = ConversationManager._build_context_reminder(raw2, "yes", [])
assert "Got it — our manager will reach out" in text2
assert "本轮不要使用确认句" not in text2
assert "重发完整号一次" in text2 # 非CC轮禁令例外同样在场
def test_inline_prohibitions_all_carry_reask_exception():
"""三轮修复防第四次漏: conversation.py 三处内联禁令运行时文本(app分支/
confirmed块/边界分支)都必须带"重发完整号一次"例外——CC 追问是对已在手
渠道的重发请求,只豁免缺失渠道的禁令会压制它(生产验收两轮复发的根因)。"""
with open("app/services/conversation.py", encoding="utf-8") as f:
src = f.read()
assert src.count("重发完整号一次") >= 3
anchors = [
"也绝对禁止再索要客户已提供过", # contact_note app+已留资分支
"。绝对禁止再索要客户已提供过", # confirmed 块(句号起,不与app分支互串)
"即可,禁止再索要联系方式", # 边界分支尾补
]
for anchor in anchors:
assert anchor in src, anchor
i = src.index(anchor)
assert "重发完整号一次" in src[i:i + 260], anchor # 例外必须就近在场
def test_contact_completion_two_round_serial_and_persistence(async_db, monkeypatch):