Skip to content

fix(update): report invalid config instead of database schema failures - #149571

Merged
steipete merged 4 commits into
mainfrom
upd/schema-preflight-unknown-mode
Sep 16, 2026
Merged

steipete merged 4 commits into
mainfrom
upd/schema-preflight-unknown-mode

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #148255, #148314, #148359, #148744, #148991, #149259, #149555

What Problem This Solves

Fixes openclaw update reporting database-schema-preflight when its actual failure is invalid or unreadable configuration.

User Impact

Updates identify this condition as invalid-config, retain sanitized field diagnostics and Doctor guidance, and include the existing typed failure facts in reports. Dry-run JSON keeps its successful best-effort response with the same repair guidance in notes. Guided recovery recognizes the saved config refusal after a later successful update and retains its installed-runtime, Doctor, Gateway-readiness, and ownership checks.

The installed 2026.9.4 updater performs this check before staging a candidate, so a new release cannot change that already-installed driver's behavior. Operators must correct the configuration before retrying. The docs explain how to retrieve the original refusal with openclaw update status --json before a dry run replaces the latest history.

Why This Change Was Made

The config admission owner was using a database failure reason for a config validation failure. This uses the existing invalid-config contract and its existing diagnostic propagation. The recovery validator recognizes the same reason alongside schema admission failures, completing the downstream cutover without weakening verification. Core-only validation, config preservation, source-change checks, and newer-schema protection remain enforced.

Stock 2026.9.4 also hardcodes mode: unknown for package preflight refusals and omits the resolved target from its generated report. Those fields do not establish failed installation detection. The seven related reports lack enough information to attribute their individual causes; invalid config reproduces their report shape, but this PR does not claim to resolve every report.

Evidence

  • Four command-level regression cases failed on pre-fix main for the intended reason; all 21 focused command/schema-preflight tests pass after the repair, including existing active-WAL, config revalidation, managed-profile, and redaction checks.
  • A trusted stock [email protected] installation reproduced both unknown top-level keys and an invalid gateway.port as database-schema-preflight; status retained the selected target and refusal text.
  • Full changed-file gate passed, including production/test typechecks, lint, docs/config checks, and storage/import guards. The first gate found a test-table no-map-spread lint error; explicit test fields fixed it, and all four command cases were rerun successfully.
  • Full pnpm build passed. The built CLI emits invalid-config in JSON/history for both failing config cases and preserves the incompatible-agent control. With a running isolated Gateway, config bytes remained unchanged and /healthz remained HTTP 200 after update, status, and dry-run.
  • Fresh Codex autoreview in branch mode against origin/main, P1: scoped-clean, no actionable findings. Reviewed head: be57790729a5bc8afbe10b88be73a751e0566576. Review artifacts are retained outside the repository.
  • Repeated the full changed-file gate after rebasing: passed, including production and test typechecks, changed-file lint, and storage/import guards. The targeted gate also passed after the final artifact-test expectation correction. Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/35048126831 (passed).
  • Exact-head CI exposed one remaining artifact-test assertion that expected the old config reason. Updated that assertion to invalid-config; all 26 schema-artifact tests pass, including unreadable-config refusal, metadata-free schema checks, source preservation, and active WAL writers.
  • The saved-failure/later-success recovery regression failed on the original PR head at the success assertion. After the owner fix, all 90 focused tests passed (69 recovery and 21 command/schema-preflight tests), including rejection when the managed Gateway is unverified.
  • Rebased the three reviewed commits onto main to pick up the unrelated wrapper-fixture correction after the duplicate dependency initialization was reintroduced. Range-diff confirms unchanged patches, and the main fixture now has one alias initialization (three helper references total).
  • Final-head ClawSweeper review: no actionable findings or rank-up moves. fix(update): report invalid config instead of database schema failures #149571 (comment)
  • Production diff: +6/-6, net 0 lines. Tests: +64/-8, net +56. Docs: +14/-0.
Isolated live stock matrix and limits

