fix(openclaw-plugin): declare OpenClaw 2026.8.1 durable-turn contract - #4465
Merged
Conversation
OpenClaw >=2026.8.1 degrades any context engine to "legacy" every turn unless info.transcriptSemantics declares currentTurnFence + turnAdvancementIdempotency and the engine implements commitTurn. Declare both and add an idempotent commitTurn ack keyed by advancementKey; capture stays in afterTurn, which the host still calls. Fixes #4103 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012TsbqPJYxEqGWrBqYeodWR
Collaborator
Author
|
本地实跑验证通过,结论:这个 PR 同时满足“旧版兼容”和“8.1 能调用 assemble hook”两点。 测试环境:
验证结果:
明确结论:可通过。 这个 PR 修复了 8.1 durable-turn contract 缺失导致的每轮 legacy 降级;同时保持对 2026.7.1 旧 host 的运行时兼容。唯一需要在 PR 描述里继续注明的是:本次 8.1 实跑针对 npm 可获得的 |
ZaynJarvis
marked this pull request as ready for review
August 29, 2026 06:35
qin-ctx
approved these changes
Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
起因
OpenClaw 2026.8.1-beta 上装 openviking 插件后,每轮都刷:
auto-capture / auto-recall 全程不工作(#4103)。
为什么是这个性质
不是 assemble 的问题。对照 openclaw
2026.8.1-beta.3dist:context-engine-logical-turn.ts(distcontext-engine-turn-attempt-*.js:63-64)在每个 turn 开始做三项检查:info.transcriptSemantics.currentTurnFence === "before-current-turn-entry-v1"、turnAdvancementIdempotency === "atomic-idempotent-v1"、typeof engine.commitTurn === "function"。任一缺失就把整个 logical turn 交给 legacy 引擎,插件的 assemble / afterTurn 根本没被调到。assemble的两种调用形态(preflight 带prompt/availableTools/citationsMode,transformContext 不带)和afterTurn的调用点与 2026.7.1 相同,插件现有分支逻辑不需要改。commitTurn(advancementKey, messages),失败下轮同 key 重试)。后续 #121461、#126593 修的是 host 侧 bug,beta.3 已含。改法
examples/openclaw-plugin/context-engine.ts:info.transcriptSemantics声明两个字段。commitTurn({ advancementKey }):内存 Set 记 key,首次返回committed,重复返回duplicate(上限 1024 个 key)。取舍
committed,行被删;这和改动前的持久性一致(afterTurn 没跑完就 crash 的 turn 原本也会丢)。如果后续 OpenClaw 把 afterTurn 从 durable 路径拿掉,capture 需要搬进 commitTurn。engines.openclaw保持>=2026.5.27:旧版忽略多余 info 字段和未知方法。没动什么
assemble / afterTurn / compact 逻辑、README。#4415 第 5 条(isMainAssemble duck-typing)这次核实在 8.1 仍成立,不在本 PR 处理。
验证
npm run typecheck通过。vitest run:750/754 通过;4 个失败在tests/ut/architecture-boundaries.test.ts,main 上(stash 后)同样失败,与本改动无关。tests/ut/context-engine-commit-turn.test.ts:断言 transcriptSemantics 值、commitTurn 同 key 二次调用返回 duplicate。Fixes #4103
🤖 Generated with Claude Code
https://claude.ai/code/session_012TsbqPJYxEqGWrBqYeodWR