Repository navigation
fix(doctor): stop stale builds before repair guidance - #117913
fuller-stack-dev merged 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 1:33 PM ET / 17:33 UTC. ClawSweeper reviewWhat this changesThe PR makes the Doctor CLI refuse incompatible newer SQLite schemas before repair guidance while preserving the interactive git-checkout update path. Merge readinessThis PR remains necessary: current Priority: P2 Review scores
Verification
How this fits togetherDoctor is OpenClaw’s interactive diagnostics and repair command: it receives CLI options, may first offer a source-checkout update, then loads configuration and runs repair checks. The shared database preflight reads the selected state and registered-agent database schema headers so an older Doctor build can stop before it suggests or performs unsafe repairs. flowchart TD
A[Operator runs Doctor] --> B[Interactive source-checkout update offer]
B --> C{Update handled?}
C -->|Yes| D[Updated process completes Doctor]
C -->|No| E[Read-only database schema preflight]
E --> F{Schema compatible?}
F -->|No| G[Refusal with compatible-install guidance]
F -->|Yes| H[Config diagnostics and repair flow]
Decision needed
Why: The patch is a focused compatibility safeguard, but the PR is member-authored and explicitly labeled for maintainer handling; accepting the user-visible refusal boundary is a maintainer merge decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +42, Tests +112. Total +154 across 5 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the update-first recovery path, then use the existing read-only schema preflight as the single gate before Doctor loads config or offers repairs, with clear guidance to run a compatible state-writing installation. Do we have a high-confidence way to reproduce the issue? Yes—current source shows Doctor reaches config and repair-related flows after an unhandled update without a schema gate, while the PR’s focused test constructs a newer-schema state database and verifies the intended ordering. The PR body also supplies before/after built-CLI Testbox evidence for the reported stale-build behavior. Is this the best way to solve the issue? Yes. Reusing the existing read-only database preflight at the Doctor lifecycle boundary is the narrowest maintainable fix; it avoids a separate schema policy and preserves the existing interactive update-first route before refusing an incompatible surviving build. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a3198023ea86. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Merged via squash.
|
* fix(doctor): refuse newer database schemas before repairs * fix(doctor): preserve update before schema refusal
Related: #115008
AI-assisted: yes. I understand the change and validated the observable CLI behavior against isolated fixtures.
What Problem This Solves
Fixes an issue where users running Doctor from a stale OpenClaw installation could receive
doctor --fixguidance and a successful exit even though the selected state database used a schema newer than that installation supported.That guidance is unsafe and unactionable: the stale Doctor cannot reliably interpret the newer persisted state, so it must not enter config or migration planning first.
Why This Change Was Made
Interactive Doctor now reuses the existing read-only database schema preflight already owned by Gateway startup and update safety. A plain interactive git checkout retains Doctor's existing update-first recovery: a successful update replaces the stale process, while a declined or non-handled update reaches the schema preflight. Every surviving Doctor path runs the preflight before config loading, UI/install checks, state migrations, or repairs.
Incompatible state or registered agent schemas fail closed with the refusing build/install, found and supported schema versions, and matching-runtime guidance. Supported schemas and indeterminate/unreadable databases continue into normal Doctor diagnostics. The Gateway startup refusal keeps its existing default wording.
User Impact
Operators can still accept Doctor's documented fetch/rebase/build recovery from an interactive source checkout. If the running build remains incompatible, Doctor exits non-zero and tells the operator to use the state-writing/active Gateway installation or another compatible build; it does not suggest repairs it cannot safely perform.
Release-note context: stale Doctor invocations may update first, then fail before repair guidance when persisted database schemas remain newer than the executing build.
Evidence
OpenClaw 2026.7.1-beta.5 (b6387af)against a synthetic schema-6 fixture exited0, printed bothRepair with openclaw doctor --fixandRun "openclaw doctor --fix", then printedDoctor complete. Before/after SHA-256 checksums matched.tbx_01kz0rvw14wwrphrty18dn6dfx(run) built the changed surface and ran a schema-7 fixture against a schema-6 build. Doctor exited1, emittedDoctor refused to continue, contained nodoctor --fixorDoctor changes preview, and preserved both fixture checksums.tbx_01kz1qvn4j5618sw148yz0rzda(run) passed the successful interactive update, non-handled interactive update, and update-disabled refusal cases on the final patch content.Config invalid; doctor will run with best-effort configand no schema refusal.6/6, Doctor updater11/11, and Doctor ordering E2E3/3passed on Testbox.pnpm buildpassed in the built-CLI Testbox proof.