fix(rectification): preserve assistant turns in dossier
Staging Backend Quality Gate / validate (pull_request) Successful in 17m28s
Staging Backend Quality Gate / publish (pull_request) Has been skipped

This commit is contained in:
Jesse_Chen
2026-08-12 15:33:04 +08:00
parent 4152103726
commit 746fdc184b
3 changed files with 198 additions and 0 deletions
+15
View File
@@ -3005,3 +3005,18 @@
- 防复发:服务器确认路径与额外对话轮次必须分开建模;任何 pending 状态不得隐式参与正式候选评分。
- 相关记录:BUG-170、BUG-174
- 修复版本:本次提交(staging 精确 SHA 以发布记录为准)
## BUG-176 | V9 普通 Turn 的 Agent 回复在刷新后消失
- 状态:resolved(本地候选)
- 首次发现:2026-08-12
- 最近更新:2026-08-12
- 影响面:V9 生时校正历史消息、持久化 Activity 与 Agent 下一轮上下文。
- 用户现象:事件提交后当轮可以看到 Agent 回复和 Activity,但刷新或重新进入 Case 后只剩用户事件;opening Agent 消息仍可显示。
- 触发条件:一条物理 `agentic_rectification_turns` 记录同时保存非空 `user_message``assistant_message`
- 根因:`get_agentic_rectification_case_dossier()` 把每条物理 Turn 只投影成一条逻辑消息,并用 `coalesce(user_message, assistant_message)` 优先返回用户文本,导致同一行已持久化的 Agent 回复和 receipt 关联在恢复 API 中丢失。
- 修复:新增向前业务迁移,将每条物理 Turn 通过 lateral values 展开为按 user、assistant 排序的最多两条逻辑消息;保留同一真实 Turn ID,使 assistant 消息继续读取对应 Activity receipt。
- 验证:迁移契约测试锁定双消息展开、空消息过滤、顺序、迁移唯一性和禁止复制到 identity migration treestaging 需继续验证 Case GET、页面刷新、下一轮上下文及计费不变量。
- 防复发:持久化行与对话消息不是一对一时,恢复投影必须显式展开全部逻辑消息,不得用 `coalesce` 静默舍弃其中一侧。
- 相关记录:BUG-173、BUG-174、BUG-175
- 修复版本:本次提交(staging 精确 SHA 以发布记录为准)