Skip to content

fix(plugins): validate pattern-based and conditional config schemas - #109569

Merged
steipete merged 3 commits into
openclaw:mainfrom
zhanxingxin1998:fix/plugin-config-empty-schema-keywords
Jul 29, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
zhanxingxin1998:fix/plugin-config-empty-schema-keywords

Conversation

@zhanxingxin1998

@zhanxingxin1998 zhanxingxin1998 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where plugin config schemas with an empty explicit properties map were classified as empty even when patternProperties, dependentSchemas, or an active if plus then/else conditional imposed real validation rules. Valid pattern-keyed plugin configuration could therefore be rejected as “config must be empty,” while active conditional constraints could be skipped.

Why This Change Was Made

The empty-schema shortcut now recognizes pattern and dependency constraints and only treats conditionals as active when if is paired with then or else. Standalone if, then, and else remain on the empty-config path because JSON Schema gives them no independent validation effect.

The implementation was checked against the repository's actual validator dependency, TypeBox 1.3.3: its coverage table and compiler source support patternProperties, dependentSchemas, and if/then/else, and its conditional engine defaults missing branches to true.

User Impact

Plugin authors can use pattern-keyed and active conditional config schemas without the loader incorrectly requiring an empty config. Semantically inactive standalone conditional keywords do not bypass the empty-config guard.

Evidence

Exact PR head ad9481fcfc88711b8cc352bd9a9377044b94827f, directly invoking the production validatePluginConfig integration path:

pattern-valid: {"ok":true,"value":{"S_SETTING":"configured"}}
pattern-invalid: {"ok":false,"error":["S_SETTING: must be string"]}
active-then: {"ok":false,"error":["<root>: must match \"then\" schema"]}
standalone-if: {"ok":false,"error":["<root>: config must be empty"]}
standalone-then: {"ok":false,"error":["<root>: config must be empty"]}
standalone-else: {"ok":false,"error":["<root>: config must be empty"]}
exact_head=ad9481fcfc88711b8cc352bd9a9377044b94827f

Focused loader regression test:

$ node scripts/run-vitest.mjs src/plugins/loader-shared.test.ts
Test Files  1 passed (1)
Tests       7 passed (7)

Additional checks:

$ ./node_modules/.bin/oxfmt --check src/plugins/loader-shared.ts src/plugins/loader-shared.test.ts
All matched files use the correct format.

$ ./node_modules/.bin/oxlint src/plugins/loader-shared.test.ts
# no output

$ git diff --check
# no output

Fresh autoreview was attempted before commit, but the engine failed before producing findings because the Responses WebSocket returned HTTP 403. No autoreview-clean claim is made.

AI-assisted: yes. I reviewed the complete empty-schema decision, both loader callers, the production schema validator, and TypeBox's direct dependency contract.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 1:41 AM ET / 05:41 UTC.

Summary
Routes plugin schemas using patternProperties, dependentSchemas, or an active if with then/else through the normal JSON Schema validator and adds loader-level regression tests.

PR surface: Source +4, Tests +78. Total +82 across 2 files.

Reproducibility: yes. —the pre-patch shortcut is clear in the shared loader, and the supplied exact-head production-path transcript demonstrates the affected pattern and conditional cases after the fix.

Review metrics: 1 noteworthy metric.

  • Empty-schema constraints recognized: 3 constraint families added. The shortcut now accounts for pattern rules, dependent schemas, and active conditionals that can make an otherwise property-empty schema semantically non-empty.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Confirm the intended compatibility transition from empty-config rejection to normal validator behavior.

Risk before merge

  • [P1] This intentionally changes existing plugin-schema handling: schemas that previously failed with config must be empty can now receive normal TypeBox validation and default application, so maintainers should confirm that compatibility outcome is desired before merge.

Maintainer options:

  1. Accept the validator-routing compatibility change (recommended)
    Merge after confirming that constrained schemas should now use normal validation instead of the historical empty-config rejection.
  2. Pause for a narrower compatibility policy
    Hold the PR only if maintainers want a documented exception for an existing shipped plugin-schema contract.

Next step before merge

  • [P2] No mechanical repair is indicated; the remaining action is a maintainer merge review of the intentional compatibility behavior.

Security
Cleared: The two-file patch only changes local schema classification and tests; it adds no dependency, permission, secret, workflow, artifact, or code-execution surface.

Review details

Best possible solution:

Merge the focused shared-loader correction once an owner accepts the intended upgrade semantics for constrained plugin configuration schemas.

Do we have a high-confidence way to reproduce the issue?

Yes—the pre-patch shortcut is clear in the shared loader, and the supplied exact-head production-path transcript demonstrates the affected pattern and conditional cases after the fix.

Is this the best way to solve the issue?

