Repository navigation
fix(plugins): accept JSON5 manifests in build and validation - #190192
Conversation
Use the existing compatibility parser for native authoring reads while package metadata remains strict JSON. Reuse the already-read package object in check mode. Co-authored-by: 史启明(QimingShi) <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Select JSON5 in the shared authoring reader and remove the unnecessary parser callback interface. Reuse the authored manifest and already-read package metadata for checks, keeping production LOC unchanged overall. Co-authored-by: 史启明(QimingShi) <[email protected]>
|
@clawsweeper review Final head: 3f29b21. Native manifest JSON5 regressions are red on main and green here; 46 focused tests, targeted types/lint/format, and full-context local AutoReview pass. This supersedes the initial callback interface and keeps production LOC at net zero. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThe PR accepts JSON5 native manifests during plugin build and validation while keeping package.json strict JSON. Example: A plugin's openclaw.plugin.json contains an unquoted id, a comment, and a trailing comma.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a current mismatch with the documented manifest format, with no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherPlugin authoring commands read package metadata, native manifests, and entry-point declarations, then validate their agreement or publish generated metadata. flowchart TD
A[Plugin authoring CLI] --> B[Shared metadata reader]
B --> C[Strict package JSON]
B --> D[Native manifest JSON5 fallback]
C --> E[Authoring metadata owner]
D --> E
E --> F[Validation or generated metadata]
Technical reviewBest possible solution: Use the existing JSON5 compatibility parser for native authoring reads while preserving strict package parsing and the existing metadata writer. Do we have a high-confidence way to reproduce the issue? Current main's strict native-manifest rereads directly explain the reported failures; the PR reports matching red-on-base regressions, but this read-only review ran no target code. Is this the best way to solve the issue? The patch is a small, complete repair: it reuses the existing parser and reader, updates both affected callers, and preserves package strictness, file admission, encoding checks, and metadata ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5cdc3888aee0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +33, Other +2. Total +35 across 4 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 1, 2026, 4:26 AM ET / 09:26 UTC. |
|
Merged via squash.
|
…w#190192) Related: openclaw#59084 Supersedes openclaw#173178, thanks @KhanCold. ## What Problem This Solves Fixes: plugin build and validation reject valid native manifests containing comments, trailing commas, or unquoted keys. ## User Impact Plugin authors can use the documented JSON5 format in native manifests. Validation and build check mode preserve input bytes; ordinary builds preserve authored metadata. Package metadata still requires strict JSON, with the existing UTF-8 and regular-file checks retained. No migration or new setting is required. ## Why This Change Was Made Route both native-manifest rereads through the existing JSON5 compatibility parser using the shared authoring reader. Remove the duplicate package reread in check mode and compare the package object already used to generate the expected metadata. Production delta is +10/-10 (net zero): the shared reader selects the existing parser, and check mode drops its duplicate package reread. Tests grow by 33 lines by extending existing command coverage, with a scoped 33-line allocation for the JSON5 regressions and strict package metadata controls. No new parser or duplicated test fixture is introduced. ## Evidence - On current main `1f4d22031c73`, the same regression file fails exactly the three JSON5 cases (validate, build check, ordinary build); 27 other cases pass. Each failure reaches the native reread and reports malformed JSON. - With this fix, 46 focused tests pass across the authoring commands, malformed UTF-8/special-file rejection, validation diagnostics, and parser controls. Check and validation assert exact input preservation; ordinary build asserts authored UI hints survive. - Final focused test wrapper: 38.40 seconds across four files. The existing installation/bundling scenario dominates the command suite; the JSON5 cases take about 50 ms each. [Exact-head PR CI passed](https://github.com/openclaw/openclaw/actions/runs/41292821819) on `3f29b21b5912`: 33 non-skipped jobs, 3952 summed job-seconds (this run only; excludes separate workflows and the superseded head). - Targeted production/test type validation, typed oxlint, formatting, and whitespace checks pass. The optional local test-line ratchet did not finish within its 60-second host bound; its scoped allocation is included for CI validation. - Canonical Codex AutoReview, P0–P2, reviewed the final staged/working-tree candidate against `1f4d22031c73` with full relevant owner/test context: scoped clean, no actionable findings. Runtime proof comes from the focused tests; the reviewer did not execute tests. Local ClawSweeper is unavailable. The [exact hosted review](openclaw#190192 (comment)) completed on `3f29b21b5912` with no correctness or security findings; its disclosed built-CLI proof gap remains as stated below. - The contributor head was read through GitHub only and was never checked out, installed, built, or executed on this host. This is an independently implemented, credited replacement. Real filesystem and command-owner proof was run; a built CLI/Gateway was not run because this authoring path does not involve a model or channel and a full build belongs in broad CI. Co-authored-by: 史启明(QimingShi) <[email protected]>
fix(plugins): accept JSON5 manifests when building plugin Control UI assets A plugin whose manifest uses JSON5 (comments or trailing commas) and declares a Control UI browser entry failed `openclaw plugins build`, `plugins build --check` and `plugins validate`, because the browser-asset builder read the manifest with strict JSON.parse while the rest of the authoring path already accepts JSON5 (#190192). It now uses the existing authoring JSON reader. The repository helper script gets the same fix, loading the reader only in its build branch so `--copy` stays source-free. No new text. Evidence: isolated synthetic plugins; base via ocx src, candidate in a secretless node:24.22.1 container; twice each. JSON5 manifest with a browser entry: base failed build/check/validate (6 of 6 exit 1), candidate passed all six; builds recreated the browser assets and check/validate left the manifest bytes unchanged. Strict JSON, JSON5 without a browser entry and a truly invalid manifest behave the same on both, with the existing errors. The regression fails on base and passes here; the existing script tests, including source-free copy, pass; full build and packed smoke pass. Net 0 test lines. Details: #198808 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(plugins): accept JSON5 manifests when building plugin Control UI assets A plugin whose manifest uses JSON5 (comments or trailing commas) and declares a Control UI browser entry failed `openclaw plugins build`, `plugins build --check` and `plugins validate`, because the browser-asset builder read the manifest with strict JSON.parse while the rest of the authoring path already accepts JSON5 (openclaw#190192). It now uses the existing authoring JSON reader. The repository helper script gets the same fix, loading the reader only in its build branch so `--copy` stays source-free. No new text. Evidence: isolated synthetic plugins; base via ocx src, candidate in a secretless node:24.22.1 container; twice each. JSON5 manifest with a browser entry: base failed build/check/validate (6 of 6 exit 1), candidate passed all six; builds recreated the browser assets and check/validate left the manifest bytes unchanged. Strict JSON, JSON5 without a browser entry and a truly invalid manifest behave the same on both, with the existing errors. The regression fails on base and passes here; the existing script tests, including source-free copy, pass; full build and packed smoke pass. Net 0 test lines. Details: openclaw#198808 (comment). Thanks @Alix-007. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #59084
Supersedes #173178, thanks @KhanCold.
What Problem This Solves
Fixes: plugin build and validation reject valid native manifests containing comments, trailing commas, or unquoted keys.
User Impact
Plugin authors can use the documented JSON5 format in native manifests. Validation and build check mode preserve input bytes; ordinary builds preserve authored metadata. Package metadata still requires strict JSON, with the existing UTF-8 and regular-file checks retained. No migration or new setting is required.
Why This Change Was Made
Route both native-manifest rereads through the existing JSON5 compatibility parser using the shared authoring reader. Remove the duplicate package reread in check mode and compare the package object already used to generate the expected metadata.
Production delta is +10/-10 (net zero): the shared reader selects the existing parser, and check mode drops its duplicate package reread. Tests grow by 33 lines by extending existing command coverage, with a scoped 33-line allocation for the JSON5 regressions and strict package metadata controls. No new parser or duplicated test fixture is introduced.
Evidence
2423623c3461, the same regression file fails exactly the three JSON5 cases (validate, build check, ordinary build); 27 other cases pass. Each failure reaches the native reread and reports malformed JSON.3f29b21b5912: 33 non-skipped jobs, 3952 summed job-seconds (this run only; excludes separate workflows and the superseded head).2423623c3461with full relevant owner/test context: scoped clean, no actionable findings. Runtime proof comes from the focused tests; the reviewer did not execute tests. Local ClawSweeper is unavailable. The exact hosted review completed on3f29b21b5912with no correctness or security findings; its disclosed built-CLI proof gap remains as stated below.