Repository navigation
refactor(cli): inline state migration policy - #120641
Conversation
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.
Keep the ownership invariant beside the inlined gateway-call exception.
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 1:37 PM ET / 17:37 UTC. ClawSweeper reviewWhat this changesThe PR removes a single-use CLI state-migration helper and consolidates its unchanged command-path policy and tests in configuration readiness, the Doctor-migration lifecycle owner. Merge readinessKeep open: current main retains the single-use helper and duplicated coverage, while this maintainer-authored PR cleanly moves the unchanged migration decision to its lifecycle owner with no actionable defect found. Priority: P3 Review scores
Verification
How this fits togetherCLI bootstrap resolves a command path and sends it to configuration readiness before command execution. Configuration readiness decides whether Doctor-owned legacy-state migration may run, then continues into the requested command. flowchart LR
A[CLI invocation] --> B[Resolved command path]
B --> C[Configuration readiness]
C --> D{Consider state migration?}
D -->|yes| E[Doctor migration preflight]
D -->|no| F[Skip migration]
E --> G[Requested command]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -15, Tests -16. Total -31 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical migration decision and one lifecycle-owned behavior matrix in configuration readiness, then land after the branch is refreshed against current main. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an existing deterministic command-path policy rather than fixing a newly reported runtime failure. Is this the best way to solve the issue? Yes: source shows the helper has one production consumer, so placing the policy directly in the lifecycle that invokes Doctor removes surface area without changing behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e4309e0cc7a7. 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
|
|
Land-ready proof for exact head
|
|
Merged via squash.
|
…0807 * origin/main: fix(qa): honor Crabbox SSH fallback ports (openclaw#120539) refactor(core): adopt normalization-core leaf helpers across production (openclaw#120350) fix(release): scope upgrade plugin credentials (openclaw#120666) fix(ai): preserve long Responses sessions after server compaction (openclaw#120457) fix(test): keep fork E2E setup builds observable (openclaw#120653) fix(cloud-workers): retain provider operation ownership (openclaw#120661) docs: runners plan — one placement model for sessions, devices, and cloud (openclaw#120657) refactor(cli): inline state migration policy (openclaw#120641) feat(update): scheduled update campaigns with countdown, dev-channel auto-update, and Updates settings page (openclaw#120506) chore(i18n): refresh native locales (openclaw#120614) fix(ci): retry transient artifact API reads (openclaw#120654) fix(clawrouter): honor advertised reasoning efforts (openclaw#120631) fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics (openclaw#120359) fix(maintainers): parse merge comment URL structurally (openclaw#120649) fix(ui): label only operator-pinned runtimes in model picker rows (openclaw#120646) docs(agents): replace exact-head re-review gate with 12-hour review window # Conflicts: # src/agents/payload-redaction.ts
* 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.
What Problem This Solves
Merged PR #120451 fixed the state-migration policy, but the follow-up structure still left that policy exposed as a single-use argv helper and duplicated its coverage across argv, preaction, and lifecycle tests. This separate owner-boundary follow-up removes the extra surface without changing the behavior delivered by #120451.
Why This Change Was Made
The migration decision now lives directly in
ensureConfigReady, the lifecycle owner that invokes the Doctor migration flow. The redundant exported helper and its argv/preaction assertions are removed, while the existingensureConfigReadytable becomes the canonical behavior matrix.The preserved matrix skips migration consideration for every top-level
configcommand, plushealth,logs,sessions,gateway call, andupdate status. Empty, unknown, and state-mutating command paths still consider migration, while the existingstatus,agent, and plugin legacy-input semantics remain unchanged. Doctor remains the migration owner, and gateway startup ownership/checkpoint code is untouched.User Impact
No user-visible behavior changes. This is the net-negative owner-boundary cleanup that follows #120451: operators retain the same migration and skip behavior with less exported policy and one lifecycle-owned test matrix.
No changelog entry is included because release generation owns
CHANGELOG.md.Evidence
node scripts/run-vitest.mjs src/cli/argv.test.ts src/cli/program/config-guard.test.ts src/cli/program/preaction.test.ts— 3 test files and 239 tests passed across 2 Vitest shards in 7.50s.git diff --check origin/main...HEAD— clean.+8/-23(net-15); tests+30/-46(net-16)..agents/skills/autoreview/scripts/autoreview --mode uncommitted— clean, with no accepted or actionable findings before the second commit.68d3a9173f57335566af0e42f4ca3c8ff507592d.