Tested on macOS arm64, Node 26.8.2, with isolated home/config/state/prefix, a free loopback port, and a foreground Gateway owned by the test. The published package supplied its own CLI dist.

Case Real update Dry run
Gateway running or stopped already-current, exit 0 exit 0, no refusal
Bundled canvas plugin enabled already-current, exit 0 exit 0, no refusal
Unknown top-level key database-schema-preflight, exit 1 exit 0, config refusal in notes
Invalid core field database-schema-preflight, exit 1 exit 0, config refusal in notes
Configured agentDir, existing stock DB or missing directory already-current, exit 0 exit 0, no refusal
Configured session.store, existing DB or missing directory already-current, exit 0 exit 0, no refusal
30-second state write transaction generic database is locked before ledger admission same; no new run
Copied main-created directory, agent schema 20 versus target 19 legitimate schema refusal exact incompatibility in notes
Synthetic state schema 18 versus target 17 legitimate newer-schema error before ledger admission same

Stock and main both use state schema 17; the real main-created incompatibility is agent schema 20. agentDir alone does not select update candidate database paths; the additional session.store cases exercise that selection.

No schema-inspection contention refusal or unchanged-config race was reproduced. The separate writer-lock admission failure is outside this diagnostic correction. Windows and Linux reports remain unclassified without their original ledger detail.

@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@steipete
steipete marked this pull request as ready for review September 16, 2026 01:34
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 11:10 PM ET / September 16, 2026, 03:10 UTC (Revision 4).

ClawSweeper review

What this changes

The PR identifies invalid update configuration accurately, preserves dry-run guidance, updates recovery recognition, and adds regression coverage and troubleshooting documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused correction absent from current main and v2026.9.4. The earlier recovery finding is resolved, and no actionable introduced defects remain.

Priority: P2
Reviewed head: be57790729a5bc8afbe10b88be73a751e0566576

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused correction with relevant live observations, meaningful regression coverage, and the prior blocker resolved.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured live observations connect configuration capture to real stock and built-CLI update/status/dry-run behavior: corrected JSON/history classification, unchanged configuration, continued Gateway health, and retained incompatible-schema refusal. Recovery regressions provide supplemental coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured live observations connect configuration capture to real stock and built-CLI update/status/dry-run behavior: corrected JSON/history classification, unchanged configuration, continued Gateway health, and retained incompatible-schema refusal. Recovery regressions provide supplemental coverage.
Evidence reviewed 8 items Focused production correction: Configuration capture emits invalid-config while retaining sanitized field diagnostics, Doctor guidance, source identity checks, and the existing admission condition. Dry runs consume that reason as explanatory notes.
Current-main necessity: Inspection of fetched main shows the same invalid/unreadable configuration condition still emits database-schema-preflight. The earlier diagnostics improvement does not implement this classification correction.
Published-version check: The v2026.9.4 source also emits database-schema-preflight for invalid configuration. Its source was successfully inspected through GitHub after the local release blob was unavailable.
Findings None None.
Security None None.

How this fits together

The updater reads configuration before checking database compatibility and changing the installation. Its failure classification feeds CLI output, update history, and guided recovery verification.

flowchart TD
  A[Update request] --> B[Read configuration]
  B --> C{Configuration valid?}
  C -->|Yes| D[Check database compatibility]
  C -->|No| E[Config failure and repair guidance]
  E --> F[CLI output and update history]
  F --> G[Verify later recovery]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +56, Docs +14. Total +70 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 6 6 0
Tests 4 64 8 +56
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 84 14 +70

Review metrics

None.

Technical review

Best possible solution:

Keep configuration failures distinct from database incompatibility throughout reporting and recovery, while preserving admission safeguards and the documented installed-updater limitation.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source deterministically assigns the database reason to invalid configuration, and the supplied stock-package runs reproduce it with an unknown key or invalid gateway.port. This review did not execute the CLI.

Is this the best way to solve the issue?

Yes: correcting the existing classification owner and its dry-run and recovery consumers is a narrow repair; it adds no competing validator or migration policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against c1c870a41755.

