P1 安全与可靠性(4 项): - wecom: verify_signature 增加时间戳新鲜度校验(5 分钟窗口防重放) - cache: should_cache 在 per_user_namespace 开启时拒绝 user_id=None 匿名请求,避免跨用户缓存泄漏(安全要求 a/e) - channels: webhook receive_message 异常兜底,防止 500 触发平台重试风暴 - app: shutdown 调用 close_all_adapters + await _pending_webhook_tasks, 防止 httpx 连接泄漏和丢失 IM 回复 P2 效率与可维护性(5 项): - feishu: _TOKEN_CACHE_TTL 300 → 6900(2h 减 5min 余量,避免 24x 过频刷新) - channels: _pending_webhook_tasks 有界化(2x 并发上限时 429 拒绝) - gateway: quota 检查每 period 单次 get_usage,复用 summary 检查 token+cost - cache_key: generate_cache_key 合并为单次 SHA-256(消除 8-10 次冗余哈希) - config: ProviderConfig.get_api_key 移除未用的 secrets_store 参数 P3 去重(1 项): - channels: _process_inbound_message DIRECT_CHAT 路径提取 _direct_chat 辅助函数 测试: - test_wecom: 时间戳改用 int(time.time()),新增 test_expired_timestamp_rejected - test_cache: should_cache 测试覆盖匿名拒绝 + namespace_off 兼容 - test_config_migration: get_api_key 测试适配新签名 - channels/config_migration/quota_enforcement 测试全部通过 |
||
|---|---|---|
| .. | ||
| documents | ||
| e2e | ||
| integration | ||
| routes | ||
| tools | ||
| unit | ||
| __init__.py | ||
| conftest.py | ||
| test_routing_chain.py | ||