fix(openclaw-plugin): dedupe afterTurn replay with raw tail#1903
fix(openclaw-plugin): dedupe afterTurn replay with raw tail#1903huangxun375-stack wants to merge 1 commit intovolcengine:mainfrom
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
8212abd to
fd4f5af
Compare
fd4f5af to
ca3da4a
Compare
|
P2完整 replay 仍会被再次写入 这里在 stored tail 与 incoming 完全相同、没有新 tail 时返回了原 incoming,而不是空数组;下方 oversized tail-match 分支也一样。这样 OpenClaw finalizer 如果只是重放 loop hook 已经完整捕获过的同一批消息,第二次 afterTurn 仍会把整批消息再次 addSessionMessage,PR 标题要修的 replay duplicate 仍存在。PR 自带的 keeps an entire identical finalizer transcript 测试也证明了这个行为。建议要么对完整连续匹配返回 [],要么引入 turn/runtime id 来区分真实重复输入与 finalizer replay。 /Users/quemingjian/Source/OpenViking/examples/openclaw-plugin/context-engine.ts:393-399 我主要发现这一处会影响 PR 目标的问题:当前实现只能处理“已有前缀 + 新消息”的 finalizer replay,但处理不了“finalizer 完整重放同一批消息且没有新消息”的情况,所以仍会产生重复 transcript。 验证情况:git diff --check origin/main...origin/pr/1903 通过;在临时 worktree 中 npm test -- --run tests/ut/dedup-after-turn-batch.test.ts tests/ut/context-engine-afterTurn.test.ts tests/ut/client.test.ts 通过,3 个文件 86 个测试。Python 目标测试启动后卡在构建 Rust 依赖,没有进入 pytest 输出,我中断并清理了临时 worktree。 |
Description
Related Issue
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes