Repository navigation
fix(update): keep dry-run previews best-effort when config is malformed - #187367
Conversation
Let unreadable preview config reach the existing preflight notes without selecting a database engine or inspecting writable state. Preserve readable preview diagnostics and real-update admission refusal. Fixes #187333. Regression introduced by 945f6dd (#187217). Thanks @shakkernerd.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR restores best-effort update previews for malformed configuration while preserving real-update refusal and existing state. Example: Run openclaw update --dry-run --no-restart --timeout 1 --json with config bytes "{ definitely-not-json\n" and an existing database.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a current preview regression with a focused change and no actionable introduced defects found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe update CLI reads authored configuration, selects the database engine for admission, and either renders a preview or enters the existing update execution lifecycle. flowchart TD
A[Update CLI] --> B[Read authored configuration]
B --> C[Readable configuration]
B --> D[Unreadable configuration]
C --> E[Existing engine and admission checks]
D --> F[Dry run preview diagnostics]
D --> G[Real update refusal]
E --> F
Technical reviewBest possible solution: Retain this focused preview-only repair through the existing engine-selection and preview owners. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the early refusal, and the linked report identifies the real CLI process regression; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch restores the established preview contract without guessing a database backend or weakening real-update admission, and the strengthened existing process regression checks populated-state preservation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a5d55e176e74. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests 0, Docs +2. Total +13 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 29, 2026, 1:54 AM ET / 05:54 UTC. |
…scratch artifacts (#187498) Update previews with unparseable config no longer read plugin-migration facts or update history while the database engine is unresolved, and prepared dry-run results no longer publish update reports or support bundles. Text and JSON previews leave the profile, cache and scratch trees unchanged; real malformed-config updates still refuse with invalid-config and save their report. Fixes #187431 (follow-up to #187367). Thanks @shakkernerd for the report.
…ed (openclaw#187367) fe72331 (openclaw#187217) routed update engine selection through dry-run previews, so openclaw update --dry-run --json with an unparseable config exited 1 with 'configuration is invalid' instead of returning its best-effort preview. Malformed-config previews now reach the existing would-refuse notes without choosing a database backend or inspecting writable state; real updates and Doctor still refuse unsafe admission. Fixes openclaw#187333. Thanks @shakkernerd.
…scratch artifacts (openclaw#187498) Update previews with unparseable config no longer read plugin-migration facts or update history while the database engine is unresolved, and prepared dry-run results no longer publish update reports or support bundles. Text and JSON previews leave the profile, cache and scratch trees unchanged; real malformed-config updates still refuse with invalid-config and save their report. Fixes openclaw#187431 (follow-up to openclaw#187367). Thanks @shakkernerd for the report.
What Problem This Solves
openclaw update --dry-run --jsonexits 1 when authored configuration cannot be parsed, hiding its best-effort preview. Fixes #187333. Thanks @shakkernerd for the report.User Impact
Malformed-config previews return planned actions and
Would refuse updatenotes with exit 0, preserving configuration and existing state bytes and recording no update run. Real updates still refuse invalid configuration; Doctor's nonzero exit for blocked real repairs is unchanged.Why This Change Was Made
Bisection of the source admission boundary between
7ff23e1187cfand07bd3eff3be9identifies 945f6dde06e2 (#187217), rather than #187192 or #186971: parentde697f811819reaches preview admission, while that commit introduces the early invalid-source refusal.The database-engine owner now lets dry runs reach the existing schema preflight diagnostics without selecting an engine from unreadable source. That unreadable-config preview uses the existing preparation path before writable state admission, even when a database already exists; readable-config previews retain their established diagnostics and contention reporting. A populated-state probe caught that the prior path changed the database and its seal before producing a preview; the regression now seeds a native database and snapshots it too. Actual admission retains its refusal.
Production: +11 net lines (+62/-51 including formatter indentation); tests: zero net lines (+16/-16); docs: +2 net lines. Existing fixture helpers were consolidated to keep the stronger regression within the test budget. No mock factories changed.
Evidence
reason: invalid-config, andOPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/update-dry-run-state.process.test.ts -t 'keeps malformed config' --maxWorkers=1fails at the expected exit-0 assertion. Source-admissiongit bisect runidentifies945f6dde06e2as first bad.node openclaw.mjs update --dry-run --no-restart --timeout 1 --jsonand the same command with pinned Bun, each with isolated HOME/config/state and a native initialized database: exit 0, four planned actions, refusal note, config/database/seal byte-identical. The corresponding non-dry-run commands exit 1 withinvalid-config, also byte-identical. Preview times: Node 1.53 s, Bun 1.19 s. A source-boundary probe also verifies no database-engine selection is installed for malformed preview and real admission rejects it.git diff --check, and madge (0 cycles) pass. Both local ratchets pass:Test lines OK: 6247548; ceiling: 6321159; slack: 73611.andMock factory ratchet OK: 6485 grandfathered factories.update-command-lease.test.tsaccumulates 196.27 s of test time, dominated by repeated fresh-process Doctor/finalization flows. No single test exceeded 30 s. This pre-existing integration cost was recorded without timeout/retry changes.update-command-fresh-preview.test.ts(five original-capture parameter cases and the Doctor completed-history case). The full file rerun with both production owners exactly restored to base29ba5bb2070breproduces the same six failures: 6 failed / 25 passed, 121.91 s wall time. The capture warning isSQLite staging ancestor must not allow another user to replace its childon the host volume (mode 0775). Final production bytes were restored and checksum-verified afterward; no permission changes or guard bypasses were used.29ba5bb2070b, P0–P2: scoped-clean, no actionable findings. Simplification pass complete.Full
check:changed/SQLite inventory was not run locally because of its known host runtime; the targeted checks above pass and PR CI supplies broad proof. One intermediate compiler preparation aborted because source changed during compilation; the rerun on the frozen final production diff passed. All proof ran locally; no remote leases or operator state were used.