Skip to content

fix(update): explain invalid config during database preflight - #147771

Merged
steipete merged 5 commits into
mainfrom
steipete/upd-doctor-repair-config-before-migrations
Sep 14, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/upd-doctor-repair-config-before-migrations

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Database schema preflight refuses an update for invalid configuration without identifying the offending fields or explaining how to repair them.

Refs #147717. Reported by @gryffindorhammer (#147717).

User Impact

The refusal now names the config file and invalid fields, points to openclaw doctor --fix for retired or unrecognized keys, and asks users to correct remaining errors before retrying. Database compatibility and config-identity checks retain their existing refusal and read-only behavior.

Why This Change Was Made

Preflight already had structured validation issues but discarded them in its error message. It now uses the existing terminal-safe formatter.

The broader Doctor ordering and agent-selection failure could not be reproduced on current main. The new real CLI test combines two agents, a configured system agent, retired and unknown fields, legacy workspace setup, and a legacy session. One Doctor run persists config repair and migrates both stores to SQLite without explicit agent selection. This protects existing behavior; no migration order or agent-selection fallback changes. Original corrected keys, the first Doctor refusal, and stage-specific executable versions are still needed to attribute #147717.

Qualification exposed a Docker runner defect: COPY --chmod=0644 made newly created helper parent directories non-traversable. The image now normalizes directory modes after copying while retaining explicit file modes. A fresh appuser probe verifies directory/artifact/entrypoint modes of 0755/0644/0755 and successfully executes the entrypoint.

Related PRs #147714 and #147453 own plugin-ID and environment-reference repair; those owners are unchanged here.

Evidence

  • Diagnostic assertions fail with the original message and pass after this fix: all 17 schema-preflight tests pass, including unchanged-config and managed-profile checks.
  • node scripts/run-vitest.mjs src/commands/doctor-config-preflight.refusal.process.test.ts -t 'repairs retired and unknown keys' passes on unchanged Doctor production code.
  • node scripts/run-vitest.mjs test/scripts/docker-build-helper.test.ts -t 'normalizes shared Docker E2E harness file permissions' passes. The existing guard was preserved.
  • pnpm build, pnpm check:changed, the scoped Docker tooling checks, and P1 autoreview passed; review is scoped-clean.
  • Exact-head CI passed for 9bfac050f69acb9f26a109818f82b5432a484723: https://github.com/openclaw/openclaw/actions/runs/34803230864.
  • Published [email protected] → candidate 2026.9.4 qualification passed in 386 seconds, including automatic migration, schema and plugin recovery, cron owners, post-update agent turn, already-current second update, and clean Doctor checks.
OPENCLAW_DOCKER_ALL_LANES=published-upgrade-survivor \
[email protected] \
OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=legacy-operator-state \
OPENCLAW_CURRENT_PACKAGE_TGZ="$PWD/.local/l321-package/openclaw-candidate.tgz" \
node scripts/test-docker-all.mjs

The qualification tarball is bound to pre-redaction-fix head 9bfac050f69acb9f26a109818f82b5432a484723; the subsequent fix only omits validator message values, with focused regression and changed-file proof rerun. SHA-256: 5ff959169d43edc5e35ec1086e5983db89374a983af7001294e4b6a2680d42ca.

Qualification limitations remain explicit. The earlier base cell, whose npm prefix is on the Mac host bind mount, passed candidate migration/validation/canary but hit the frozen 2026.9.3 updater's 30-second package-integrity cap during swap. Its secondary “retained package tree changed” message also occurs when the baseline fingerprint is absent; it is not evidence of corruption. No timeout or recovery semantics were changed. The passing operator-state cell uses the container filesystem and different fixtures, so it does not isolate the latency cause. An earlier package had stale UI assets after a runtime test build; rebuilding the complete final head resolved that warning.

An earlier-head CI run also failed the unrelated CUA 256 MiB frame cleanup test; the recorded pre-redaction-fix run is green. Evidence: https://github.com/openclaw/openclaw/actions/runs/34802256357/job/103847247066. An intermediate Docker change failed the file-mode source guard; the final implementation retains the guard and passes it.