Labels

Label justifications:

  • P2: This fixes misleading update diagnostics and recovery classification without changing which configurations are admitted.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured live observations connect configuration capture to real stock and built-CLI update/status/dry-run behavior: corrected JSON/history classification, unchanged configuration, continued Gateway health, and retained incompatible-schema refusal. Recovery regressions provide supplemental coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured live observations connect configuration capture to real stock and built-CLI update/status/dry-run behavior: corrected JSON/history classification, unchanged configuration, continued Gateway health, and retained incompatible-schema refusal. Recovery regressions provide supplemental coverage.

Evidence

What I checked:

  • Focused production correction: Configuration capture emits invalid-config while retaining sanitized field diagnostics, Doctor guidance, source identity checks, and the existing admission condition. Dry runs consume that reason as explanatory notes. (src/cli/update-cli/schema-preflight.ts:117, be57790729a5)
  • Current-main necessity: Inspection of fetched main shows the same invalid/unreadable configuration condition still emits database-schema-preflight. The earlier diagnostics improvement does not implement this classification correction. (src/cli/update-cli/schema-preflight.ts:117, c1c870a41755)
  • Published-version check: The v2026.9.4 source also emits database-schema-preflight for invalid configuration. Its source was successfully inspected through GitHub after the local release blob was unavailable. (src/cli/update-cli/schema-preflight.ts, 3a9d69db306c)
  • Previous recovery blocker resolved: invalid-config now enters the existing completed-update resolution path, which checks installation identity, Doctor results, runtime integrity, Gateway readiness, and update-owner stability. The changed regression exercises failure, subsequent success, and rejection of an unverified Gateway. (src/infra/update-triage-resolution.ts:49, be57790729a5)
  • Regression coverage: Four command cases cover unknown keys and invalid core fields in ordinary and dry-run modes, including unchanged config and no database creation. Existing source-artifact coverage now expects invalid-config for unreadable configuration; preservation and incompatible-schema assertions remain intact. Tests were inspected, not executed during this read-only review. (src/cli/update-cli/update-command-invalid-config.test.ts:10, be57790729a5)
  • Captured real behavior evidence: The supplied PR body records isolated macOS arm64/Node 26.8.2 stock-package runs reproducing the misleading classification, followed by built-CLI runs emitting invalid-config in JSON/history for both invalid-config cases. It records preserved configuration bytes, continued HTTP 200 Gateway health, and a retained incompatible-agent control. The published-driver limitation is explicitly documented. This assessment uses the supplied snapshot and does not claim reviewer execution. (be57790729a5)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-16T01:42:11.695Z sha f525595b04f612c2447dce444620286fc3005a6c :: needs changes before merge. :: [P2] [P2] Teach recovery validation about the new failure reason
  • reviewed 2026-09-16T02:18:02.296Z sha 06feda2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T02:37:18.594Z sha be57790 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the upd/schema-preflight-unknown-mode branch from f525595 to 06feda2 Compare September 16, 2026 02:09
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the recovery finding in 06feda21cc770dac32e736da6f715f9d72e50c9a: invalid-config now follows the existing completed-update, runtime, Doctor, Gateway, and ownership checks. The saved-failure/later-success regression failed before the fix; all 90 focused tests and the rebased changed-file gate pass. The PR body contains the updated evidence.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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 rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The only change since the clean review is commit be57790729a5bc8afbe10b88be73a751e0566576, aligning the schema-artifact unreadable-config test with the approved invalid-config contract. The prior CI failure is fixed; all 26 artifact tests and the targeted changed-file gate pass. Fresh branch-mode P1 Codex autoreview is scoped-clean. Production code is unchanged, and the PR body contains the current proof.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
openclaw#149571)

* fix(update): identify invalid config before schema inspection

* test(update): simplify invalid-config regression cases

* fix(update): verify recovery after invalid config refusals

* test(update): align unreadable config refusal expectation
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 maintainer Maintainer-authored PR 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.

1 participant