Repository navigation
fix(cli): keep targeted config writes out of state migration - #120451
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 6:37 AM ET / 10:37 UTC. ClawSweeper reviewWhat this changesThis PR stops all Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking findings. Current main and the latest release still run migration for targeted config writers, while this PR applies the shared CLI-boundary fix with sufficient isolated CLI proof; it should remain open pending normal merge handling. Priority: P1 Review scores
Verification
How this fits togetherCLI pre-action derives a command path and decides whether startup Doctor migration runs before the command handler. Config writers then validate and persist configuration; Doctor and gateway startup remain the explicit owners of persistent-state repair. flowchart LR
A[Operator config command] --> B[CLI command-path parsing]
B --> C{Run startup migration?}
C -->|Config command| D[Validate and write config]
C -->|Other startup path| E[Doctor migration preflight]
D --> F[Requested config update]
E --> G[Repaired legacy state]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +12. Total +12 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the shared command-path exclusion so targeted writes remain narrow and validated while explicit Doctor and gateway startup retain migration ownership. Do we have a high-confidence way to reproduce the issue? Yes—current-main source shows config set and config patch reach Doctor migration through the shared predicate, and the PR supplies an exact-head isolated CLI after-fix transcript. Is this the best way to solve the issue? Yes—the shared command-path predicate is the best fix because per-writer or cron-specific guards would miss sibling and future config commands, while writer-level changes occur after startup migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6ae7a8684aba. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
f31e89e to
8d7ef71
Compare
be6cffe to
2fa84e1
Compare
2fa84e1 to
5f95bbb
Compare
5f95bbb to
9a50ce2
Compare
|
Maintainer repair sweep updated this PR to exact head The branch now contains only the canonical owner-boundary repair: all Proof on the exact head:
Hosted CI run https://github.com/openclaw/openclaw/actions/runs/31247778098 has the affected CLI/config lanes, build, types, guards, protocol, and dependency checks green. The aggregate gate is red only from untouched base-file failures already present on the previous head: context/session expectations, max-lines violations, and a worktree-migration timeout. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
Targeted config writes retain validation while Doctor and the gateway own state migration. Fixes openclaw#120413 Co-authored-by: SunnyShu <[email protected]>
9a50ce2 to
02c6ddb
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Post-merge landing proof Recorded after merge because the concurrent native landing completed before this phase could post the pre-merge land-ready note.
|
* refactor(cli): inline state migration policy Remove the single-use exported helper so migration policy now lives at ensureConfigReady, its lifecycle owner. Move duplicate argv and preaction coverage into the lifecycle-owner test table while preserving behavior. This follows #120451. * refactor(cli): preserve gateway migration rationale Keep the ownership invariant beside the inlined gateway-call exception.
Targeted config writes retain validation while Doctor and the gateway own state migration. Fixes openclaw#120413 Co-authored-by: Peter Steinberger <[email protected]>
* refactor(cli): inline state migration policy Remove the single-use exported helper so migration policy now lives at ensureConfigReady, its lifecycle owner. Move duplicate argv and preaction coverage into the lifecycle-owner test table while preserving behavior. This follows openclaw#120451. * refactor(cli): preserve gateway migration rationale Keep the ownership invariant beside the inlined gateway-call exception.
Closes #120413
What Problem This Solves
Fixes an issue where
openclaw config setandopenclaw config patch --stdincould run the startup Doctor/state-migration path before applying a targeted config change. That implicit whole-state repair could rewrite unrelated legacy cron data, including per-job model routing, during an otherwise narrow config update.Why This Change Was Made
All
configcommands now opt out of startup state migration. Targeted writers still pass through the config guard and the existing full candidate/schema/plugin validation before writing; only unrelated state repair is removed from their startup envelope. Persistent migration remains owned by explicitopenclaw doctor --fixand gateway startup.This is the canonical owner-boundary fix rather than a cron-specific guard, a new flag, or a writer-side compatibility path. It also protects future targeted config subcommands from inheriting the same implicit-repair bug.
User Impact
config setandconfig patchnow apply only the requested validated config change. They no longer emit Doctor/state-migration output or mutate legacy cron storage as a side effect. Operators who need legacy-state repair continue to useopenclaw doctor --fixor normal gateway startup.No config key, default, schema, protocol, flag, or output shape changes.
Evidence
Exact head:
9a50ce20ae6f2f16853a6ea4af376cdf0228be30Sanitized AWS Crabbox proof used a fresh public-network lease with no instance profile, no Tailscale, no hydration, isolated
HOME, pinned Node/pnpm, and exact-head verification.src/cli/argv.test.ts,src/cli/program/config-guard.test.ts,src/cli/program/preaction.test.ts, andsrc/cli/config-cli.test.ts.cron/jobs.json, then ran both targeted writers. The cron file remained byte-identical afterconfig patch --stdinandconfig set; neither command emitted Doctor/migration output. A subsequentdoctor --fix --non-interactivemigrated and archived the same legacy cron store.{"head":"9a50ce20ae6f2f16853a6ea4af376cdf0228be30","patchCronHashPreserved":true,"setCronHashPreserved":true,"patchMigrationOutput":false,"setMigrationOutput":false,"doctorMigratedLegacyCron":true}configpredicate the best fix and confirmed validation and migration-owner paths remain intact.Review metrics
+1/-1(net 0)+12/-00 added / 0 changed / 0 removed0 changed2 commands changed(config set,config patch)Compatibility note
This intentionally removes undocumented incidental migration from targeted config writes. Migration is deferred to its documented owners (
doctor --fixand gateway startup), not deleted.Human contributor credit is preserved in the commit for @SunnyShu0925; issue report by @jerabinovich.