The installed old updater retains its own preflight message until replacement. The new diagnostic is proved at the candidate preflight boundary. These fixtures do not reconstruct the original incident, so this PR does not auto-close it.

Release-note context: Update failures caused by invalid configuration now identify the fields and provide actionable Doctor repair guidance.

ClawSweeper review

The reviewed head has no code findings. The four qualification/maintainer/data-model requests and optional rank-up move are addressed by the successful published 2026.9.3 updater → candidate legacy-operator-state cell recorded above, including package replacement and recovery checks. The earlier Mac bind-mount base failure remains a documented limitation; the passing cell does not isolate its latency cause. No schema, migration ordering, retention, or recovery behavior changes are introduced, so a separate data-model migration is not applicable.

Fixup eab956e0fde9ad256e1a3756427af44091f48dc9 passed pnpm check:changed; exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/34806735721 (the native watcher reports GREEN; five superseded checks were accounted for). The landing review additionally found that terminal escaping alone does not remove config values embedded in validator messages. Preflight now projects only issue paths with a fixed invalid-field reason before formatting. A real config-read regression failed on the prior head because the refusal included a synthetic rejected model-policy value; it now passes, along with all 17 preflight tests and a fresh scoped-clean P1 review. Field paths and Doctor guidance remain visible; raw validator messages are omitted.

ClawSweeper revision 4 reviewed eab956e0fde9ad256e1a3756427af44091f48dc9 and found no code or security defects. Its sole remaining data-model compatibility checklist item is dispositioned as already covered by the published-updater proof above; a new data-model migration is not applicable because this PR changes diagnostic presentation and test-harness directory permissions only. No additional code change or review request is needed.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: S maintainer Maintainer-authored PR labels Sep 14, 2026
@steipete
steipete marked this pull request as ready for review September 14, 2026 02:59
@clawsweeper

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

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 12:53 AM ET / 04:53 UTC (Revision 4).

ClawSweeper review

What this changes

The PR adds value-redacted invalid-field diagnostics and Doctor guidance to update preflight refusals, documents recovery, adds regression coverage, and repairs Docker test-image directory permissions.

Merge readiness

⛔ Blocked before merge - 1 item remains

The PR remains useful: current main and v2026.9.4 still emit the generic refusal. The redaction fix addresses the reported disclosure, and no blocking introduced defect remains. The documented qualification dispositions adequately address the earlier review concerns.

Priority: P2
Reviewed head: eab956e0fde9ad256e1a3756427af44091f48dc9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with meaningful regression coverage, documented upgrade qualification, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor gate does not apply to this maintainer PR, and no authority change triggers an exception. The body records candidate-preflight validation, an appuser Docker probe, and published-updater qualification; the final redaction has focused before/after regression evidence. No new execution was performed in this read-only review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor gate does not apply to this maintainer PR, and no authority change triggers an exception. The body records candidate-preflight validation, an appuser Docker probe, and published-updater qualification; the final redaction has focused before/after regression evidence. No new execution was performed in this read-only review.
Evidence reviewed 8 items Introduced diagnostic change: The complete pinned introduction delta changes the refusal text but preserves the existing invalid-config condition, source-identity checks, and read-only inspection. The final commit projects only path, pathSegments, and a constant message into the formatter.
Current-main necessity: GitHub contents at the supplied current-main revision still contain the generic configuration refusal without invalid-field details or Doctor guidance.
Latest-release check: The same generic refusal is present at the supplied v2026.9.4 release commit; this improvement is not already implemented there.
Findings None None.
Security None None.

How this fits together

Update preflight reads the selected configuration before inspecting database compatibility and changing the installation. Invalid configuration stops that inspection; this change makes the refusal actionable without changing admission or migration behavior.

flowchart TD
  A[Update request] --> B[Read selected configuration]
  B --> C{Configuration usable?}
  C -->|Yes| D[Inspect database compatibility]
  C -->|No| E[Format field paths without values]
  E --> F[Refuse with Doctor guidance]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +14, Tests +110, Docs +5, Other +3. Total +132 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 1 +14
