Repository navigation
fix(update): let native Doctor own managed schema crossings - #169752
Conversation
|
🦞👀 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: blocked before merge. What this changesThis PR delegates managed schema migration and restoration to native OpenClaw owners and removes the controller’s edge-specific migration machinery. Example: A managed update advances an agent database from schema 25 to 26.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open: the native-owner cutover is useful, but Doctor-repairable config remains blocked and rollback can discard writes accepted by the candidate; the earlier JSON-classification finding is fixed. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe deployment controller owns service lifecycle, release pointers, and acceptance; native update commands receive stopped state and a backup root and use the existing backup, Doctor, and restoration owners. flowchart TD
A[Managed controller] --> B[Drain and stop Gateway]
B --> C[Native migration command]
C --> D[Backup and Doctor owners]
D --> E[Candidate start and acceptance]
E --> F[Retire backup]
E --> G[Native restoration command]
G --> H[Predecessor recovery]
Technical reviewBest possible solution: Keep the native-owner cutover, admit repairable config without changing its preimage, and preserve writes accepted by the candidate during recovery. Do we have a high-confidence way to reproduce the issue? Source establishes main’s unsupported crossing, the head’s legacy-config refusal, and the unchecked restoration path after candidate startup; no target code was executed. Is this the best way to solve the issue? Delegating to existing native owners is the right approach, provided the adapter preserves their repairable-config admission and later-write recovery safeguards. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fdbe95f5d1d6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +444, Tests -3542, Docs 0, Other -4098. Total -7196 across 30 files. Added test files: 2. View PR surface stats
Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed October 12, 2026, 4:37 AM ET / 08:37 UTC (Revision 2). |
…#169752) * fix(update): delegate managed schema crossings to Doctor * fix(update): complete JSON and type contracts for migration commands
What Problem This Solves
Managed release activation rejects supported schema crossings such as agent 25 → 26 because the controller recognizes only previously qualified edges.
User Impact
Managed updates delegate forward migration and recovery to the candidate OpenClaw release. Operators no longer need a controller update for each schema edge. Unknown future schemas and downgrades remain refused. This PR changes no database schema/version or user configuration option, and does not deploy or restart Team.
Migration measurement: 4m03.74s for 3.865 GiB; about 38.9 minutes at 37 GiB by linear extrapolation, excluding backup, drain, and restart. The shared Linux rig was contended and used synthetic data, so this is a scenario estimate, not a production downtime promise. Short outages at that scale need a separate OpenClaw-owned resumable derived-column backfill.
A native restore interrupted while publishing database files can require explicit recovery. It retains backups and displaced files and keeps the Gateway stopped; it never starts an older reader against mixed generations. Automatic per-file database restoration is deliberately outside this change. Existing edge-specific transactions must settle with their original installed controller before adopting this closure.
Why This Change Was Made
The controller keeps build, drain, service lifecycle, release pointers, and acceptance. The candidate's internal
update migrate,update restore, andupdate finishcommands reuse OpenClaw's WAL-safe backup, Doctor maintenance, and restoration owners. Durable receipts retain database/config preimages and canonical include bindings. Unchanged config includes are left untouched; restoring a symlinked include preserves its alias and restores the canonical target.Delete the controller's schema-edge tables, copied rehearsals, qualification/preservation machinery, and obsolete tests. Keep its startup fence closed through migration and restoration. Acceptance checks readyz, real
sessions.list, and the original session witness before retiring recovery artifacts. Host handoff retains pre-Doctor copy verification and post-Doctor logical continuity checks. Give migration/restoration at least two hours, preserving larger existing build-budget overrides. Update the operator skill and controller README.Production delta, excluding tests, fixtures, support, and Markdown: +890 / -4,527 = -3,637 lines.
Evidence
unsupported shared or agent schema crossing. After: admission returnsnative-update.node scripts/run-vitest.mjs src/cli/update-cli/update-command-migrate.test.ts --maxWorkers=1(544.28s wall, 316.73s test time on the contended Mac; 19.44s summed case time on CI/Bun). Both new include regressions were first observed failing for the intended reasons.git diff --checkpass.Synthetic migration measurement
The real candidate schema owner ran under its maintenance lease on Linux, using the full v25 schema: 500,000 transcript rows, 25,000 sessions/windows, and 12,500 outbox rows with mixed raw/compressed payloads. Command:
nice -n 10 ionice -c3 /usr/bin/time -v node --import ./scripts/tsx.mjs .local/lane809/benchmark.ts migrate, with disk-backed task-localTMPDIR. Exit 0; both version markers became 26; canonical sample bytes and row counts were preserved.Peak RSS: 630.6 MiB. Peak source/WAL/temp footprint: 11.557 GiB (~3× input); a retained backup adds another input-sized copy. A 7.73 GiB process-kill trial preserved schema 25, counts, and canonical samples after reopen. Its later completion attempt hit the rig's disk safety floor and was stopped. No production database was copied.
Validation environment
Earlier remote native proof passed 61 tests in five files on Hetzner lease
cbx_02ad7c96ce0a. Queued Testbox attempts did not run tests; the small AWS fallback failed during compilation with exit 137. Those runs preceded the current validation policy, and all leases were released. Current final proof uses the focused local native file and PR CI.