一、客服 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 生成的本地产物
142 lines
5.7 KiB
JSON
142 lines
5.7 KiB
JSON
{
|
||
"artifact": "gate-baseline",
|
||
"generated_at": "2026-09-18T07:39:31.652Z",
|
||
"date_local": "2026-09-18",
|
||
"purpose": "D2.1 A-02 门禁数字基线(G-00 完成后首跑)",
|
||
"environment": {
|
||
"interpreter": "D:\\桌面\\金融\\group_fqcd_jr\\.venv\\Scripts\\python.exe",
|
||
"python": "3.13.5 (packaged by Anaconda, Inc.)",
|
||
"base_interpreter": "D:\\ANACOUDA\\python.exe (Anaconda base, NOT a venv)",
|
||
"venv_created": "2026-09-18",
|
||
"sqlalchemy": "2.0.54",
|
||
"pymilvus": "2.6.17",
|
||
"asyncmy": "0.2.14",
|
||
"dependencies": "requirements.txt 全量安装成功(Successfully installed ~100 packages)",
|
||
"worker_running": false,
|
||
"note": "跑门禁前 Worker 未运行(API/Worker 均未起),符合 A-02 要求"
|
||
},
|
||
"services": {
|
||
"mysql": {
|
||
"port": 3306,
|
||
"status": "OPEN",
|
||
"version": "8.0.44",
|
||
"database": "jr_agent",
|
||
"user": "jr_app"
|
||
},
|
||
"redis": {
|
||
"port": 6379,
|
||
"status": "OPEN",
|
||
"ping": "+PONG"
|
||
},
|
||
"milvus": {
|
||
"port": 19530,
|
||
"status": "OPEN",
|
||
"rest_health_9091": "OK",
|
||
"image": "milvusdb/milvus:v2.5.3",
|
||
"mode": "standalone (milvus-etcd v3.5.16 + milvus-minio RELEASE.2023-03-20T20-16-18Z)"
|
||
},
|
||
"api": {
|
||
"port": 8000,
|
||
"status": "CLOSED"
|
||
}
|
||
},
|
||
"gates": {
|
||
"1_pytest": {
|
||
"command": "python -m pytest -q -p no:cacheprovider",
|
||
"result": "8 failed, 1440 passed, 2 skipped, 27 warnings in 63.62s",
|
||
"exit_code": 1,
|
||
"failed": [
|
||
"tests/integration/test_agent_run_acceptance.py::test_customer_service_accept_redacts_sensitive_message_before_persistence",
|
||
"tests/integration/test_compliance_seed_mysql.py::test_all_seven_negative_words_are_active_and_reviewed",
|
||
"tests/integration/test_compliance_seed_mysql.py::test_reply_templates_cover_all_six_scenes",
|
||
"tests/integration/test_compliance_seed_mysql.py::test_negative_rules_are_gated_to_customer_service_only",
|
||
"tests/integration/test_compliance_seed_mysql.py::test_own_reply_templates_do_not_trip_the_seeded_rules",
|
||
"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]",
|
||
"tests/unit/tools/test_rbac_seed_consistency.py::test_permission_ids_are_consistent_between_seed_and_grant_scripts"
|
||
]
|
||
},
|
||
"2_ruff": {
|
||
"command": "python -m ruff check app tests tools alembic",
|
||
"result": "Found 22 errors (11 fixable)",
|
||
"exit_code": 1,
|
||
"by_rule": {
|
||
"E501": 9,
|
||
"F401": 7,
|
||
"F541": 2,
|
||
"I001": 2,
|
||
"F821": 1,
|
||
"B905": 1
|
||
},
|
||
"by_file": {
|
||
"app/service/promotion_renderer.py": 9,
|
||
"app/service/agent/bootstrap.py": 4,
|
||
"tests/unit/api/test_portal_frontend.py": 2,
|
||
"tools/probe_memory_state.py": 2,
|
||
"tests/unit/service/test_promotion_renderer.py": 2,
|
||
"app/service/agent_persistence_service.py": 1,
|
||
"app/service/run_query_service.py": 1,
|
||
"tests/contract/test_financial_nl2sql_agent_contract.py": 1
|
||
},
|
||
"notable": "F821 app/service/agent_persistence_service.py:82:42 Undefined name `Any` —— 局部变量注解不参与运行时求值,故不崩溃,但 mypy 同点报错,属真缺陷"
|
||
},
|
||
"3_mypy": {
|
||
"command": "python -m mypy app",
|
||
"result": "Found 3 errors in 3 files (checked 229 source files)",
|
||
"exit_code": 1,
|
||
"errors": [
|
||
"app/service/agent_persistence_service.py:82: Name \"Any\" is not defined [name-defined]",
|
||
"app/service/run_query_service.py:79: Argument 1 to \"_recover_financial_result\" has incompatible type [arg-type]",
|
||
"app/service/promotion_renderer.py:84: Argument 1 to \"_mix_rgb\" has incompatible type [arg-type]"
|
||
]
|
||
},
|
||
"4_check_authoritative_docs": {
|
||
"command": "python tools/check_authoritative_docs.py",
|
||
"result": "checked 50 documents, no number collision",
|
||
"exit_code": 0
|
||
},
|
||
"5_audit_schema": {
|
||
"command": "python tools/audit_schema.py",
|
||
"result": "schema audit passed: 89 business tables, no missing or unexpected tables",
|
||
"exit_code": 0
|
||
}
|
||
},
|
||
"db_state_snapshot": {
|
||
"total_tables": 90,
|
||
"business_tables": 89,
|
||
"non_business_tables": [
|
||
"alembic_version"
|
||
],
|
||
"agent_negative_word": {
|
||
"rows": 0,
|
||
"active": 0,
|
||
"note": "合规零容忍词种子未跑 —— 4 项 test_compliance_seed_mysql 失败的直接原因"
|
||
},
|
||
"agent_reply_template": {
|
||
"rows": 0,
|
||
"active": 0,
|
||
"note": "6 类固定话术未种 —— 同上"
|
||
},
|
||
"sys_user": 6,
|
||
"sys_role": 4,
|
||
"sys_permission": 60,
|
||
"agent_run": 50,
|
||
"domain_event_outbox": 495,
|
||
"advisor_tables_present": 20,
|
||
"note": "投顾模块代码已清除,但 advisor_* 20 张表仍在库(遵守 N-5 零 DDL);表名与文档口径有差异:config_release(非 agent_config_release)、conversation_message(非 agent_message)"
|
||
},
|
||
"failure_triage": {
|
||
"A_compliance_seed_unseeded": [
|
||
"test_compliance_seed_mysql x4"
|
||
],
|
||
"B_advisor_purge_leftover": [
|
||
"tests/unit/tools/test_rbac_seed_consistency.py —— tools/check_rbac_seed_consistency.py:50 仍登记已删除的 tools/grant_advisor_role.py,触发 FileNotFoundError"
|
||
],
|
||
"C_needs_investigation": [
|
||
"test_agent_run_acceptance redact",
|
||
"test_profile_snapshot_current_invariant",
|
||
"test_worker_runtime_mysql outbox 多出 memory.extraction_requested 事件"
|
||
]
|
||
},
|
||
"honesty": "本文件是**修复前基线**,如实记录。8 项失败**未修复**(属基线,不属本次改动)。"
|
||
} |