chore: 归档 session-storage change

- 创建 devflow 项目档案(brief/evidence/decisions/acceptance)
- 更新 devflow/index.md 索引
- 移动 OpenSpec 到 archive
This commit is contained in:
zhuyongxin
2026-06-26 17:33:56 +08:00
parent 9b52afce07
commit e3f20b1f06
12 changed files with 95 additions and 0 deletions
@@ -0,0 +1,22 @@
# 会话存储 — 决策记录
## 关键决策
| 决策 | 选择 | 理由 |
|------|------|------|
| AgentLoggingHook 创建方式 | POJO(构造注入),非 @Component | 需为 ChatService/AiOpsService 创建多个实例(不同 agentName) |
| AiOpsService 记录粒度 | 只记子 Agent(Planner/Executor),不记 Supervisor | Supervisor 编排日志已有体现,单独记录增加噪音 |
| sessionId 传递 | RunnableConfig.metadata(优先)+ ThreadLocal(兜底) | RunnableConfig 线程安全,异步兼容 |
| Tool 获取 sessionId | SessionContextHolder(ThreadLocal) | Tool 不在调用链中,无法通过 RunnableConfig 获取 |
| Token 追踪 | TokenTrackingChatModel 包装器拦截 ChatModel.call() | 框架 _TOKEN_USAGE_ 仅 stream 路径可用 |
| Chat 复杂度路由 | 关键词 + 长度判断 | MVP 简化实现 |
| 多 Agent Planner 无工具 | 不注入 methodTools/tools | 防止 Planner 自己执行,强制通过 Executor 执行 |
| 旧表处理 | V007 Flyway 迁移删除 diagnosis_record | 被三表替代,不再使用 |
## 风险
| 风险 | 等级 | 说明 |
|------|:----:|------|
| Hook 同步写 DB | 低 | MVP 阶段数据量小,后续可异步化 |
| token_count 依赖 ChatResponse.usage | 低 | DeepSeek 已确认返回实际用量 |
| stream 路径 session 记录 | 低 | 当前 call 路径正常,stream 需确认 RunnableConfig 传播 |