refactor(trace): enforce run-only diagnosis model

This commit is contained in:
zhuyongxin
2026-07-20 14:11:34 +08:00
parent 190013c901
commit 4b9cf7c5cc
63 changed files with 583 additions and 909 deletions
@@ -12,7 +12,7 @@
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `id` | BIGINT | 是 | 自增主键 |
| `session_id` | VARCHAR(64) | 是 | 所属会话目录 ID,保留用于粗粒度过滤和兼容 |
| `session_id` | VARCHAR(64) | 是 | 所属会话目录 ID,作为粗粒度冗余筛选字段 |
| `run_id` | VARCHAR(64) | 否 | 所属 `diagnosis_run.run_id`;新执行应写入 |
| `step_id` | BIGINT | 否 | 可关联 `agent_step.id` |
| `tool_name` | VARCHAR(64) | 是 | 工具名称,例如 `lookup_knowledge`、日志查询、指标查询 |
@@ -35,7 +35,7 @@
| 索引 | 字段 | 用途 |
|---|---|---|
| `idx_session_id` | `session_id` | 历史兼容和粗粒度排查 |
| `idx_session_id` | `session_id` | 粗粒度排查 |
| `idx_tool_invocation_run_id` | `run_id, id` | Trace、Verifier、评测按运行查询工具调用 |
| `idx_tool_name` | `tool_name` | 按工具类型排查 |
| `idx_retrieval_layer` | `retrieval_layer` | 观察 RAG L0/L1 行为 |
@@ -43,7 +43,7 @@
## 关系
- `tool_invocation.run_id` 逻辑关联 `diagnosis_run.run_id`。
- `tool_invocation.session_id` 保留为 `chat_session.session_id` 的冗余关联,便于粗粒度过滤和兼容查询。
- `tool_invocation.session_id` 是 `chat_session.session_id` 的冗余关联,只用于粗粒度过滤。
- `tool_invocation.step_id` 可关联 `agent_step.id`,但当前不强制。
## 关键 JSON