Tests 2 114 4 +110
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 5 137 5 +132

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/schema-preflight.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the diagnostic repair in the existing preflight owner, preserve admission safeguards, and leave broader migration recovery with its separate investigation.

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

Yes, for the narrow diagnostic defect: current main discards structured validation issues when invalid config reaches database preflight. Tests were inspected but not executed; the original broader migration incident remains unconfirmed.

Is this the best way to solve the issue?

Yes. Reusing the existing terminal-safe formatter with constant error text is a focused repair that retains useful field locations without printing rejected values or changing migration ownership.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded update diagnostic improvement; it does not itself repair the broader reported recovery outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor gate does not apply to this maintainer PR, and no authority change triggers an exception. The body records candidate-preflight validation, an appuser Docker probe, and published-updater qualification; the final redaction has focused before/after regression evidence. No new execution was performed in this read-only review.

Evidence

What I checked:

  • Introduced diagnostic change: The complete pinned introduction delta changes the refusal text but preserves the existing invalid-config condition, source-identity checks, and read-only inspection. The final commit projects only path, pathSegments, and a constant message into the formatter. (src/cli/update-cli/schema-preflight.ts:118, eab956e0fde9)
  • Current-main necessity: GitHub contents at the supplied current-main revision still contain the generic configuration refusal without invalid-field details or Doctor guidance. (src/cli/update-cli/schema-preflight.ts:120, 06918febcb65)
  • Latest-release check: The same generic refusal is present at the supplied v2026.9.4 release commit; this improvement is not already implemented there. (src/cli/update-cli/schema-preflight.ts:120, 3a9d69db306c)
  • Redaction regression and review continuity: The final commit replaces raw validator messages and adds a real config-read regression asserting the model-policy field path, repair guidance, absence of the rejected value, and unchanged config bytes. GitHub's commit patch confirms these are the changes since the previously reviewed head; previous structured findings were empty. (src/cli/update-cli/schema-preflight.test.ts:319, eab956e0fde9)
  • Qualification and its limits: The complete supplied PR body records a successful 386-second published 2026.9.3 updater to candidate legacy-operator-state run, including replacement, recovery checks, an agent turn, and a second update. Its tarball is bound to 9bfac05 with SHA-256 5ff959169d43edc5e35ec1086e5983db89374a983af7001294e4b6a2680d42ca. The later change only redacts diagnostics and has reported focused regression validation. The earlier Mac bind-mount timeout remains explicitly unexplained; no timeout or migration behavior changes are introduced. These are recorded author results, not executions performed during this review. (9bfac050f69a)
  • Docker permission scope: The added chmod targets directories under the copied test harness only. Explicit artifact and executable file modes remain intact, and dependencies, image references, and execution principals are unchanged. The PR records an appuser traversal and entrypoint probe. (scripts/e2e/Dockerfile:28, eab956e0fde9)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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-14T03:06:26.634Z sha fe9717e :: blocked before merge. :: none
  • reviewed 2026-09-14T03:50:11.318Z sha 9bfac05 :: blocked before merge. :: none
  • reviewed 2026-09-14T04:21:55.342Z sha 9bfac05 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docker Docker and sandbox tooling label Sep 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The landing check found that validator messages can contain rejected config values. Commit eab956e preserves field paths and Doctor guidance while omitting raw messages. The real config-read regression fails before the fix and passes afterward; all 17 preflight tests, pnpm check:changed, and fresh P1 review pass. The PR body also records the passing published-updater qualification and dispositions for the previous qualification requests.

@clawsweeper

clawsweeper Bot commented Sep 14, 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
steipete merged commit 0696045 into main Sep 14, 2026
194 of 196 checks passed
@steipete
steipete deleted the steipete/upd-doctor-repair-config-before-migrations branch September 14, 2026 05:16
@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 15, 2026
…aw#147771)

* fix(update): explain invalid config during database preflight

* fix(test): make the Docker plugin registry entrypoint executable

* fix(test): preserve Docker runner directory traversal

* fix(test): retain file modes while enabling harness directory traversal

* fix(update): omit config values from preflight refusals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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