Yes—the shared empty-schema classifier is the narrowest maintainable boundary because both loader callers already converge on validatePluginConfig and the normal validator owns JSON Schema semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 893196483d22.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded plugin configuration-validation bug with limited but real impact on plugin authors using constrained JSON Schema.
  • merge-risk: 🚨 compatibility: Existing schemas move from a fixed empty-config rejection to full validator behavior, which can change upgrade-time validation outcomes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides exact-head, production-path validatePluginConfig output covering the changed behavior and the preserved standalone-keyword behavior, supplemented by focused tests and checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head, production-path validatePluginConfig output covering the changed behavior and the preserved standalone-keyword behavior, supplemented by focused tests and checks.
Evidence reviewed

PR surface:

Source +4, Tests +78. Total +82 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 78 0 +78
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 83 1 +82

What I checked:

  • Changed empty-schema decision: The branch adds dependentSchemas, patternProperties, and semantically active conditionals to the conditions that prevent the empty-config shortcut, while retaining standalone conditional keywords on that shortcut. (src/plugins/loader-shared.ts:240, ad9481fcfc88)
  • Regression coverage: The added loader test exercises valid and invalid pattern properties, dependent schemas, active then/else branches, and standalone conditional keywords through validatePluginConfig. (src/plugins/loader-shared.test.ts:10, ad9481fcfc88)
  • Validator boundary: The normal path delegates plugin configuration checks to the TypeBox-based JSON Schema validator, so bypassing the empty shortcut is the narrow shared-loader fix rather than a plugin-specific workaround. (src/plugins/schema-validator.ts:1, 893196483d22)
  • After-fix behavior and focused validation: The PR body records exact-head production-path output for valid/invalid pattern values and active/standalone conditionals, plus a passing 7-test focused loader suite and targeted format/lint checks; the supplied check digest also reports the applicable CI lanes successful. (src/plugins/loader-shared.test.ts:10, ad9481fcfc88)

