Repository navigation
refactor(plugin-sdk): promote shared runtime primitives - #126193
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
4762e00 to
8ebe631
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 3:35 AM ET / 07:35 UTC. ClawSweeper reviewWhat this changesThis PR exposes existing path, UTF-8, chunking, and record-coercion primitives through focused Plugin SDK facades and replaces duplicated bundled-plugin implementations. Merge readinessKeep open. The central SDK refactor is not on current main, and source-level review found no blocking patch defect; the maintainer-owned PR needs its exact-head merge/CI refresh before landing. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherBundled plugins use focused Plugin SDK runtime facades instead of importing core internals or maintaining local copies. The shared helpers then govern path containment, text boundaries, and input coercion before plugins interact with files, channels, or providers. flowchart LR
A[Bundled plugin inputs] --> B[Plugin runtime code]
B --> C[Focused Plugin SDK facades]
C --> D[Shared path text and coercion helpers]
D --> E[Plugin file channel and provider actions]
E --> F[Operator-visible behavior]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -244, Tests +1, Docs 0, Other -3. Total -246 across 48 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase or refresh onto current main so the already-landed test registration drops out, retain the canonical shared-helper migration, and land only after exact-head SDK and plugin validation is green. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing internal behavior rather than reporting a user-facing defect. Is this the best way to solve the issue? Yes. Focused SDK facades reuse canonical helpers and remove duplicated implementations while preserving each caller's established containment and boundary semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a4b265aa9b70. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
7e04ef9 to
f4ee343
Compare
e889222 to
a62644a
Compare
|
Land-ready proof for
The latest completed ClawSweeper review reported no findings. Its only rank-up move was a current-main refresh plus exact-head required CI; both are satisfied. A newer exact-head review refresh is still running, but repository policy does not require waiting for that publisher after the reviewed moves and exact-head CI are complete. Production +160/-404 (net -244); test support +0/-2; docs +2/-2; shrink-only ratchets +6/-9. No user-visible behavior or live-provider boundary changed. |
|
Merged via squash.
|
What Problem This Solves
Bundled plugins had accumulated local copies of four already-owned primitives: path containment, UTF-8 prefix truncation, fixed-size chunking, and object-record guards. Those copies made small semantic fixes easy to miss across sibling plugins and encouraged new imports from the deprecated broad security runtime.
Why This Change Was Made
This promotes inclusive and strict-child containment through
openclaw/plugin-sdk/file-access-runtime, promotestruncateUtf8Prefixthroughtext-utility-runtime, and migrates the requested bundled plugin adopters to those focused SDK seams plus the existing chunking and record-coercion helpers.Existing realpath checks and inclusive-versus-strict containment decisions remain at their original call sites. Object-backed array semantics remain where they previously existed. Codex/OpenShell virtual sandbox namespaces, the embedded Codex remote reader script, and Browser Relay's duplicate-key-aware strict JSON parser remain local because their contracts are intentionally different.
Migration inventory
asOptionalObjectRecordwhere arrays were historically acceptedThe cleanup also made
extensions/memory-wiki/src/markdown.tssmall enough to remove its grandfathered max-lines suppression.During exact-head CI, the freshly merged #126179 QA scenario failed twice because it required wire
status=failedfor a task whose authoritative domain state is internalsucceeded(wirecompleted) plusterminalOutcome=blocked; delivery is independentlydelivered. Current main repaired that stale assertion in #125954. This branch was rebased onto that fix, so no unrelated QA change remains in this PR.The next exact-head run exposed one current-main test-inventory gap:
extensions/codex/src/app-server/run-attempt-tools.test.tswas not owned by any Vitest project. Three independent repairs then landed on main within minutes and claimed it in the attempt-light, attempt-extra, and app-server-tools shards. This PR rebased across that sequential registration race by retaining the focused attempt-light owner and deleting the two duplicate claims; #126236 subsequently landed the same single-owner result on main, so the cleanup is patch-equivalent in the final merge tree. It does not add or change product behavior.User Impact
No user-visible behavior changes. Plugin maintainers get focused SDK imports with one canonical implementation, and the production diff removes 244 net lines.
Evidence
pnpm plugin-sdk:surface:check— passed; all 333 SDK entrypoints and 146 public package subpaths verified.pnpm test extensions/acpx extensions/anthropic extensions/browser extensions/buzz extensions/canvas extensions/codex extensions/feishu extensions/file-transfer extensions/google extensions/lobster extensions/mattermost extensions/memory-core extensions/memory-wiki extensions/migrate-hermes extensions/mxc extensions/qa-lab extensions/slack extensions/telegram extensions/voice-call extensions/whatsapp— 97/98 shards passed on the first loaded-host run; the sole unrelated Telegram timing failure passed its exact rerun (3/3 tests).pnpm check:changed— passed on the final diff. The first run correctly identified stale shrink-only assertion/max-lines baseline entries, which were pruned before the clean rerun.node scripts/run-vitest.mjs test/vitest-projects-config.test.ts extensions/codex/src/app-server/run-attempt-tools.test.ts— 2 files / 21 tests passed (18 inventory ownership tests and 3 Codex tool tests).pnpm build— passed in 7m29.8s, including all public SDK subpaths, external plugin local dists, runtime postbuild, and Control UI.pnpm docs:check-mdx && pnpm docs:check-links— passed (778 docs files; 6,510 internal links; 0 broken)..agents/skills/autoreview/scripts/autoreview --mode local ...— clean; no accepted/actionable findings.openai/codex:codex-rs/app-server-protocol/src/protocol/v2/thread.rs:57,:325,:509;codex-rs/app-server/src/bespoke_event_handling.rs:720,:991,:1211;codex-rs/protocol/src/plan_tool.rs:17;codex-rs/protocol/src/user_input.rs:15.QA Smoke CI (profile 3/6)twice on the stale fix(agents): record empty subagent completion delivery #126179 task-status assertion; all other checks passed. The exact scenario then passed locally withtaskStatus=completed,taskTerminalOutcome=blocked,taskDeliveryStatus=delivered, one visible representation, and zero restart replay; current main landed the same correction in fix(build): rebuild incomplete managed-update cache hits #125954.checks-node-compact-large-22, whose inventory guard found the unowned Codex attempt-tools test. The focused 21-test proof above passes after registering it in the existing light shard.checks-node-compact-large-22. On current main,test/vitest-projects-config.test.tsfailed with the exact duplicate owner list; after retaining only attempt-light, the same 18 ownership tests plus the 3 Codex tool tests passed.node scripts/run-vitest.mjs extensions/qa-lab/src/scenario-catalog-channels.test.ts extensions/qa-lab/src/scenario-catalog.test.ts— 2 files / 74 tests passed.alllane before fix(build): rebuild incomplete managed-update cache hits #125954 superseded it; the final SDK-only current-basepnpm check:changedrerun also passed.Production LOC: +160/-404 (net -244) | Tests/test support: +0/-2 | Docs: +2/-2 | Ratchet maintenance: +6/-9
AI-assisted; the implementation, source contracts, diff, and proof were reviewed directly.