Repository navigation
fix(kap-server): prune divergent live transcript steps - #4792
Conversation
- replace ended turns when cold history omits live steps or frames - preserve live-first headers, longer text, tool outcomes, and attachments - cover post-turn healing when a steered live turn has an extra step
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
Requirement or Bug
Desktop / Web 用户在模型响应期间连续发送多条 steer 后,turn 完成时可能看到同一组用户消息和 assistant 回复各出现两次。本 PR 是 #4762 的后续修复,让 post-turn Transcript 收敛后只保留一份内容。
Bug Reproduction Steps
Root Cause
被 steer 中断且没有输出的 step 不会形成独立的 cold context message;cold 重建时会把 steer 用户帧附着到下一个 assistant step,因此 cold 与 live 的 step/frame 结构不同。
原有 post-turn heal 只对 cold 内容执行 upsert,从不删除 live 中 cold 已不包含的 step/frame,导致两套投影同时保留。这是合并收敛逻辑的修复,不是通过文本去重或隐藏客户端消息来绕过问题。
Code Changes
healTurn:保留 live header、附件 ID、较长文本、工具结果以及 display / agentRefs / approvalId。healTurnOps的 upsert 行为;运行中 backfill 路径不变。t0.2、cold 仅t0.1的分叉场景,同时验证附件保留与步骤收敛;测试声明总数不增加。Behavior Changes and Affected Users
受影响模块为
kap-server的 post-turn Transcript heal。packages/kap-server/test/services/transcript.test.ts覆盖结构收敛、附件、工具结果、backfill 和交互实体;transcriptContract.e2e.test.ts覆盖 REST / WebSocket 一致性与重连行为。验证结果
packages/kap-server/test/services/transcript.test.ts:111/111 通过。packages/kap-server/test/transcriptContract.e2e.test.ts:13/13 通过。@moonshot-ai/kap-servertypecheck:通过。@moonshot-ai/kap-serverbuild:通过。['t0.1', 't0.2'];修复后仅保留['t0.1']。Checklist
calm-pandas-steer.md,本次为同一行为的缺陷修复。