Skip to content

fix(update): keep dry-run previews best-effort when config is malformed - #187367

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1957
Oct 29, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1957

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw update --dry-run --json exits 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 update notes 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 7ff23e1187cf and 07bd3eff3be9 identifies 945f6dde06e2 (#187217), rather than #187192 or #186971: parent de697f811819 reaches 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

  • Before repair, the real CLI exits 1 with reason: invalid-config, and OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/cli/update-dry-run-state.process.test.ts -t 'keeps malformed config' --maxWorkers=1 fails at the expected exit-0 assertion. Source-admission git bisect run identifies 945f6dde06e2 as first bad.
  • Node process suite: 20/20 passed, 62.85 s Vitest wall time (about 39 s tests; build/compilation dominated the 134.43 s wrapper time). On the final narrowed fix, both populated/migration-pending preview cases pass again on Node: 2/2, 13.56 s wall time.
  • Pinned Bun process suite on the final fixture: 20/20 passed, 31.35 s Vitest wall time (about 27 s tests), 37.78 s wrapper time. Final narrowed-fix preview replay also passes 2/2 on pinned Bun, 10.38 s wall time.
  • Doctor blocked-run preservation: 11/11 selected process cases pass on Node (34.74 s Vitest wall time), retaining nonzero exits and unopened storage for malformed SQLite/PostgreSQL config and live-owner refusals.
  • Real node openclaw.mjs update --dry-run --no-restart --timeout 1 --json and 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 with invalid-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.
  • Core tsgo and CLI-update test tsgo, touched-file oxlint/oxfmt, git diff --check, and madge (0 cycles) pass. Both local ratchets pass: Test lines OK: 6247548; ceiling: 6321159; slack: 73611. and Mock factory ratchet OK: 6485 grandfathered factories.
  • All 42 direct importer/sibling files were executed across their owning configs; PostgreSQL conformance auto-skips four cases without a local PostgreSQL connection.
  • Existing slow suite: update-command-lease.test.ts accumulates 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.
  • Inherited host failure: the importer run has six failures in 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 base 29ba5bb2070b reproduces the same six failures: 6 failed / 25 passed, 121.91 s wall time. The capture warning is SQLite staging ancestor must not allow another user to replace its child on the host volume (mode 0775). Final production bytes were restored and checksum-verified afterward; no permission changes or guard bypasses were used.
  • Final readable-config sibling replay: metadata diagnostics and invalid-config suites pass, 36/36 tests (54.27 s wall time). The early preview route is limited to unreadable configuration, preserving the existing sanitized-error contract. The final contention replay also passes 8/8 tests (50.50 s wall time), verifying recoverable reporting/history.
  • Codex autoreview of the complete local diff against 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.

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.
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 29, 2026
@steipete
steipete marked this pull request as ready for review October 29, 2026 05:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T05:39:42.373279Z c961c9b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The command exits 1 with invalid-config before returning planned actions.
  • After: The command exits 0 with planned actions and a Would refuse update note, preserving configuration, database, and seal bytes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair supported by shipped CLI results and strengthened regression coverage, with no actionable correctness or security findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied evidence records real openclaw.mjs execution on Node and pinned Bun with isolated malformed config and initialized state: previews return exit 0 and refusal notes without changing config/database/seal bytes, while real updates retain exit 1; supporting process regressions cover absent history and migration-pending configuration.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Malformed configuration prevents operators from seeing the promised best-effort update preview.
Reason: This restores documented behavior with a narrow change; maintainer-authored direction is already established.

Regression provenance

Regression provenance — verified: source commit 945f6dde06e2 by Peter Steinberger; canonical PR #187217 (blame-to-merge-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
Reviewed head: c961c9ba51e9a610e25fdb8c7a767ae9c57a8878

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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
Loading

Technical review

Best 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

  • Malformed-source engine admission changes intended behavior with a stated reason (945f6dd: PostgreSQL capture/status repair required unreadable configuration to remain unreadable rather than selecting an assumed backend.)
  • Update initialization ordering keeps the original intent (fix(update): preserve compatible state when switching to npm stable #144155: Target-owned initialization prevents previews and fresh updates from creating incompatible state before admission.)
  • Immutable-preview regression and diagnostics keeps the original intent (fix(cli): keep update dry-run state immutable #118856: Dry-run previews must preserve malformed configuration and local state; subsequent diagnostic work retained successful previews with refusal notes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 945f6dd adds src/cli/update-cli/update-command-database-engine.ts:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 945f6dde06e2; files: src/cli/update-cli/update-command-database-engine.ts)

PR surface

Source +11, Tests 0, Docs +2. Total +13 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 62 51 +11
Tests 1 16 16 0
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 81 68 +13

Labels

Label changes:

  • add P2: The regression breaks a documented advanced CLI preview while real-update admission continues to refuse malformed configuration safely.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The regression breaks a documented advanced CLI preview while real-update admission continues to refuse malformed configuration safely.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 29, 2026, 1:54 AM ET / 05:54 UTC.

@steipete
steipete merged commit f533fef into main Oct 29, 2026
215 of 217 checks passed
@steipete
steipete deleted the upd/upd-l1957 branch October 29, 2026 06:03
steipete added a commit that referenced this pull request Oct 29, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: update dry-run rejects malformed config before returning its preview

1 participant