Repository navigation
refactor(config): split write preparation primitives - #114228
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 26, 2026, 9:40 PM ET / July 27, 2026, 01:40 UTC. ClawSweeper reviewWhat this changesThis PR moves merge-patch generation, config-path mutation, changed-path reporting, environment-reference restoration, and write-error formatting out of the config write-preparation module into focused modules while updating their callers. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain Keep this PR open for maintainer review. Its focused helper extraction appears consistent with the stated behavior-neutral config-write refactor, but it touches compatibility-sensitive persistence paths, has one failed compact CI shard, and the submitted evidence is test/CI-only rather than an after-fix real config-write run. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s configuration write pipeline receives updates from CLI commands, gateway RPC, setup flows, and plugin management, then validates and persists the canonical config while preserving environment references and managed fields. This refactor separates reusable preparation steps from the write orchestrator without intending to change the persisted result. flowchart LR
A[CLI, gateway, setup, plugins] --> B[Config write pipeline]
B --> C[Merge patch and path mutation]
B --> D[Environment reference preservation]
B --> E[Validation error formatting]
C --> F[Validated config persistence]
D --> F
E --> G[Operator-facing failure output]
F --> H[Runtime and audit snapshots]
Decision needed
Why: The PR carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource +14, Tests -3. Total +11 across 19 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the refactor only after a maintainer confirms the failed CI shard is unrelated or fixed and the PR includes a redacted before/after real config-write proof showing preserved environment references, managed unsets, and validation behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor rather than a reported bug. The relevant verification is equivalence of real config-write behavior across existing CLI, gateway, setup, and plugin-management paths. Is this the best way to solve the issue? Unclear: extracting primitives to focused owners is a maintainable direction, but the available evidence does not yet prove the full real write path is behaviorally equivalent or explain the failed compact CI shard. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0ac926b8fb2a. 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
The config writer currently owns generic merge-patch, path-mutation, changed-path, environment-restoration, and error-formatting primitives. That makes the write-preparation module harder to reason about and blocks the approved config write-intent redesign.
Why This Change Was Made
This behavior-neutral first step moves each primitive to its natural owner while preserving the existing signatures and call behavior. It does not change config write semantics; it creates narrow ownership boundaries for the follow-up compatibility-sensitive work.
AI-assisted implementation; the maintainer-requested redesign is being delivered as a reviewed PR series.
User Impact
No user-visible behavior change. Config writes, validation text, environment reference preservation, managed unsets, and audit path reporting remain unchanged.
Evidence
tbx_01kygmhvxy5271c9bvv07pm8sw: starting from an authored${OC_TEST_WORKSPACE}workspace and gateway port18789,openclaw config set gateway.port 19001reportedUpdated gateway.port. Restart the gateway to apply.The persisted redacted result was{"gatewayPort":19001,"workspace":"${OC_TEST_WORKSPACE}"}, proving the explicit change and untouched env reference both survived. Run: https://github.com/openclaw/openclaw/actions/runs/30230937093plugins.installsis deliberately rejected by the public config schema, so it cannot be seeded into a valid authored CLI setup. A probe confirmed the expected rejection andopenclaw doctor --fixremediation. The internal transient-path behavior is instead covered by the passingstrips transient plugin install records from partial writesregression insrc/config/io.write-prepare.test.ts.node scripts/run-vitest.mjs src/config/merge-patch.test.ts— 8 tests passednode scripts/run-vitest.mjs src/config/io.write-prepare.test.ts— 95 tests passednode scripts/run-vitest.mjs src/config/env-preserve.test.ts— 72 tests passednode scripts/run-vitest.mjs src/gateway/config-reload.test.ts— 155 tests passed after CI exposed a watcher timing flakechecks-node-compact-large-2: https://github.com/openclaw/openclaw/actions/runs/30230182067/attempts/2node scripts/check-changed.mjs -- <19 touched files>— remote Blacksmith Testbox run passed all selected guards, core/core-test typechecks, import-cycle checks, and core lint shards: https://github.com/openclaw/openclaw/actions/runs/30229182061$HOME/.claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main— clean, no accepted/actionable findingsgit diff --check origin/main...HEAD— clean