Repository navigation
fix(doctor): recover registrations after interrupted schema upgrades - #145595
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. Reviewed September 12, 2026, 12:51 AM ET / 04:51 UTC. ClawSweeper reviewWhat this changesDoctor refreshes database registrations after successful verification even when a retry does not advance the schema, with regression coverage and recovery documentation. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, focused repair: current main and v2026.9.4 still contain the retry gap. No introduced correctness defect was found, and the maintainer-protected PR is not eligible for automatic closure. Priority: P2 Review scores
Verification
How this fits togetherDoctor verifies and migrates agent databases, then records their availability in OpenClaw’s shared registry. Registry-based discovery uses those records to find compatible agent databases. flowchart TD
A[Doctor repair request] --> B[Discover configured and retained databases]
B --> C[Verify ownership and schema]
C --> D[Recheck maintenance lease]
D --> E[Refresh shared registry]
E --> F[Discover compatible agent databases]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +29, Docs +2. Total +31 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep registration recovery in Doctor’s existing verified migration path, preserving registry safeguards and confirming the supported upgrade flow. Do we have a high-confidence way to reproduce the issue? Yes, from source: a current-schema retained database with an older registry version is omitted by discovery, and main’s no-op migration skips refreshing it. The added regression models this exact state; this review did not execute it. Is this the best way to solve the issue? Yes. Refreshing through the existing registry owner after successful verification repairs the interrupted publication without introducing another discovery path, schema, or configuration option. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ca96441ed94f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where operators rerunning Doctor after an interrupted agent schema upgrade could still find a retained agent missing from registry-based discovery. The database could already have committed its current schema while its registration retained the previous version.
Why This Change Was Made
Doctor now revalidates its maintenance lease and publishes the registration after every successfully verified agent migration, including a retry that does not advance the physical schema. The existing registry owner retains path, import, and deletion fencing. Upgrade messages still describe only actual schema transitions.
User Impact
Running
openclaw doctor --fixwith a compatible build can recover these stale registrations, including registered databases inside the active state directory whose agents are no longer configured. The documentation describes this retry path. Each successfully scanned database receives the existing registration metadata refresh; database schemas and discovery scope are unchanged.Evidence
check:changedpassed, including core/test typechecks, lint, formatting, storage guards, and import-cycle validation.b9fbeed73bec6f1f118ca861b813d5c9504d1b39.[email protected]updater successfully installed this candidate tarball through the realopenclaw updatecommand. Migration rehearsal, Gateway canary, and final Doctor all passed; the retained agent advanced from state/agent schemas 16/19 to 17/20 with registry version 20.mainregistration and physical/schema-metadata/registry version 20. The initial fixture had incorrectly expected Doctor alone to create an unused agent database; its failed adapter record remains retained, and the corrected proof links the already-successful updater receipt without rerunning it.