一、客服 Agent 智能增强(正面回应"不智能、动不动就转人工")
- 决策链由 2 个出口扩到 5 个:E1 澄清 / E2 计算型 / E3 知识直返 / E4 证据约束生成 / E5 分级回退
- 转人工从"默认动作"降为最后一档 E5c,只保留 4 类白名单:
P0 反诈 / P1 账户与个人数据 / P2 写操作与争议 / 用户明确要求人工
- 46 条金标实测(修复前 → 修复后):
转人工率 43.5% → 10.9%;出口准确率 45.7% → 100%;事实正确率 69.6% → 100%
禁忌违反 1 → 0;档位越权 / 无出处数字 / 误拒 四项零容忍全 0
- 安全不变量 INV-1~INV-5;零容忍规则未删,改的是挂载点
(输出侧字面黑名单 → 检索层档位隔离 + 判定层合规词表 + 输出守护)
二、知识库:档位单点化与物理隔离
- 新增 app/core/knowledge_tier.py 作为档位规则唯一落点(G-03),
knowledge_contracts.py 原定义块改为显式再导出(X as X,非副本)
- 档位过滤由 bool 默认值(fail-open)改为 tiers 必填集合(缺参即 TypeError)
- Milvus 侧四集合按 visibility 分区键物理隔离;双 schema 收敛为一套
- 新增 app/core/actor.py:访客三元组与匿名判定的唯一构造/判定点(G-01/G-01b)
- 新增 app/core/fund_fee_rules.py:费率计算纯函数
三、前端入参边界对齐(本轮 W11 新修,4 处"校验宽于存储")
- message 加 max_length=8000(与浮窗 widget.js 的 maxlength 一致)
- session_id 加 1—64;idempotency_key 上限 128 → 64(对齐列宽 String(64))
- feedback_type 加 max_length=32(对齐列宽 String(32))
- 8 条路径参数补 min_length=1 + max_length=64 + 字符集正则
({session_id} / {run_id} / {handover_id})
- 改前超限值会落到 MySQL 才失败(500);改后一律 422 AGENT_INPUT_INVALID + 字段级定位
- 新增 tests/unit/api/test_frontend_boundaries.py(33 例),含"端点表 ↔ OpenAPI 全量对照"
四、投顾模块整体清除(D4.4 / D4.5)
- 删除投顾相关 controller / schema / model / repository / service 及门户页面
- tools/portal_api_check.py 同步作废 AD003/AD005/AD011/A047 四条用例与 advisor_t 登录
(端点与账号均已不存在,此前稳定报 3 条假红)
五、验证(提交前实测)
- pytest -q:1856 passed / 2 skipped / 0 failed
- ruff check app tools tests:19(= 基线);mypy app:2(= 基线)
- 前端接口契约体检 portal_api_check.py:38 项,通过 34,失败 0,跳过 4
- 全链路冒烟 e2e_smoke_test.py --read-only:31/31
- HTTP 全链路探针 http_probe.py:11/11 succeeded
- 跨文档一致性 _consistency.py:GATE PASS
- 真机边界复验 12 条:12/12 符合预期
六、纪律与文档
- 可改文件白名单 A-09(docs/46)与底座会签申请单 A-10(docs/47,组 1—组 4 全部受理)
- 零 DDL:未新增/修改任何表结构,89 张业务表与基线一致
- 证据留痕:docs/evidence/**(含 46 条金标 score、快照、清除与重建记录)
- 未提交(刻意排除,见提交说明):仓库内 客服agent/ 与 开发文档/ 是 2026-09-16 前的
过期副本(Todolist 440 行 vs 权威 D2.1 1167 行),权威正本在仓库外;
_chunks_report.txt 是 tools/build_knowledge_chunks.py 生成的本地产物
128 lines
6.6 KiB
JSON
128 lines
6.6 KiB
JSON
{
|
||
"artifact": "t2c-compliance-seed",
|
||
"generated_at": "2026-09-18T11:03:22.953999+00:00",
|
||
"date_local": "2026-09-18",
|
||
"purpose": "D2.1 本轮:合规层种子重跑(消掉 4 项红测试)+ 品牌面残留修正(挖出一处事故级双品牌)",
|
||
"trigger": "用户 2026-09-18「继续」——上轮汇报建议:合规种子重跑可一次消掉剩余 6 项失败里的 4 项,且 agent_reply_template 0 行意味着治理层取不到 6 类固定话术",
|
||
"compliance_seed": {
|
||
"script": "tools/seed_compliance_baseline.py",
|
||
"idempotent_by": [
|
||
"agent_negative_word.rule_code",
|
||
"agent_reply_template.template_code+version"
|
||
],
|
||
"before": {
|
||
"active_rules": 0,
|
||
"total_rules": 0,
|
||
"active_templates": 0,
|
||
"total_templates": 0
|
||
},
|
||
"after": {
|
||
"active_rules": 11,
|
||
"active_templates": 6,
|
||
"scenes": 6
|
||
},
|
||
"governance_read_predicate": "status='active' AND reviewer_id IS NOT NULL AND reviewed_at IS NOT NULL(与 governance.py 逐字一致)",
|
||
"brand_data_already_fixed": "TPL_TRANSFER_HUMAN / TPL_SYSTEM_BUSY 热线已为 400-889-8899(每日 7:00—22:00),无旧号 15936583816",
|
||
"verify_output": "verified: 11 active rules (含 7 个零容忍词), 6 active templates covering 6 scenes"
|
||
},
|
||
"test_delta": {
|
||
"test_compliance_seed_mysql.py": "4 failed -> 4 passed",
|
||
"pytest_full": "6 failed / 1501 passed / 2 skipped -> 2 failed / 1505 passed / 2 skipped",
|
||
"remaining_two": [
|
||
"tests/integration/test_profile_snapshot_current_invariant_mysql.py::test_profile_rebuild_then_candidate_approval_keeps_current_snapshot_invariant",
|
||
"tests/integration/test_worker_runtime_mysql.py::test_http_accept_worker_commit_query_and_repeat[False]"
|
||
],
|
||
"new_failures": 0
|
||
},
|
||
"brand_residue": {
|
||
"incident": {
|
||
"file": "app/service/agent/implementations/customer_service.py",
|
||
"line_before": 169,
|
||
"value_before": "COMPANY = \"南方财富\"",
|
||
"conflict_with": "app/core/customer_service_rules.py:41 COMPANY = \"南方基金\"",
|
||
"consequence": "同一个客服两种自称:闲聊提示词(发布配置 + 代码默认值同源)称「南方财富」,业务话术称「南方基金」;该文本还被写进发布配置,运行期覆盖代码默认值",
|
||
"fix": "按该文件自己写明的『常量各写一份就一定会漂移』原则,改为从 app.core.customer_service_rules 转发 COMPANY(删掉第二份定义)"
|
||
},
|
||
"prompt_rows_fixed": {
|
||
"table": "prompt_template_version",
|
||
"rows": [
|
||
"id=1 release=57 v=1",
|
||
"id=2 release=58 v=2"
|
||
],
|
||
"before": "你是南方财富的智能客服助手。…",
|
||
"after": "与 DEFAULT_CHITCHAT_SYSTEM 逐字一致(南方基金)",
|
||
"why_in_place_not_new_version": "RuntimeConfigService.prompt() 没有 ORDER BY;同一 (release_id, prompt_code, task_type, agent_type) 若并存两行,session.scalar() 取哪一行不确定 ⇒ 新增 v3 会变成『提示词随机生效』的静默故障。故原地修正唯一命中行并重算 checksum(checksum 对提示词行仅信息性:运行期不校验,_validate_release 只校验 platform_config_item)",
|
||
"runtime_verify": "load_active_prompt(customer_service_chitchat, chat, customer_service) -> release=58 v=2,品牌正确=True"
|
||
},
|
||
"full_db_scan": {
|
||
"method": "information_schema 取全部 char/varchar/text 列,逐列 LIKE 五个标记:南方财富 / 南方科技 / 15936583816 / nanfangwm / nanfangtech",
|
||
"hits": [
|
||
{
|
||
"table": "prompt_template_version.system_prompt",
|
||
"rows": 2,
|
||
"marker": "南方财富",
|
||
"reachable": true,
|
||
"status": "已修"
|
||
},
|
||
{
|
||
"table": "fin_knowledge_meta.content_text",
|
||
"rows": 11,
|
||
"marker": "15936583816",
|
||
"reachable": false,
|
||
"why": "含旧号的 11 行 status=active/review_status=published,但唯一消费方 KnowledgeMysqlAuthority 全仓无生产调用方(死代码,仅 tests/unit/service/test_knowledge_authority.py 引用);客服回答链路的词法召回走 Milvus,不读该表"
|
||
},
|
||
{
|
||
"table": "episodes.summary",
|
||
"rows": 15,
|
||
"marker": "15936583816",
|
||
"reachable": false,
|
||
"why": "历史长记忆摘要;长记忆当前未接运行期"
|
||
},
|
||
{
|
||
"table": "conversation_message.content",
|
||
"rows": 13,
|
||
"marker": "15936583816",
|
||
"reachable": false,
|
||
"why": "历史会话正文;输出侧脱敏会把 13x 号段掩码,不会回显"
|
||
}
|
||
]
|
||
},
|
||
"frontend_pending": {
|
||
"task": "乙-26 / D1.4 §G-02 + §G-05",
|
||
"scope": "app/static/portal/** 24 文件 + 风控 5 处仍为「南方财富」",
|
||
"status": "用户 2026-09-18 已批复『改』并建议升 P1;本轮未执行(属演示面 T4)"
|
||
}
|
||
},
|
||
"gates": {
|
||
"pytest": "2 failed / 1505 passed / 2 skipped",
|
||
"ruff": "22 errors(与 T0 基线同数,无新增)",
|
||
"mypy": "3 errors(同上)",
|
||
"check_authoritative_docs": "checked 50 documents, no number collision",
|
||
"audit_schema": "schema audit passed: 89 business tables"
|
||
},
|
||
"open_decisions": [
|
||
{
|
||
"id": "C-05-落点",
|
||
"question": "C-05 三类词(收益比较/稀缺性/费率误导)写到哪里?",
|
||
"constraint": "D2.1 §1.4 D-a 与 C-05 DoD 写『不改任何 .py』;但三类词在 tools/seed_compliance_baseline.py 中并不存在,而它是唯一可复现的装载器(管理端 negative-word-rules 通道只建 draft,需审核才 active)",
|
||
"option_a": "改种子脚本增行(单点可复现、与 D-b 热线数据同源、verify() 自动覆盖自绊);代价:需把 DoD 的『不改任何 .py』登记为『不改 app/** 与底座 .py』",
|
||
"option_b": "另存非 .py 的种子数据 + 口径说明(严格字面满足);代价:出现第二份种子,新环境漏跑即静默缺失",
|
||
"recommendation": "甲案(改种子脚本)"
|
||
},
|
||
{
|
||
"id": "乙-26-提前",
|
||
"question": "前端 24 文件 + 风控 5 处品牌面是否提前到本批量一起改?",
|
||
"recommendation": "可以提前(机械替换、D1.4 已定位到行;评审肉眼可见)"
|
||
}
|
||
],
|
||
"honesty": [
|
||
"C-05 三类词尚未写入:等用户对落点拍板(本步只跑了既有 11 条种子)",
|
||
"C-06 双向验证(红队 5 条诱导问法 / 反例守卫 / 访客推介边界)本轮未执行",
|
||
"E2 计算型出口、E4 证据约束生成 仍未实现"
|
||
],
|
||
"docs_writeback": [
|
||
"开发文档/D1.6 §4.11",
|
||
"客服agent/D2.1 v5.8"
|
||
]
|
||
}
|