Repository navigation
test(openclaw): run the plugin against a real OpenClaw host - #2685
Merged
AlexStocks merged 1 commit intoNov 17, 2026
Merged
Conversation
A pinned OpenClaw 2026.8.1 Gateway loads the plugin's built bundle and serves turns against a real PowerContext Server and a deterministic model fixture. Seven cases cover recall, Scope resolution, the recall and capture settings, memory tools, excluded sessions, the in-session pre-compaction checkpoint, and a Server outage. The openclaw-package job installs the pinned host and runs them. The shared model fixture compares tool call IDs without separators, because OpenClaw strips them before it replays a call, and it can report prompt usage in streamed replies so a host compacts.
PsiACE
approved these changes
Nov 17, 2026
AlexStocks
reviewed
Nov 17, 2026
|
|
||
| def _call_identity(value: Any) -> str: | ||
| """A tool call ID as hosts may replay it: without separators.""" | ||
| return re.sub(r"[^A-Za-z0-9]", "", value) if isinstance(value, str) else "" |
Contributor
There was a problem hiding this comment.
[P2] 共享 fixture 放宽了 tool_call_id 相等判定,6 条宿主验收链因此失去区分被改写 ID 的能力
_call_identity()(:43-45,本 PR 新增)把任何非字母数字字符全部剥掉后比较(:245 使用处):
def _call_identity(value: Any) -> str:
return re.sub(r"[^A-Za-z0-9]", "", value) if isinstance(value, str) else ""base 上这里是严格相等(message.get("tool_call_id") == self.pending["tool_calls"][0]["id"])。放宽后 _call_identity("call_1") == _call_identity("call-1") == "call1"——两个协议上不同的调用会被判为"同一调用已确认"。
该 fixture 是共享实现:本 PR 在 tests/test_ci_changes.py:289-290 把消费者从 {tests,zcode,pi,opencode,codex,bub} 扩成再加 openclaw,即 6 条宿主验收链全部改用去分隔符比较。改动动机(OpenClaw 会剥掉分隔符)是真实的,但正确的做法是给 openclaw 单独声明它的规范化规则,而不是让其余 5 条链的断言同时失去区分能力——这类 e2e 的核心目的之一就是证明宿主把工具结果回填到原来的调用上。
建议:比较改为"严格相等,或仅在 openclaw 用例显式开启的规范化模式"(fixture 上加开关),并保留对原始 ID 字符集差异的记录,避免影响其余 5 条链。
AlexStocks
approved these changes
Nov 17, 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.
Which issue or RFC does this PR close?
No tracking issue. This adds the OpenClaw member of the real-host service-chain E2E set, beside Pi (#2531), OpenCode (#2533), Codex (#2624), and Bub (#2649).
Rationale for this change
The OpenClaw plugin's tests drive the plugin with simulated hook contexts, so they cannot show what OpenClaw itself sends. These cases run the real host instead. A pinned OpenClaw 2026.8.1 Gateway loads the plugin's built bundle and talks to a real PowerContext Server, with a deterministic local model fixture standing in for the model. Each case checks one promise from the OpenClaw integration docs.
Two of those promises were broken against the real host, and both are now fixed on
master:before_prompt_buildbut not toagent_end. Automatic capture therefore ignored project bindings, and prompts captured inside a project were never recalled there.before_compactionwith only the session key. The plugin found no agent and skipped the pre-compaction checkpoint.What changes are included in this PR?
tests/e2e/test_openclaw_service_chain.py. A realopenclaw gateway runprocess loads the plugin throughopenclaw plugins install --link --force --accept-capabilities, andopenclaw agentsubmits each turn as an ordinary Gateway client. The Server runs in process on SQLite with bearer auth. Seven cases:scopeIdwins over durable bindings. Among the bindings, the OpenClaw session wins over the active project, which wins over the agent.autoRecallandautoCapturework independently, and explicit memory tools keep working with both off.powercontext_memory_storeandpowercontext_memory_searchreach the session-bound Scope.compaction.mode: "default", the in-session auto-compaction checkpoint captures the prompt and flushes the agent's Scope while the Gateway runs. The transcript is too short for OpenClaw to compact anything (it logsno_compactable_entries), so the case covers the checkpoint, not the compaction itself.tests/e2e/zcode_acceptance/protocol.py. Two changes to the sharedHostModelFixture:call-<hex>-1becomescall<hex>1); without this the fixture never sees its call acknowledged and repeats it forever.streamed_prompt_tokenssetting adds a usage chunk to streamed replies. The compaction case uses it to cross OpenClaw's threshold. It defaults toNone, so other hosts' streams are unchanged.openclaw-packagejob pinsOPENCLAW_VERSION: '2026.8.1'. It installs that release from npm into$RUNNER_TEMPwith--ignore-scripts, as the OpenCode job does, and checks its--version. It then runs the cases under Node 24.15.0 and uploads the Gateway logs on failure. A missing binary fails the step rather than skipping the cases..github/ci-paths.tomlroutestests/e2e/zcode_acceptance/protocol.pyandrunner.pyto theopenclawsuite.tests/test_ci_changes.pyadds the rows for those files and for the new test.Are there any user-facing changes?
No. Test and CI only.
How was this change tested?
ea80657) on macOS, installed with--ignore-scriptsas CI installs it. All seven cases passed in three consecutive full runs with the Gateway on Node 24.16.0, taking 64–70 s each.dist/index.js, and the case meant to catch it was run. Every mutation was caught, and the bundle was restored after each one.dist/index.jsautoCaptureautoRecallbefore_compactionneedsctx.agentId(reverts #2622)The last two need the outage case's diagnostic check. OpenClaw catches a throwing
before_prompt_buildhook and times out a stuck one after 15 s, so the turn completes either way. The case therefore also asserts the plugin's owncontext_prepare/server_unavailablediagnostic, and the absence of OpenClaw's hook-failure log line.uv run pytest tests/test_ci_changes.py: 159 passed.uv run pytest tests/test_zcode_acceptance_protocol.py: 18 passed.make openclaw-plugin-test(109 tests, type check, build) andmake checkpass.Not validated:
openclaw@2026.8.1but not its dependencies, which npm resolves on each run.pre_compaction_checkpoint/deadline_exceeded, and the flush completed afterwards.openclaw agent --local, and compaction modes other thandefaultwere not run.Findings from the real host that remain open (none is changed here):
before_compactioncontext carriesactiveProjectKeys. With a project binding, the checkpoint can capture into the agent or default Scope instead of the project Scope the turn's recall reads. This needs a separate fix.powercontext setup openclawrequiresplugins install --no-enable, and its error names 2026.9.7. The docs and the plugin manifest say 2026.8.1-beta.2 or newer, and 2026.8.1 has no--no-enable. The docs also describe setup as runningplugins install --link --force, while the code installs a packed archive with--force --no-enable.--accept-capabilitiesto install this plugin. The documented--link --forcecommand omits it.openclaw agent --localrunsagent_endhooks fire-and-forget. A one-shot local turn can exit before the capture request is sent, which is why these cases use the Gateway.Design notes for the cases and CI wiring:
agent_endhooks before it shuts down.--ignore-scripts, and the log upload skips pytest's*currentlinks, which would otherwise upload each log twice.AI usage statement
Claude Code (Claude Opus 5.5) investigated the OpenClaw host behavior, wrote the tests and CI wiring, and ran the real-host validation and mutations above.