Repository navigation
refactor(plugins): reuse SDK error coercion in seven callback owners - #119451
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 11:21 PM ET / August 5, 2026, 03:21 UTC. ClawSweeper reviewWhat this changesThe PR replaces seven bundled plugins’ duplicate thrown-value-to-Error helpers with the public Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep open: the seven substitutions preserve behavior exactly, but the refactor leaves at least two identical non-Codex production helpers, so it does not yet establish one canonical coercion path. The external-PR proof is also test/CI-only rather than after-fix runtime evidence. Priority: P3 Review scores
Verification
How this fits togetherBundled channel and provider plugins normalize arbitrary callback and lifecycle failures before passing them into transport shutdown, webhooks, agent streaming, and memory-provider cleanup. The Plugin SDK exposes this shared conversion without plugins importing core internals. flowchart LR
A[Callback or lifecycle failure] --> B[Bundled plugin]
B --> C[Plugin SDK error helper]
C --> D[Normalized Error]
D --> E[Channel or runtime outcome]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -90. Total -90 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Migrate the remaining identical production helpers to the existing SDK helper, then attach a redacted after-fix plugin runtime transcript or obtain a maintainer proof override. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving internal refactor, and direct source comparison establishes the relevant semantics. Is this the best way to solve the issue? No: the seven replacements are exact, but the best owner-boundary fix also removes the remaining identical non-Codex production copies through the same public SDK helper. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8caab5c3d3c. 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
|
|
Merged via squash.
|
What Problem This Solves
Seven bundled plugins independently implemented identical error-to-
Errorconversion, creating unnecessary maintenance overhead and allowing error handling to drift across ACPX, Copilot, Discord, LINE, memory, QA, and WhatsApp integrations.Why This Change Was Made
Reuse the existing public
openclaw/plugin-sdk/error-runtimetoErrorObjecthelper in all seven plugins and remove their byte-for-byte equivalent local conversion helpers. This preserves existingErroridentity, string conversion, structured causes, and copied error fields without adding dependencies, changing plugin boundaries, modifying configuration, or introducing compatibility paths.User Impact
No intended user-visible behavior change. Plugin failures continue to preserve their existing error details while production code decreases by 90 lines (+20/-110) across seven production files; no tests were changed.
Evidence
gpt-5.6-sol/xhighautoreview completed with no actionable findings.pnpm check:changedpassed, including plugin-boundary and SDK-contract checks, all production/full-tree/script dead-export scans, plugin and plugin-test typechecks, changed-file lint, repository architecture guards, and zero runtime import cycles.Named Follow-up
Update the stale WhatsApp credential-persistence test mocks: they assume string
fs.openflags while hydrated@openclaw/fs-safeuses numeric flags. The unrelated grouped failures were reproduced identically on clean HEAD; repair belongs to the WhatsApp filesystem-fixture owner and is intentionally not bundled into this production-only error-coercion refactor.Explicitly bounded seven-plugin callback scope
This change intentionally covers exactly seven SDK-capable, non-auth plugin callback/lifecycle owners: ACPX, Copilot, Discord, LINE, Memory Core, QA Channel, and WhatsApp. Every changed owner already uses public plugin-SDK entrypoints, so replacing its inline coercion copy introduces no new architectural dependency boundary.
Four independently owned production helpers remain explicitly out of scope:
These are intentional architectural/authorization scope exclusions, not overlooked migration targets. The related review finding is resolved by narrowing both the PR title and its claimed scope rather than expanding into authentication, approval, isolated-runtime, or separately exported QA ownership.
Exact-head bundled-plugin callback runtime proof
The unchanged exact reviewed Discord plugin gateway module was imported through its actual installed public SDK error, runtime-environment, and SSRF entrypoints. Its real waitForDiscordGatewayStop/registerForceStop production callback was invoked with synthetic in-memory gateway events; no real credentials, account, external service, or operator gateway was touched.
{ "head":"bcdf40f49d3e52346851274da087a5af03ae7a22", "productionPlugin":"extensions/discord/src/monitor.gateway.ts", "entrypoint":"waitForDiscordGatewayStop/registerForceStop", "publicPluginSdk":["openclaw/plugin-sdk/error-runtime","openclaw/plugin-sdk/runtime-env","openclaw/plugin-sdk/ssrf-runtime"], "observations":[ {"label":"error","message":"gateway stopped","sameIdentity":true,"causeIdentity":false,"code":"E_ORIGINAL","status":null,"disconnects":1,"detaches":1}, {"label":"string","message":"connection closed","sameIdentity":false,"causeIdentity":false,"code":null,"status":null,"disconnects":1,"detaches":1}, {"label":"structured","message":"Non-Error rejection","sameIdentity":false,"causeIdentity":true,"code":"E_DISCORD_GATEWAY","status":503,"disconnects":1,"detaches":1} ] }The actual canonical public SDK path preserves existing Error identity, string messages, structured cause/error metadata, and exactly-once disconnect/detach cleanup. Hosted exact-head CI and ci-gate passed after one unrelated retry of a known managed Git subprocess cleanup race. Named follow-up: investigate the independent live-updater managed fast-forward process-group teardown race without weakening process cleanup guarantees.
ClawSweeper rank-up disposition: the remaining-helper finding is explicitly addressed by the narrow seven-owner title/scope and documented owner-boundary exclusions; the requested real bundled-plugin runtime transcript is supplied above. The reviewed Git head is unchanged, so root policy requires no additional bot re-review.