Likely related people:

  • steipete: Likely routing candidate for the plugin loader and shared configuration-validation area; direct local history inspection was unavailable in this read-only execution environment, so this is deliberately low confidence. (role: adjacent owner; confidence: low; files: src/plugins/loader-shared.ts, src/plugins/schema-validator.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (5 earlier review cycles)
  • reviewed 2026-07-17T03:07:07.527Z sha f2b10568fb6061c6e869b4bb92b761762e835648 :: needs real behavior proof before merge. :: [P2] Gate conditional keywords by their JSON Schema semantics
  • reviewed 2026-07-18T05:01:23.334Z sha e0c3d4f5c693463367aec73e8cbe3c478198ebe1 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T05:18:57.560Z sha 5b0e801a35f614d6a3007ece6ef215a07c2a5461 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T05:28:30.153Z sha ad9481f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-18T05:33:58.710Z sha ad9481f :: needs maintainer review before merge. :: none

@zhanxingxin1998
zhanxingxin1998 force-pushed the fix/plugin-config-empty-schema-keywords branch from f2b1056 to e0c3d4f Compare July 18, 2026 04:58
@zhanxingxin1998 zhanxingxin1998 changed the title fix(plugins): recognise patternProperties, dependentSchemas, and if/then/else in empty schema checks fix(plugins): validate pattern-based and conditional config schemas Jul 18, 2026
@zhanxingxin1998

Copy link
Copy Markdown
Contributor Author

Addressed the conditional-semantics finding, added loader-level regression coverage, rebuilt on current main, and added exact-head validatePluginConfig output to the PR body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 18, 2026
@zhanxingxin1998

Copy link
Copy Markdown
Contributor Author

Fixed the exact-head Oxlint failure (unicorn/no-thenable) without disabling the rule, refreshed the runtime proof for 5b0e801a35f614d6a3007ece6ef215a07c2a5461, and reran the focused test and targeted lint.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 18, 2026
Route pattern, dependency, and active conditional schemas through the real plugin config validator while keeping standalone conditional annotations on the empty-config path.

Co-Authored-By: Claude <[email protected]>
@zhanxingxin1998
zhanxingxin1998 force-pushed the fix/plugin-config-empty-schema-keywords branch from 5b0e801 to ad9481f Compare July 18, 2026 05:26
@zhanxingxin1998

Copy link
Copy Markdown
Contributor Author

Rebuilt the lint-clean patch on latest main and refreshed the exact-head production validation proof for ad9481fcfc88711b8cc352bd9a9377044b94827f. Targeted Oxlint remains clean and the focused loader suite passes 7/7.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@zhanxingxin1998

Copy link
Copy Markdown
Contributor Author

The PR body now references only the current exact head ad9481fcfc88711b8cc352bd9a9377044b94827f; the previous-head SHA cited by the last review is no longer present. The production-path output, targeted Oxlint, and 7/7 focused test were rerun after the force-push.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 18, 2026
@steipete
steipete merged commit 943ebc0 into openclaw:main Jul 29, 2026
120 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit to yetval/openclaw that referenced this pull request Jul 29, 2026
* origin/main:
  fix: CJK replies are silently dropped instead of recovered when the model skips message(action=send) (openclaw#115556)
  fix(gateway): stop managed crash loops for pending agent DB migrations (openclaw#115631)
  fix(plugins): validate constrained empty config schemas (openclaw#109569)
  fix(cli-runner): scope bundle-MCP cleanup to the run's session, not the process-wide loopback server (openclaw#110251)
  fix(feishu): log message content JSON parse failures instead of silently swallowing (openclaw#107947)
  docs(vision,agents): layer calibration, interface-on-demand, telemetry opt-in, whole-document guidance rules
pull Bot pushed a commit to yann0001/openclaw that referenced this pull request Jul 29, 2026
* origin/main:
  fix: CJK replies are silently dropped instead of recovered when the model skips message(action=send) (openclaw#115556)
  fix(gateway): stop managed crash loops for pending agent DB migrations (openclaw#115631)
  fix(plugins): validate constrained empty config schemas (openclaw#109569)
  fix(cli-runner): scope bundle-MCP cleanup to the run's session, not the process-wide loopback server (openclaw#110251)
  fix(feishu): log message content JSON parse failures instead of silently swallowing (openclaw#107947)
  docs(vision,agents): layer calibration, interface-on-demand, telemetry opt-in, whole-document guidance rules
  fix(memory): preserve Windows session ownership (openclaw#115851)
  fix(compaction): drop context-engine fallback on codex ownership skip (openclaw#114155) (openclaw#115666)
  fix(msteams): ignore blank certificate settings (openclaw#109112)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
)

Route pattern, dependency, and active conditional schemas through the real plugin config validator while keeping standalone conditional annotations on the empty-config path.

Co-authored-by: Claude <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
* origin/main:
  fix: CJK replies are silently dropped instead of recovered when the model skips message(action=send) (openclaw#115556)
  fix(gateway): stop managed crash loops for pending agent DB migrations (openclaw#115631)
  fix(plugins): validate constrained empty config schemas (openclaw#109569)
  fix(cli-runner): scope bundle-MCP cleanup to the run's session, not the process-wide loopback server (openclaw#110251)
  fix(feishu): log message content JSON parse failures instead of silently swallowing (openclaw#107947)
  docs(vision,agents): layer calibration, interface-on-demand, telemetry opt-in, whole-document guidance rules
  fix(memory): preserve Windows session ownership (openclaw#115851)
  fix(compaction): drop context-engine fallback on codex ownership skip (openclaw#114155) (openclaw#115666)
  fix(msteams): ignore blank certificate settings (openclaw#109112)
obviyus pushed a commit to harjothkhara/openclaw that referenced this pull request Aug 29, 2026
…t validation

Two paths reached an unusable manifest schema before validateManifestSchemaValue
could turn it into a diagnostic, so the isolation added earlier in this PR never
ran for them.

channel-config-metadata.ts owns the first handling of a non-bundled channel
schema. collectChannelSchemaMetadataWithOwnership prepares every external
channelConfigs.*.schema in two steps that each deep-clone and recursively walk it:
normalizeCoreOwnedChannelSchema, and widenOfficialExternalChannelSecretSchema for
official external channels with a secret contract or host schema overlay (qqbot).
A deeply nested schema overflows the stack in either step, inside the
ensureChannelSchemas() metadata pass, before any validator sees it. Both steps now
live behind one containment point, prepareChannelConfigSchema: preparation is
best-effort, so an unpreparable schema is surfaced raw and
validateManifestSchemaValue stays the single owner of the diagnostic. This also
covers collectChannelSchemaMetadataCore, the docs/UI reader of the same producer.

RED (pre-fix, both channels, and the qqbot case also fails against a
normalization-only containment — the escape codex review caught):
  feishu: RangeError: Maximum call stack size exceeded
   at normalizeCoreOwnedChannelSchema src/config/channel-config-metadata.ts:44:22
   at collectChannelSchemaMetadataWithOwnership .../channel-config-metadata.ts:203
   at ensureChannelSchemas src/config/validation.ts:350:27
   at validateConfigObjectWithPluginsBase src/config/validation.ts:622:29
  qqbot:  RangeError: Maximum call stack size exceeded
   at cloneSchema src/config/schema.shared.ts:20:10
   at widenOfficialExternalChannelSecretSchema .../official-external-channel-secret-schema.ts:52
   at collectChannelSchemaMetadataWithOwnership .../channel-config-metadata.ts:212:28

loader-shared.ts answered from isEmptyPluginConfigJsonSchema's shortcut before
compiling the schema at all, and that shortcut gated on a denylist of constraining
keywords. Anything the denylist had not enumerated — an unresolvable $ref, an
unknown keyword — was accepted as an empty config with no diagnostic. The
shortcut is only sound for schemas built purely from keywords it accounts for, so
the denylist is replaced with an allowlist; everything else falls through to
validateManifestSchemaValue.

RED (pre-fix):
  expected { ok: true, value: {} } to match object { ok: false }

Both regressions were verified RED against stashed production files and GREEN
after. The standalone-conditional case from openclaw#109569 keeps its invariant (a closed
empty schema stays closed) but now gets its rejection from validation rather than
the shortcut, so it no longer pins the shortcut's message.

Production delta for this commit: +43/-21 across two files, of which 8 lines are
invariant comments; the empty-config allowlist is net-neutral against the
denylist it replaces.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants