Expose chat.inject metadata for plugin approval updates#82471
Expose chat.inject metadata for plugin approval updates#82471Guardiola31337 wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 27, 2026, 11:15 AM ET / 15:15 UTC. Summary PR surface: Source +247, Tests +545, Docs 0, Other +16. Total +808 across 16 files. Reproducibility: not applicable. as a bug reproduction: this is a feature/API PR. The PR body provides after-fix loopback Gateway proof for metadata persistence, live broadcast, history, and dedupe behavior. Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land this only after maintainers accept the additive Gateway/plugin SDK contract as part of the approval API bundle, generated/client compatibility is acceptable, and the latest CI head is clean. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a feature/API PR. The PR body provides after-fix loopback Gateway proof for metadata persistence, live broadcast, history, and dedupe behavior. Is this the best way to solve the issue? Unclear pending maintainer contract approval. The implementation is narrow and covered, but the permanent Gateway/plugin SDK surface and admin trust boundary need explicit review with the companion PRs. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 0d0bddf03222. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +247, Tests +545, Docs 0, Other +16. Total +808 across 16 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
6c7b19b to
8e1d366
Compare
1deb731 to
40142a7
Compare
40142a7 to
ccdf38a
Compare
ccdf38a to
6507311
Compare
6507311 to
34c7a71
Compare
34c7a71 to
bfde425
Compare
bfde425 to
a107f9e
Compare
75bfe37 to
c4a2b02
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review I reran the exact API baseline acceptance check from the review finding on the current head |
c4a2b02 to
d935c4f
Compare
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Clockwork Clawlet Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d935c4f to
2103b10
Compare
2103b10 to
7005d9f
Compare
|
@clawsweeper hatch |
|
🦞👀 I queued a comment sync for this PR. If the egg is hatchable, ClawSweeper will generate the image once and update the existing review comment. |
|
Closing this for now to keep the AgentKit HITL host slice minimal. The revised path no longer needs chat.inject metadata/status cards: external verification renders through plugin approval prompts and the verified resolver. We can reopen or file a narrower follow-up if maintainers want durable status cards later. |
Review context
Concrete plugin: Guardiola31337/openclaw-agentkit. The intent is to keep World ID / AgentKit out of OpenClaw core while letting external HITL plugins use the existing approval flow end-to-end.
This PR's role: durable chat/status delivery with metadata and idempotency so external approval cards survive history/live events.
Bundle:
Trust boundary to review: should a plugin that already owns a pending approval be allowed to complete that specific approval after external verification, through a typed SDK/Gateway path with admin scope and ownership checks?
Summary
chat.injectaccept optionalidempotencyKey,command,interactive, andchannelDatafields.chat.historyand livechatevents.idempotencyKeyreplay at the serialized transcript append boundary so concurrent retries do not append or broadcast duplicate approval cards.injectChatMessageOverGatewayhelper throughopenclaw/plugin-sdk/gateway-runtimeso external plugins do not need a generic admin Gateway client.chat.historypersistence.Verification
pnpm protocol:checkpnpm plugin-sdk:api:checkpnpm build:plugin-sdk:strict-smokepnpm docs:listnode_modules/.bin/oxfmt --check src/config/sessions/transcript-append.ts src/gateway/server-methods/chat.ts src/gateway/server-methods/chat-transcript-inject.ts src/gateway/server-methods/chat.inject.parentid.test.ts src/gateway/server-methods/chat.directive-tags.test.ts src/gateway/operator-chat-client.ts src/gateway/operator-chat-client.test.ts src/plugin-sdk/gateway-runtime.ts src/gateway/client-callsites.guard.test.ts src/gateway/gateway.test.ts docs/gateway/protocol.md docs/plugins/sdk-migration.md docs/plugins/sdk-subpaths.mdnode scripts/run-vitest.mjs src/gateway/operator-chat-client.test.ts src/gateway/client-callsites.guard.test.ts --testTimeout 120000 --reporter dotnode scripts/run-vitest.mjs src/gateway/operator-chat-client.test.ts src/gateway/client-callsites.guard.test.ts src/gateway/server-methods/chat.directive-tags.test.ts src/gateway/server-methods/chat.inject.parentid.test.ts src/gateway/server-methods/server-methods.test.ts --testTimeout 120000 --reporter dotnode scripts/run-vitest.mjs src/gateway/gateway.test.ts --testNamePattern "preserves chat.inject metadata through live ws broadcast and chat.history" --testTimeout 120000 --reporter verbosegit diff --checkReal behavior proof
Behavior addressed:
chat.injectcan carry AgentKit-style approval/status metadata (idempotencyKey,command,interactive,channelData) through Gateway validation, transcript append, live WebSocketchatbroadcast, andchat.history, while same-key retries dedupe before any second append or live broadcast. External plugins can use the new narrow SDK helper instead of a generic admin Gateway client.Real environment tested: local OpenClaw checkout on macOS on May 16, 2026, with a real loopback Gateway server started from the test harness, token auth enabled, one admin WebSocket client issuing RPCs, and one separate watcher WebSocket client receiving live events.
Exact steps or command run after this patch: started the loopback Gateway, created a dashboard session through
sessions.create, sentchat.injectwith AgentKit-shapedinteractiveandchannelData, replayed the same request with the sameidempotencyKey, asserted the second response was{ ok: true, deduped: true }, asserted the watcher saw exactly one livechatevent carrying the metadata, queriedchat.history, and asserted the persisted history message carried the same metadata.Evidence after fix:
Additional focused proof:
Observed result after fix: live Gateway behavior now demonstrates the end-to-end host seam this PR owns: metadata-bearing plugin approval/status cards are accepted over the admin RPC, delivered once over WebSocket, durable through
chat.history, and safely idempotent on retry. The public plugin SDK exposes a focusedinjectChatMessageOverGatewayhelper for external ClawHub plugins to call this path.What was not tested: full release suite and live World ID credential verification against production AgentKit services; this PR verifies the generic OpenClaw host API contract that the external ClawHub plugin needs. The full AgentKit HITL stack also depends on #82431 for plugin approval action/no-route pending metadata and #82434 for plugin-owned verified approval resolution.
Refs #82336.
External plugin integration proof
Behavior addressed: the external ClawHub AgentKit plugin can consume the combined temporary OpenClaw host API branch that includes this PR's durable
chat.injectmetadata and narrow chat injection helper.Real environment tested: GitHub Actions in
Guardiola31337/openclaw-agentkiton May 16, 2026, checking outGuardiola31337/openclaw@agentkit/external-plugin-host-apisand linking it into the external plugin package.Exact steps or command run after this patch: the remote workflow checked out the temporary OpenClaw host branch, installed with frozen lockfiles, ran
pnpm build gatewayWatch, ranpnpm build:plugin-sdk:strict-smoke, linked the host checkout into the AgentKit plugin, then ranpnpm test:hitlandpnpm pack:check.Evidence after fix:
Observed result after fix: the external plugin builds against the split OpenClaw host APIs, uses the narrow
injectChatMessageOverGatewayhelper instead of a generic admin client, the AgentKit HITL proof passes, and the package dry-run includes the expected ClawHub plugin artifact.What was not tested: production World ID credential verification. This remote proof exercises the integrated temporary host branch because the external plugin requires this PR together with #82431 and #82434 for the full HITL path.