Repository navigation
refactor(config): deslop config - #158295
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: blocked before merge. Reviewed September 25, 2026, 9:36 PM ET / September 26, 2026, 01:36 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch consolidates configuration validation, writes, migrations, audit, and redaction helpers, and makes malformed MCP OAuth metadata URLs return field validation errors. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. The malformed-URL failure remains on current main, and this branch is a useful landing candidate with credible compatibility evidence. I found no discrete introduced defect. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw loads configuration files and environment values, resolves includes and migrations, then validates the result for the Gateway and plugins. Config writes and recovery also produce audit records and redacted diagnostics. flowchart LR
A[Config files and environment] --> B[Includes and migrations]
B --> C[Schema validation]
C --> D[Config snapshot and writes]
D --> E[Gateway and plugins]
D --> F[Audit and redacted diagnostics]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -562, Tests -24, Other -4. Total -590 across 58 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one owner for each config transformation while retaining current-main include-read diagnostics, structured MCP URL errors, and existing upgrade behavior. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source gives a high-confidence malformed MCP metadata URL path through config validation, and the PR tests that entrypoint. This review did not execute the path. Is this the best way to solve the issue? Yes. Nullable URL parsing repairs the throwing refinement at its schema owner, while the broader substitutions reuse existing config owners; the recorded generation and upgrade checks support compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5be36d37cb73. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
Reuse canonical normalization and schema helpers, remove redundant forwarding and compatibility paths, and preserve generated config artifacts. Return structured validation diagnostics for malformed MCP OAuth metadata URLs.
dc68d10 to
928faf4
Compare
|
@clawsweeper re-review The requested published-updater compatibility proof is complete for the unchanged head The evidence explicitly separates the base cell’s later synthetic restart fixture and the unavailable legacy post-core receipt. Please review the updated proof; this is a review-only request, with no merge requested. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
Reuse canonical normalization and schema helpers, remove redundant forwarding and compatibility paths, and preserve generated config artifacts. Return structured validation diagnostics for malformed MCP OAuth metadata URLs.
What Problem This Solves
Maintainer-requested second pass over config: runtime helpers still duplicate canonical coercion, validation, and type owners and retain forwarding layers with no independent contract. Related: #157146.
User Impact
Malformed MCP OAuth client metadata URLs now produce field validation errors instead of escaping as
TypeError: Invalid URL. The cleanup preserves config options, defaults, schema output, normal validation messages, include/write behavior, environment-token semantics, and migrations.Why This Change Was Made
This removes 562 net production lines across 55 config files, reusing existing owners while preserving ordering and public interfaces. All 307 non-session production files were read. The result is below the 1,000-line target; the required coverage log for every production file over 200 lines is included below.
Simplifications and rationale
Fixes found along the way
The MCP URL refinement used throwing URL construction after a non-aborting Zod format check. The existing test accepted any thrown error, masking the crash. The strengthened test reproduces the original
ERR_INVALID_URLthroughvalidateConfigObjectRaw; non-throwing parsing now returns the existing HTTPS/non-root field diagnostic for malformed input.Compatibility assessment
Reviewed against the lane's hard contracts: this patch adds/removes no config option, changes no default or stored schema, and preserves serialized schema/docs, include/merge/write semantics, env-token grammar, SecretRefs, and existing migration outcomes. Canonical helpers replace equivalent local code; config metadata stamping and audit records retain their existing owners and stored shapes. Existing installations need no new operator action for this refactor. Malformed MCP metadata URLs intentionally gain the existing structured field diagnostic instead of an uncaught URL exception.
The complete source checks, byte comparisons, consumer tests, and published-updater compatibility cells below support that assessment. The exact-head ClawSweeper re-review accepted the compatibility proof as sufficient and found no actionable code or security defect; its remaining generic compatibility checklist is addressed by this assessment.
Evidence
openclaw/ci-gatesucceeded. Independent review is clean through P2; the rebase is patch-identical.pnpm buildpassed (765 s), including declarations, SDK exports, UI, and metadata.pnpm plugin-sdk:check-exportsandpnpm plugin-sdk:surface:checkpassed. The final candidate runtime also built successfully on the refreshed base.pnpm config:schema:gen,pnpm config:docs:gen, andpnpm config:channels:gen: zero generated-file changes. Raw Zod JSON, schema metadata (excludinggeneratedAt), and all six doc artifacts match the refreshed clean base byte for byte.pnpm test src/config/schema.test.ts --maxWorkers=1passed 69 tests in 15.820 s wall;pnpm test src/config/io.audit.test.ts --maxWorkers=1passed 36 tests in 14.976 s wall. Hosted CI reported 1 ms for the MCP URL regression case and 1.656 s aggregate case time for the 36 audit cases. These case timings exclude file startup overhead.node scripts/check-changed.mjs --base origin/mainpassed on the refreshed base, including all guards, production/test typechecks, lint, and exact final source hashes. Credentialed live-provider tests were not run; no external provider contract changed.[email protected]drove exact candidate928faf4bf933e7c17d678ad27d7d2b852fc122c4throughbase(541 s) andlegacy-operator-state(393 s), serially against one tarball. Both succeeded on their first test attempts. The latter reportedupdateOutcome=success,updateRecovery=null, andupdateRestartSource=baseline-update; config survival, authenticated Gateway replacement, health/readiness/RPC, clean Doctor, mock-provider turns, idempotence, and verified backup/restore passed. No live provider credentials were used.Published updater compatibility evidence
Candidate tarball SHA-256:
8d2cd1f9f8f7c469a02d4003d9175f632ba6acd8ea656bad3ecc5d93d99b4078. The source wrapper verified the PR commit and full tree; packaging and registry preparation ran from a clean Git checkout at that exact commit.The
basescenario passedcandidate-package-identity,installed-package-identity, automatic migration, post-Doctor config validation, state survival, and Gateway probes. Its additional restart exercise deliberately uses a candidate-to-future fixture (2026.9.99-first-hop.0); that is separate from the initial published-driver-to-candidate payload verification.The
legacy-operator-statescenario used the published driver's own restart (baseline-update,auto-auth). It preserved the baseline-authored config and structured env SecretRefs, agent/approval/job/workspace state, plugin intent, and mock-provider behavior. First-hop automatic-migration assertions ran before standalone Doctor. The published driver's separate post-core receipt is unavailable, which remains recorded as such; no receipt is inferred from a passed scenario.Backup verification passed with archive SHA-256
874b436db1583ed35ac5d2cab367bbaad0c674ebf88cda798dd37879ee8636f2, verified raw transcript restoration, exact restored-agent preflight, and retained baseline readability. The baseline state/agent schemas were 18/23 and the candidate schemas 19/23; those schema changes already belong to main and are not introduced by this PR.The installed scenarios use structured env SecretRefs; authored
$includeand${VAR}syntax remain covered by the source config and consumer tests rather than these installed fixtures.Failure attribution and remote execution
The clean base reproduced exactly three Doctor missing-export failures and four guided-onboarding artifact-identity failures (30 other cases passed). Both are already owned by #157780. Applying its two fixture repairs only in the isolated Testbox checkout made the candidate pass all 37 cases; those fixture changes were then removed and are not part of this PR. Assertions and authority checks remained intact.
The first hosted CI hit 14 installer-fixture failures from its merge base. Main already fixed these in #158197 (
e8378618c9dc); the patch-identical rebase incorporates that fix and the new CI is green. The refreshed base also contains the earlier agents test-type shard rebalance (d07b710d852).All heavy commands ran through
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --id <lease> --timing-json -- OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 ..., with one command per lease and frozen-lockfile installation on fresh leases. Consumer selections usednode scripts/run-vitest.mjs; each selected file came from changed-export importer searches. The final three batches completed in 798.48 s (including a required runtime build), 309.37 s, and 273.43 s.blacksmith-testboxtbx_01m3cmmgcd8hdefv2pehqestewblacksmith-testboxtbx_01m3ctex88mzj348h3yvh81v0nblacksmith-testboxtbx_01m3d1nmjjtrx9j0ch8w8ncrszblacksmith-testboxtbx_01m3d2v2t7cmk7k2v267cffcggblacksmith-testboxtbx_01m3dajja1vpdzw3t7pymrr6pdblacksmith-testboxtbx_01m3dh5zkv9keqhvdmzwr060xwCoverage: all 76 production files over 200 lines, sorted by baseline size
src/config/io.write-prepare.tssrc/config/mutate.tssrc/config/zod-schema.core.tssrc/config/zod-schema.agent-runtime.tssrc/config/schema.labels.tssrc/config/config-env-vars.tssrc/config/doc-baseline.tssrc/config/runtime-snapshot.tssrc/config/io.write-safety.tssrc/config/io.observe-recovery.tssrc/config/io.snapshot.tssrc/config/env-preserve.tssrc/config/io.write.tssrc/config/redact-snapshot.tssrc/config/schema.help.runtime.tssrc/config/channel-compat-normalization.tssrc/config/io.audit.tssrc/config/validation-plugin-rules.tssrc/config/plugin-auto-enable.shared.tssrc/config/includes.tssrc/config/zod-schema.root-shape.tssrc/config/defaults.tssrc/config/zod-schema.gateway.tssrc/config/io.runtime.tssrc/config/schema.tssrc/config/validation-core.tssrc/config/io.context.tssrc/config/paths.tssrc/config/validation-plugin-config.tssrc/config/schema.lookup.tssrc/config/channel-config-metadata.tssrc/config/mcp-config.tssrc/config/schema.help.core.tssrc/config/plugin-auto-enable.materialize.tssrc/config/schema.tiers.tssrc/config/issue-location.tssrc/config/schema.help.automation.tssrc/config/types.discord.tssrc/config/io.load.tssrc/config/zod-schema.root-support.tssrc/config/io.clobber-snapshot.tssrc/config/codex-plugin-diagnostics.tssrc/config/io.health-state.tssrc/config/io.plugin-metadata.tssrc/config/validation-issues.tssrc/config/env-substitution.tssrc/config/talk.tssrc/config/mutate.include-io.tssrc/config/zod-schema.agent-defaults-base.tssrc/config/io.read-helpers.tssrc/config/config-journal-snapshot.tssrc/config/docs-config-examples.tssrc/config/types.secrets.tssrc/config/tools-by-sender.tssrc/config/resolution-facts.tssrc/config/utility-model-separation-migration.tssrc/config/zod-schema.channel-messaging-common.tssrc/config/schema.help.models.tssrc/config/model-provider-config.tssrc/config/io.write-topology.tssrc/config/schema.help.agents.tssrc/config/types.telegram.tssrc/config/channel-doctor-helpers.tssrc/config/channel-alias-migration.tssrc/config/schema.hints.tssrc/config/types.openclaw.tssrc/config/validation.tssrc/config/io.runtime-write-finalization.tssrc/config/validation-channel-rules.tssrc/config/group-policy.tssrc/config/io.observe.tssrc/config/include-write-boundary.tssrc/config/merge-patch.tssrc/config/legacy.roster.tssrc/config/plugin-auto-enable.apply.tssrc/config/write-lock.ts